diff --git a/spaces/components/DocumentDisplay.vue b/spaces/components/DocumentDisplay.vue index a6e690f..9bed3b7 100644 --- a/spaces/components/DocumentDisplay.vue +++ b/spaces/components/DocumentDisplay.vue @@ -85,11 +85,44 @@ const createVendorInvoice = async () => { const archiveDocument = () => { - documentData.tags = ["Archiviert"] + documentData.tags.push("Archiviert") updateDocument() } +const resourceOptions = ref([ + {label: 'Projekt', value: 'project', optionAttr: "name"}, + {label: 'Kunde', value: 'customer', optionAttr: "name"}, + {label: 'Lieferant', value: 'vendor', optionAttr: "name"}, + {label: 'Fahrzeug', value: 'vehicle', optionAttr: "licensePlate"}, + {label: 'Objekt', value: 'plant', optionAttr: "name"}, + {label: 'Produkt', value: 'product', optionAttr: "name"} +]) +const resourceToAssign = ref("project") +const itemOptions = ref([]) +const idToAssign = ref(null) +const getItemsBySelectedResource = () => { + if(resourceToAssign.value === "project") { + itemOptions.value = dataStore.projects + } else if(resourceToAssign.value === "customer") { + itemOptions.value = dataStore.customers + } else if(resourceToAssign.value === "vendor") { + itemOptions.value = dataStore.vendors + } else if(resourceToAssign.value === "vehicle") { + itemOptions.value = dataStore.vehicles + } else if(resourceToAssign.value === "product") { + itemOptions.value = dataStore.products + } else if(resourceToAssign.value === "plant") { + itemOptions.value = dataStore.plants + } else { + itemOptions.value = [] + } +} +getItemsBySelectedResource() +const updateDocumentAssignment = async () => { + documentData[resourceToAssign.value] = idToAssign.value + await updateDocument() +} @@ -196,7 +229,36 @@ const archiveDocument = () => { +

Dokument zuweisen:

+ + + + + + + + + + + + diff --git a/spaces/composables/usePDFGenerator.js b/spaces/composables/usePDFGenerator.js index a3b5b1e..e526428 100644 --- a/spaces/composables/usePDFGenerator.js +++ b/spaces/composables/usePDFGenerator.js @@ -1,26 +1,6 @@ import {PDFDocument, StandardFonts, rgb} from "pdf-lib" -let headerData = { - sender: "Federspiel Technology UG haftungsbeschränkt, Am Schwarzen Brack 14 26452 Sande", - recipient: { - name: "NOA Service GmbH", - contact: "Lena Kramer", - special: "Hinterm Haus", - address: "Oldenburger Str. 52", - city: "26340 Zetel" - }, - info: { - invoiceNumber: "RE23-1409", - customerNumber: "10069", - invoiceDate: "15.09.2023", - dateOfPerformance: "31.08.2023", - contactPerson: "Florian Federspiel", - tel: "015755769509", - email: "f.federspiel@federspiel.tech" - }, - title: "Rechnung-Nr. RE23-1409", - description: "BV: Stubbendränk 23, 26340 Zetel" -} + const getCoordinatesForPDFLib = (x ,y, page) => { /* @@ -45,7 +25,7 @@ const getCoordinatesForPDFLib = (x ,y, page) => { -export const useCreatePdf = async (invoiceData) => { +export const useCreatePdf = async (invoiceData,backgroundSourceBuffer) => { const uri = ref("test") const genPDF = async () => { @@ -57,11 +37,13 @@ export const useCreatePdf = async (invoiceData) => { let pages = [] let pageCounter = 1 - const backgroundPdfSourceBuffer = await fetch("/Briefpapier.pdf").then((res) => res.arrayBuffer()) - const backgroudPdf = await PDFDocument.load(backgroundPdfSourceBuffer) + + + //const backgroundPdfSourceBuffer = await fetch("/Briefpapier.pdf").then((res) => res.arrayBuffer()) + const backgroudPdf = await PDFDocument.load(backgroundSourceBuffer) const firstPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[0]) - const secondPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[1]) + const secondPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[backgroudPdf.getPages().length > 1 ? 1 : 0]) //console.log("TEST") const page1 = pdfDoc.addPage() @@ -142,40 +124,124 @@ export const useCreatePdf = async (invoiceData) => { opacity: 1, maxWidth: 240 }) - pages[pageCounter - 1].drawText(invoiceData.recipient.contact, { - ...getCoordinatesForPDFLib(21,60, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) - pages[pageCounter - 1].drawText(invoiceData.recipient.special, { - ...getCoordinatesForPDFLib(21,65, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) + + if(invoiceData.recipient.contact && !invoiceData.recipient.special) { + pages[pageCounter - 1].drawText(invoiceData.recipient.contact, { + ...getCoordinatesForPDFLib(21,60, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(invoiceData.recipient.street, { + ...getCoordinatesForPDFLib(21,65, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(`${invoiceData.recipient.zip} ${invoiceData.recipient.city}`, { + ...getCoordinatesForPDFLib(21,70, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } else if(invoiceData.recipient.contact && invoiceData.recipient.special) { + pages[pageCounter - 1].drawText(invoiceData.recipient.contact, { + ...getCoordinatesForPDFLib(21,60, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(invoiceData.recipient.special, { + ...getCoordinatesForPDFLib(21,65, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + + pages[pageCounter - 1].drawText(invoiceData.recipient.street, { + ...getCoordinatesForPDFLib(21,70, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(`${invoiceData.recipient.zip} ${invoiceData.recipient.city}`, { + ...getCoordinatesForPDFLib(21,75, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } else if(!invoiceData.recipient.contact && !invoiceData.recipient.special) { + + pages[pageCounter - 1].drawText(invoiceData.recipient.street, { + ...getCoordinatesForPDFLib(21,60, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(`${invoiceData.recipient.zip} ${invoiceData.recipient.city}`, { + ...getCoordinatesForPDFLib(21,65, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } else { + pages[pageCounter - 1].drawText(invoiceData.recipient.contact, { + ...getCoordinatesForPDFLib(21,60, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(invoiceData.recipient.special, { + ...getCoordinatesForPDFLib(21,65, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + + pages[pageCounter - 1].drawText(invoiceData.recipient.street, { + ...getCoordinatesForPDFLib(21,70, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText(`${invoiceData.recipient.zip} ${invoiceData.recipient.city}`, { + ...getCoordinatesForPDFLib(21,75, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } + - pages[pageCounter - 1].drawText(invoiceData.recipient.street, { - ...getCoordinatesForPDFLib(21,70, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) - pages[pageCounter - 1].drawText(`${invoiceData.recipient.zip} ${invoiceData.recipient.city}`, { - ...getCoordinatesForPDFLib(21,75, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) @@ -198,7 +264,7 @@ export const useCreatePdf = async (invoiceData) => { opacity: 1 })*/ - pages[pageCounter - 1].drawText("Rechnungsnummer", { + pages[pageCounter - 1].drawText(invoiceData.info.documentNumberTitle, { ...getCoordinatesForPDFLib(126,55, page1), size:10, color:rgb(0,0,0), @@ -207,9 +273,9 @@ export const useCreatePdf = async (invoiceData) => { maxWidth: 240 }) - pages[pageCounter - 1].drawText(invoiceData.info.documentNumber, { + pages[pageCounter - 1].drawText(invoiceData.info.documentNumber ? invoiceData.info.documentNumber : "XXXX", { y: getCoordinatesForPDFLib(126,55, page1).y, - x: getCoordinatesForPDFLib(126,55,page1).x + 210 - font.widthOfTextAtSize(headerData.info.invoiceNumber,10), + x: getCoordinatesForPDFLib(126,55,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.documentNumber ? invoiceData.info.documentNumber : "XXXX",10), size:10, color:rgb(0,0,0), lineHeight:10, @@ -227,7 +293,7 @@ export const useCreatePdf = async (invoiceData) => { pages[pageCounter - 1].drawText(invoiceData.info.customerNumber, { y: getCoordinatesForPDFLib(126,60, page1).y, - x: getCoordinatesForPDFLib(126,60,page1).x + 210 - font.widthOfTextAtSize(headerData.info.customerNumber,10), + x: getCoordinatesForPDFLib(126,60,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.customerNumber,10), size:10, color:rgb(0,0,0), lineHeight:10, @@ -246,15 +312,7 @@ export const useCreatePdf = async (invoiceData) => { pages[pageCounter - 1].drawText(invoiceData.info.documentDate, { y: getCoordinatesForPDFLib(126,65, page1).y, - x: getCoordinatesForPDFLib(126,65,page1).x + 210 - font.widthOfTextAtSize(headerData.info.invoiceDate,10), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) - pages[pageCounter - 1].drawText("Lieferdatum", { - ...getCoordinatesForPDFLib(126,70, page1), + x: getCoordinatesForPDFLib(126,65,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.documentDate,10), size:10, color:rgb(0,0,0), lineHeight:10, @@ -262,15 +320,28 @@ export const useCreatePdf = async (invoiceData) => { maxWidth: 240 }) - pages[pageCounter - 1].drawText(invoiceData.info.deliveryDate, { - y: getCoordinatesForPDFLib(126,70, page1).y, - x: getCoordinatesForPDFLib(126,70,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.deliveryDate,10), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) + if(invoiceData.info.deliveryDateType !== "Kein Lieferdatum anzeigen") { + pages[pageCounter - 1].drawText(invoiceData.info.deliveryDateType, { + ...getCoordinatesForPDFLib(126,70, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.deliveryDate, { + y: getCoordinatesForPDFLib(126,70, page1).y, + x: getCoordinatesForPDFLib(126,70,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.deliveryDate,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } + + pages[pageCounter - 1].drawText("Ansprechpartner", { ...getCoordinatesForPDFLib(126,75, page1), @@ -291,43 +362,86 @@ export const useCreatePdf = async (invoiceData) => { maxWidth: 240 }) - pages[pageCounter - 1].drawText("Telefon", { - ...getCoordinatesForPDFLib(126,80, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) + if(invoiceData.info.contactTel && invoiceData.info.contactEMail) { + pages[pageCounter - 1].drawText("Telefon", { + ...getCoordinatesForPDFLib(126,80, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.contactTel, { + y: getCoordinatesForPDFLib(126,80, page1).y, + x: getCoordinatesForPDFLib(126,80,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactTel,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText("E-Mail", { + ...getCoordinatesForPDFLib(126,85, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.contactEMail, { + y: getCoordinatesForPDFLib(126,85, page1).y, + x: getCoordinatesForPDFLib(126,85,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactEMail,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } else if(invoiceData.info.contactTel && !invoiceData.info.contactEMail) { + pages[pageCounter - 1].drawText("Telefon", { + ...getCoordinatesForPDFLib(126,80, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.contactTel, { + y: getCoordinatesForPDFLib(126,80, page1).y, + x: getCoordinatesForPDFLib(126,80,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactTel,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } else if(!invoiceData.info.contactTel && invoiceData.info.contactEMail) { + pages[pageCounter - 1].drawText("E-Mail", { + ...getCoordinatesForPDFLib(126,80, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.contactEMail, { + y: getCoordinatesForPDFLib(126,80, page1).y, + x: getCoordinatesForPDFLib(126,80,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactEMail,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + } - pages[pageCounter - 1].drawText(invoiceData.info.contactTel, { - y: getCoordinatesForPDFLib(126,80, page1).y, - x: getCoordinatesForPDFLib(126,80,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactTel,10), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) - pages[pageCounter - 1].drawText("E-Mail", { - ...getCoordinatesForPDFLib(126,85, page1), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) - pages[pageCounter - 1].drawText(invoiceData.info.contactEMail, { - y: getCoordinatesForPDFLib(126,85, page1).y, - x: getCoordinatesForPDFLib(126,85,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactEMail,10), - size:10, - color:rgb(0,0,0), - lineHeight:10, - opacity: 1, - maxWidth: 240 - }) /*pages[pageCounter - 1].drawText("Projekt:", { ...getCoordinatesForPDFLib(126,90, page1), size:10, @@ -382,14 +496,17 @@ export const useCreatePdf = async (invoiceData) => { opacity: 1 })*/ - pages[pageCounter - 1].drawText(invoiceData.description, { - ...getCoordinatesForPDFLib(20,112, page1), - size:13, - color:rgb(0,0,0), - lineHeight:15, - opacity: 1, - maxWidth: 500 - }) + if(invoiceData.description) { + pages[pageCounter - 1].drawText(invoiceData.description, { + ...getCoordinatesForPDFLib(20,112, page1), + size:13, + color:rgb(0,0,0), + lineHeight:15, + opacity: 1, + maxWidth: 500 + }) + } + pages[pageCounter - 1].drawText(invoiceData.startText,{ ...getCoordinatesForPDFLib(20,119, page1), diff --git a/spaces/layouts/default.vue b/spaces/layouts/default.vue index 9d854aa..89b2f07 100644 --- a/spaces/layouts/default.vue +++ b/spaces/layouts/default.vue @@ -303,7 +303,11 @@ const links = [[{ label: "Inventar", to: "/inventoryitems", icon: "i-heroicons-puzzle-piece" - },] + },],[{ + label: "Einstellungen", + to:"/settings", + icon: "i-heroicons-cog-8-tooth" +}] ] @@ -441,6 +445,13 @@ const links = [[{ /> +
@@ -476,13 +487,13 @@ const links = [[{ #contentContainer { width: 77vw; height: 95vh; -} -/* -ms-overflow-style: none; !* IE and Edge *! - scrollbar-width: none; !* Firefox *! + overflow-y: scroll; + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ } #contentContainer::-webkit-scrollbar { display: none; -}*/ +} \ No newline at end of file diff --git a/spaces/package.json b/spaces/package.json index f59c861..5b7c45e 100644 --- a/spaces/package.json +++ b/spaces/package.json @@ -48,6 +48,7 @@ "buffer": "^6.0.3", "client-oauth2": "^4.3.3", "dayjs": "^1.11.10", + "handlebars": "^4.7.8", "jsprintmanager": "^6.0.3", "nuxt-editorjs": "^1.0.4", "nuxt-viewport": "^2.0.6", diff --git a/spaces/pages/banking/index.vue b/spaces/pages/banking/index.vue index 4178ef9..ea370fc 100644 --- a/spaces/pages/banking/index.vue +++ b/spaces/pages/banking/index.vue @@ -10,7 +10,13 @@ placeholder="Suche..." /> --> - + + + + Konto + + +import Axios from "axios" + + +const newAccounts = ref([]) + +const setupPage = async () => { + +} + + + + + + + \ No newline at end of file diff --git a/spaces/pages/contracts/[mode]/[[id]].vue b/spaces/pages/contracts/[mode]/[[id]].vue index 08ca69a..30b239f 100644 --- a/spaces/pages/contracts/[mode]/[[id]].vue +++ b/spaces/pages/contracts/[mode]/[[id]].vue @@ -62,11 +62,11 @@ setupPage() + + + + + + + + + + + + - - - - -
+