diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 60ba7da..b35cfe1 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -66,6 +66,7 @@ console.log(profileStore.ownTenant) const letterheads = ref([]) const createddocuments = ref([]) const projects = ref([]) +const plants = ref([]) const products = ref([]) const productcategories = ref([]) const selectedProductcategorie = ref(null) @@ -83,6 +84,7 @@ const setupPage = async () => { letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type)) createddocuments.value = (await useSupabaseSelect("createddocuments","*")) projects.value = (await useSupabaseSelect("projects","*")) + plants.value = (await useSupabaseSelect("plants","*")) services.value = (await useSupabaseSelect("services","*")) servicecategories.value = (await useSupabaseSelect("servicecategories","*")) products.value = (await useSupabaseSelect("products","*")) @@ -670,18 +672,54 @@ const getDocumentData = () => { city: itemInfo.value.address.city || customerData.infoData.city, zip: itemInfo.value.address.zip || customerData.infoData.zip }, - info: { + /*info: { customerNumber: customerData.customerNumber, documentNumber: itemInfo.value.documentNumber, documentNumberTitle: itemInfo.value.documentNumberTitle, documentDate: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"), deliveryDate: dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY"), + deliveryDateEnd: itemInfo.value.deliveryDateEnd ? dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY") : null, deliveryDateType: itemInfo.value.deliveryDateType, contactPerson: contactPerson.fullName, contactTel: contactPerson.fixedTel || contactPerson.mobileTel, contactEMail: contactPerson.email, - project: dataStore.getProjectById(itemInfo.value.project) ? dataStore.getProjectById(itemInfo.value.project).name : null - }, + project: projects.value.find(i => i.id === itemInfo.value.project) ? projects.value.find(i => i.id === itemInfo.value.project).name : null, + plant: plants.value.find(i => i.id === itemInfo.value.plant) ? plants.value.find(i => i.id === itemInfo.value.plants).name : null, + },*/ + info: [ + { + label: itemInfo.value.documentNumberTitle, + content: itemInfo.value.documentNumber || "XXXX", + },{ + label: "Kundennummer", + content: customerData.customerNumber, + },{ + label: "Belegdatum", + content: dayjs(itemInfo.value.documentDate).format("DD.MM.YYYY"), + },{ + label: itemInfo.value.deliveryDateType, + content: ['Lieferzeitraum','Leistungszeitraum'].includes(itemInfo.value.deliveryDateType) ? dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY") : `${dayjs(itemInfo.value.deliveryDate).format("DD.MM.YYYY")} - ${dayjs(itemInfo.value.deliveryDateEnd).format("DD.MM.YYYY")}`, + },{ + label: "Ansprechpartner", + content: contactPerson.fullName, + }, + ... contactPerson.fixedTel || contactPerson.mobileTel ? [{ + label: "Telefon", + content: contactPerson.fixedTel || contactPerson.mobileTel, + }] : [], + ... contactPerson.email ? [{ + label: "E-Mail", + content: contactPerson.email, + }]: [], + ... itemInfo.value.plant ? [{ + label: "Objekt", + content: plants.value.find(i => i.id === itemInfo.value.plant).name, + }] : [], + ... itemInfo.value.project ? [{ + label: "Projekt", + content: projects.value.find(i => i.id === itemInfo.value.project).name + }]: [] + ], title: itemInfo.value.title, description: itemInfo.value.description, endText: templateEndText(generateContext(itemInfo.value, contactData)), @@ -847,6 +885,7 @@ const saveDocument = async (state,resetup = false) => { documentNumber: itemInfo.value.documentNumber, documentDate: itemInfo.value.documentDate, deliveryDate: itemInfo.value.deliveryDate, + deliveryDateEnd: itemInfo.value.deliveryDateEnd, paymentDays: itemInfo.value.paymentDays, deliveryDateType: itemInfo.value.deliveryDateType, info: {}, @@ -1242,10 +1281,62 @@ const setRowData = (row) => { /> + + + + + + + + + + + + + + + + + + + + + + @@ -1260,44 +1351,12 @@ const setRowData = (row) => { - - - - - - - - - - - - { v-model="itemInfo.contactEMail" /> + + + + + + + + Objekt + + +