diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index c0048bf..0bb66f1 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -119,7 +119,7 @@ const setCustomerData = () => { } const setContactPersonData = async () => { - console.log(itemInfo.value.contactPerson) + //console.log(itemInfo.value.contactPerson) let profile = await useSupabaseSelectSingle("profiles",itemInfo.value.contactPerson, '*') itemInfo.value.contactPersonName = profile.fullName @@ -220,6 +220,11 @@ const addPosition = (mode) => { id: lastId +1, mode: "title", }) + } else if(mode === "text") { + itemInfo.value.rows.push({ + id: lastId +1, + mode: "text", + }) } setPosNumbers() @@ -268,6 +273,7 @@ const findDocumentErrors = computed(() => { itemInfo.value.rows.forEach(row => { if(row.mode === "normal" && !row.product) errors.push({message: `In Position ${row.pos} ist kein Artikel ausgewählt`, type: "breaking"}) if(row.mode === "service" && !row.service) errors.push({message: `In Position ${row.pos} ist keine Leistung ausgewählt`, type: "breaking"}) + if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt ausgewählt`, type: "breaking"}) }) @@ -292,10 +298,10 @@ const documentTotal = computed(() => { let totalGross = 0 itemInfo.value.rows.forEach(row => { - if(row.mode !== 'pagebreak' && row.mode !== 'title'){ - console.log(row) + if(!['pagebreak','title','text'].includes(row.mode)){ + //console.log(row) let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2) - console.log(rowPrice) + //console.log(rowPrice) totalNet = totalNet + Number(rowPrice) if(row.taxPercent === 19) { @@ -329,7 +335,7 @@ const getDocumentData = () => { let unit = dataStore.units.find(i => i.id === row.unit) - if(row.mode !== 'pagebreak' && row.mode !== 'title') { + if(!['pagebreak','title','text'].includes(row.mode)) { if(row.mode === 'normal') row.text = dataStore.getProductById(row.product).name if(row.mode === 'service') row.text = dataStore.getServiceById(row.service).name @@ -350,11 +356,11 @@ const getDocumentData = () => { //Compile Start & EndText const templateStartText = Handlebars.compile(itemInfo.value.startText); const templateEndText = Handlebars.compile(itemInfo.value.endText); - console.log(templateStartText({ + /*console.log(templateStartText({ vorname: contactData ? contactData.firstName : "", nachname: contactData ? contactData.lastName : "" - })) - console.log(templateEndText({zahlungsziel_in_tagen: itemInfo.value.paymentDays})) + }))*/ + //console.log(templateEndText({zahlungsziel_in_tagen: itemInfo.value.paymentDays})) @@ -391,7 +397,7 @@ const getDocumentData = () => { total: documentTotal.value } - console.log(returnData) + //console.log(returnData) return returnData } @@ -407,13 +413,13 @@ const generateDocument = async () => { const {data,error} = await supabase.storage.from("files").download(path) - console.log(data) - console.log(error) + //console.log(data) + //console.log(error) uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer()) //alert(uri.value) showDocument.value = true - console.log(uri.value) + //console.log(uri.value) } const onChangeTab = (index) => { @@ -423,12 +429,22 @@ const onChangeTab = (index) => { } const setPosNumbers = () => { + let mainIndex = 0 + let subIndex = 1 let index = 1 let rows = itemInfo.value.rows.map(row => { - if(row.mode !== 'pagebreak' && row.mode !== 'title') { + if(row.mode === 'title') { + mainIndex += 1 + row.pos = mainIndex + subIndex = 1 + } else if(!['pagebreak','title','text'].includes(row.mode)) { + row.pos = `${mainIndex}.${subIndex}` + subIndex += 1 + } + /*if(!['pagebreak','title','text'].includes(row.mode)) { row.pos = index index += 1 - } + }*/ return row }) } @@ -541,8 +557,8 @@ setupPage() @@ -1003,16 +1019,21 @@ setupPage() + {{row.pos}}

{{getRowAmountUndiscounted(row)}} €{{getRowAmount(row)}} €

+ + + - + Leistungsposition + + Leistung - + Artikelposition + + Artikel - + Freitextposition + + Freie Position - - - - - - - - - - - - - -
Netto:{{documentTotal.totalNet}}
zzgl. 19 % USt:{{documentTotal.total19}}
Brutto:{{documentTotal.totalGross}}
+
+ + + + + + + + + + + + + +
Netto:{{documentTotal.totalNet}}
zzgl. 19 % USt:{{documentTotal.total19}}
Brutto:{{documentTotal.totalGross}}
+
+