From 162f516647c1a310b0cb58ab783c7a3a71c2255c Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 2 Feb 2025 19:34:38 +0100 Subject: [PATCH] Added Document Date to Title pos Added Automatic timespan --- pages/createDocument/edit/[[id]].vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index c253ca0..027a506 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -133,23 +133,33 @@ const setupPage = async () => { setCustomerData() + let firstDate = null + let lastDate = null + linkedDocuments.forEach(doc => { let lastId = 0 itemInfo.value.rows.forEach(row => { if(row.id > lastId) lastId = row.id }) + if(dayjs(doc.documentDate).isBefore(firstDate) || !firstDate) firstDate = doc.documentDate + if(dayjs(doc.documentDate).isAfter(lastDate) || !lastDate) lastDate = doc.documentDate + itemInfo.value.rows.push(...[ { id:uuidv4(), mode: "title", - text: doc.title + text: `${doc.title} vom ${dayjs(doc.documentDate).format("DD.MM.YYYY")}` }, ...doc.rows ]) }) + itemInfo.value.deliveryDateType = "Leistungszeitraum" + itemInfo.value.deliveryDate = firstDate + itemInfo.value.deliveryDateEnd = lastDate + itemInfo.value.rows.forEach(row => { row.discountPercent = 0 @@ -718,7 +728,7 @@ const getDocumentData = () => { 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")}`, + 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,