Merge branch 'refs/heads/dev' into beta
This commit is contained in:
@@ -3,12 +3,15 @@ import dayjs from "dayjs"
|
||||
import Handlebars from "handlebars"
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import {useFunctions} from "~/composables/useFunctions.js";
|
||||
import StandardEntityModal from "~/components/StandardEntityModal.vue";
|
||||
import EntityModalButtons from "~/components/EntityModalButtons.vue";
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const supabase = useSupabaseClient()
|
||||
const modal = useModal()
|
||||
|
||||
|
||||
definePageMeta({
|
||||
@@ -326,7 +329,14 @@ const setTaxType = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const setCustomerData = () => {
|
||||
const setCustomerData = async (customerId) => {
|
||||
|
||||
if(customerId){
|
||||
itemInfo.value.customer = customerId
|
||||
}
|
||||
|
||||
customers.value = await useSupabaseSelect("customers")
|
||||
|
||||
|
||||
let customer = customers.value.find(i => i.id === itemInfo.value.customer)
|
||||
console.log(customer)
|
||||
@@ -1363,31 +1373,67 @@ const setRowData = (row) => {
|
||||
searchable-placeholder="Suche..."
|
||||
v-model="itemInfo.customer"
|
||||
@change="setCustomerData"
|
||||
class="flex-auto mr-2"
|
||||
class="flex-auto"
|
||||
>
|
||||
<UButton
|
||||
:color="itemInfo.customer ? 'primary' : 'rose'"
|
||||
variant="outline"
|
||||
class="w-full"
|
||||
>
|
||||
{{itemInfo.customer ? customers.find(i => i.id === itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||
{{customers.find(i => i.id === itemInfo.customer) ? customers.find(i => i.id === itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||
|
||||
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
||||
</UButton>
|
||||
</USelectMenu>
|
||||
<EntityModalButtons
|
||||
type="customers"
|
||||
:id="itemInfo.customer"
|
||||
@return-data="(data) => setCustomerData(data.id)"
|
||||
/>
|
||||
<!-- <UButton
|
||||
variant="outline"
|
||||
class="w-25 ml-2"
|
||||
v-if="itemInfo.customer"
|
||||
icon="i-heroicons-eye"
|
||||
@click="modal.open(StandardEntityModal, {
|
||||
id: itemInfo.customer,
|
||||
type: 'customers',
|
||||
mode: 'show',
|
||||
})"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
class="w-25"
|
||||
class="w-25 ml-2"
|
||||
v-if="itemInfo.customer"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/standardEntity/customers/show/${itemInfo.customer}`)"
|
||||
>Kunde</UButton>
|
||||
icon="i-heroicons-pencil-solid"
|
||||
@click="modal.open(StandardEntityModal, {
|
||||
id: itemInfo.customer,
|
||||
type: 'customers',
|
||||
mode: 'edit',
|
||||
onReturnData(data) {
|
||||
setCustomerData()
|
||||
}
|
||||
})"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
class="w-25 ml-2"
|
||||
v-if="!itemInfo.customer"
|
||||
icon="i-heroicons-plus"
|
||||
@click="modal.open(StandardEntityModal, {
|
||||
type: 'customers',
|
||||
mode: 'create',
|
||||
onReturnData(data) {
|
||||
setCustomerData(data.id)
|
||||
}
|
||||
})"
|
||||
/>-->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<UAlert
|
||||
v-if="itemInfo.customer"
|
||||
v-if="customers.find(i => i.id === itemInfo.customer)"
|
||||
class="mt-2"
|
||||
variant="solid"
|
||||
color="white"
|
||||
@@ -1432,12 +1478,18 @@ const setRowData = (row) => {
|
||||
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
<UButton
|
||||
<!-- <UButton
|
||||
variant="outline"
|
||||
v-if="itemInfo.contact"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/standardEntity/contacts/show/${itemInfo.contact}`)"
|
||||
>Kontakt</UButton>
|
||||
>Kontakt</UButton>-->
|
||||
<EntityModalButtons
|
||||
type="contacts"
|
||||
:id="itemInfo.contact"
|
||||
:create-query="{customerId: itemInfo.customer}"
|
||||
@return-data="(data) => itemInfo.contact = data.id"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
@@ -1634,12 +1686,12 @@ const setRowData = (row) => {
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="itemInfo.plant = null"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
v-if="itemInfo.plant"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/standardEntity/plants/show/${itemInfo.plant}`)"
|
||||
>Objekt</UButton>
|
||||
<EntityModalButtons
|
||||
type="plants"
|
||||
:id="itemInfo.plant"
|
||||
:create-query="{customer: itemInfo.customer}"
|
||||
@return-data="(data) => itemInfo.plant = data.id"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
@@ -1673,12 +1725,12 @@ const setRowData = (row) => {
|
||||
icon="i-heroicons-x-mark"
|
||||
@click="itemInfo.project = null"
|
||||
/>
|
||||
<UButton
|
||||
variant="outline"
|
||||
v-if="itemInfo.project"
|
||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
|
||||
>Projekt</UButton>
|
||||
<EntityModalButtons
|
||||
type="projects"
|
||||
:id="itemInfo.project"
|
||||
:create-query="{customer: itemInfo.customer, plant: itemInfo.plant}"
|
||||
@return-data="(data) => itemInfo.project = data.id"
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
|
||||
Reference in New Issue
Block a user