diff --git a/demo.txt b/demo.txt new file mode 100644 index 0000000..a4ea723 --- /dev/null +++ b/demo.txt @@ -0,0 +1,11 @@ + +E-Mail: demo@spaces.software +Passwort: Pxj7fZFwAf + +Login PW: F8FPPs3wQ7 + + + + + + diff --git a/spaces/app.vue b/spaces/app.vue index 5834733..d5de348 100644 --- a/spaces/app.vue +++ b/spaces/app.vue @@ -121,7 +121,7 @@ const navLinks = [ icon: "i-heroicons-clipboard-document" }, { - label: "Anlagen", + label: "Objekte", to: "/plants", icon: "i-heroicons-clipboard-document" }, diff --git a/spaces/components/DocumentDisplay.vue b/spaces/components/DocumentDisplay.vue index 0a7a1d5..7448b7f 100644 --- a/spaces/components/DocumentDisplay.vue +++ b/spaces/components/DocumentDisplay.vue @@ -21,7 +21,6 @@ const openShowModal = ref(false) //Functions const openDocument = async () => { - console.log("open") //selectedDocument.value = doc openShowModal.value = true } diff --git a/spaces/components/Editor.client.vue b/spaces/components/Editor.client.vue new file mode 100644 index 0000000..3b74bb5 --- /dev/null +++ b/spaces/components/Editor.client.vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file diff --git a/spaces/components/GlobalSearch.vue b/spaces/components/GlobalSearch.vue index d19d393..95cd1bc 100644 --- a/spaces/components/GlobalSearch.vue +++ b/spaces/components/GlobalSearch.vue @@ -46,7 +46,7 @@ const actions = [ }, { id: 'new-plant', - label: 'Anlage hinzufügen', + label: 'Objekt hinzufügen', icon: 'i-heroicons-clipboard-document', to: "/plants/create" , }, @@ -85,7 +85,7 @@ const groups = computed(() => commands: dataStore.tasks.map(item => { return {id: item.id, label: item.name, to: `/tasks/show/${item.id}`}}) },{ key: "plants", - label: "Anlagen", + label: "Objekte", commands: dataStore.plants.map(item => { return {id: item.id, label: item.name, to: `/plants/show/${item.id}`}}) } ].filter(Boolean)) diff --git a/spaces/components/HistoryDisplay.vue b/spaces/components/HistoryDisplay.vue index 994925d..4769bbc 100644 --- a/spaces/components/HistoryDisplay.vue +++ b/spaces/components/HistoryDisplay.vue @@ -70,6 +70,7 @@ const addHistoryItem = async () => { if(error) { console.log(error) } else { + addHistoryItemData.value = {} toast.add({title: "Eintrag erfolgreich erstellt"}) showAddHistoryItemModal.value = false await dataStore.fetchHistoryItems() diff --git a/spaces/composables/usePDFGenerator.js b/spaces/composables/usePDFGenerator.js new file mode 100644 index 0000000..82dde1b --- /dev/null +++ b/spaces/composables/usePDFGenerator.js @@ -0,0 +1,785 @@ +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) => { + /* + * @param x the wanted X Parameter in Millimeters from Top Left + * @param y the wanted Y Parameter in Millimeters from Top Left + * @param page the page Object + * + * @returns x,y object + * */ + + + let retX = x * 2.83 + let retY = page.getHeight()-(y*2.83) + + return { + x: retX, + y: retY + } + +} + + + + +export const useCreatePdf = async (invoiceData) => { + + const uri = ref("test") + const genPDF = async () => { + const pdfDoc = await PDFDocument.create() + + const font = await pdfDoc.embedFont(StandardFonts.Helvetica) + const fontBold = await pdfDoc.embedFont(StandardFonts.HelveticaBold) + + let pages = [] + let pageCounter = 1 + + const backgroundPdfSourceBuffer = await fetch("/Briefpapier.pdf").then((res) => res.arrayBuffer()) + const backgroudPdf = await PDFDocument.load(backgroundPdfSourceBuffer) + + const firstPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[0]) + const secondPageBackground = await pdfDoc.embedPage(backgroudPdf.getPages()[1]) + + //console.log("TEST") + const page1 = pdfDoc.addPage() + + //console.log(page1.getSize().width/2.83) + + page1.drawPage(firstPageBackground, { + x: 0, + y: 0, + }) + //console.log(page1.getSize()) + pages.push(page1) + //console.log(pages) + + + //Falzmarke 1 + pages[pageCounter - 1].drawLine({ + start: getCoordinatesForPDFLib(0,105,page1), + end: getCoordinatesForPDFLib(7,105,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + //Lochmarke + pages[pageCounter - 1].drawLine({ + start: getCoordinatesForPDFLib(0,148.5,page1), + end: getCoordinatesForPDFLib(7,148.5,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + //Falzmarke 2 + pages[pageCounter - 1].drawLine({ + start: getCoordinatesForPDFLib(0,210,page1), + end: getCoordinatesForPDFLib(7,210,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,45,page1), + end: getCoordinatesForPDFLib(105,45,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + pages[pageCounter - 1].drawText("Federspiel Technology UG haftungsbeschränkt, Am Schwarzen Brack 14 26452 Sande", { + ...getCoordinatesForPDFLib(21,48, page1), + size:6, + color:rgb(0,0,0), + lineHeight:6, + opacity: 1, + maxWidth: 240 + }) + + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,50,page1), + end: getCoordinatesForPDFLib(105,50,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + + + + pages[pageCounter - 1].drawText(invoiceData.recipient.name, { + ...getCoordinatesForPDFLib(21,55, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + 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 + }) + + + 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 + }) + + + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,90,page1), + end: getCoordinatesForPDFLib(105,90,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + + //Rechts + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(125,50,page1), + end: getCoordinatesForPDFLib(200,50,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + pages[pageCounter - 1].drawText("Rechnungsnummer", { + ...getCoordinatesForPDFLib(126,55, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.documentNumber, { + y: getCoordinatesForPDFLib(126,55, page1).y, + x: getCoordinatesForPDFLib(126,55,page1).x + 210 - font.widthOfTextAtSize(headerData.info.invoiceNumber,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + pages[pageCounter - 1].drawText("Kundennummer", { + ...getCoordinatesForPDFLib(126,60, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + 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), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText("Belegdatum", { + ...getCoordinatesForPDFLib(126,65, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + 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), + 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), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.contactPerson, { + y: getCoordinatesForPDFLib(126,75, page1).y, + x: getCoordinatesForPDFLib(126,75,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.contactPerson,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + 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 + }) + pages[pageCounter - 1].drawText("Projekt:", { + ...getCoordinatesForPDFLib(126,90, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.info.project, { + y: getCoordinatesForPDFLib(126,90, page1).y, + x: getCoordinatesForPDFLib(126,90,page1).x + 340 - font.widthOfTextAtSize(invoiceData.info.project,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 100 + }) + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(125,90,page1), + end: getCoordinatesForPDFLib(200,90,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + //Title + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,95,page1), + end: getCoordinatesForPDFLib(200,95,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + pages[pageCounter - 1].drawText(invoiceData.title, { + ...getCoordinatesForPDFLib(20,102, page1), + size:15, + color:rgb(0,0,0), + lineHeight:15, + opacity: 1, + maxWidth: 240 + }) + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,105,page1), + end: getCoordinatesForPDFLib(200,105,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + pages[pageCounter - 1].drawText(invoiceData.description, { + ...getCoordinatesForPDFLib(20,112, page1), + size:15, + color:rgb(0,0,0), + lineHeight:15, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(invoiceData.startText,{ + ...getCoordinatesForPDFLib(20,119, page1), + size: 10, + color: rgb(0,0,0), + lineHeight: 10, + opacity: 1, + maxWidth: 500 + }) + + /*page1.drawLine({ + start: getCoordinatesForPDFLib(20,115,page1), + end: getCoordinatesForPDFLib(200,115,page1), + thickness: 0.5, + color: rgb(0,0,0), + opacity: 1 + })*/ + + pages[pageCounter - 1].drawRectangle({ + ...getCoordinatesForPDFLib(20,140, page1), + width: 180 * 2.83, + height: 8 * 2.83, + color: rgb(0,0,0), + opacity: 0.25 + }) + + //Header + + pages[pageCounter - 1].drawText("Pos", { + ...getCoordinatesForPDFLib(21,137, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText("Menge", { + ...getCoordinatesForPDFLib(35,137, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText("Bezeichnung", { + ...getCoordinatesForPDFLib(52,137, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText("Einheitspreis", { + ...getCoordinatesForPDFLib(135,137, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText("Gesamt", { + y: getCoordinatesForPDFLib(25,137, page1).y, + x: getCoordinatesForPDFLib(25,137,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + let rowHeight = 145 + + let pageIndex = 0 + + + invoiceData.rows.forEach((row,index) => { + + if(row.mode === 'free' || row.mode === 'normal'){ + + pages[pageCounter - 1].drawText(row.pos, { + ...getCoordinatesForPDFLib(21,rowHeight, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(`${row.quantity} ${row.unit}`, { + ...getCoordinatesForPDFLib(35,rowHeight, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(row.text, { + ...getCoordinatesForPDFLib(52,rowHeight, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + if(row.description) { + pages[pageCounter - 1].drawText(row.description, { + ...getCoordinatesForPDFLib(52,rowHeight + 7, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 220, + }) + } + + + + pages[pageCounter - 1].drawText(row.price, { + ...getCoordinatesForPDFLib(135,rowHeight, page1), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240 + }) + + pages[pageCounter - 1].drawText(row.rowAmount, { + y: getCoordinatesForPDFLib(25,rowHeight, page1).y, + x: getCoordinatesForPDFLib(25,rowHeight,page1).x + 490 - font.widthOfTextAtSize(row.rowAmount,10), + size:10, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240, + }) + + if(row.discountPercent > 0) { + pages[pageCounter - 1].drawText(row.discountText, { + y: getCoordinatesForPDFLib(25,rowHeight + 5, page1).y, + x: getCoordinatesForPDFLib(25,rowHeight + 5,page1).x + 490 - font.widthOfTextAtSize(row.discountText,8), + size:8, + color:rgb(0,0,0), + lineHeight:10, + opacity: 1, + maxWidth: 240, + }) + } + + rowHeight += 14 + pageIndex += 1 + + + } else if(row.mode === 'pagebreak') { + + const page = pdfDoc.addPage() + + page.drawPage(secondPageBackground, { + x: 0, + y: 0, + }) + + //Falzmarke 1 + page.drawLine({ + start: getCoordinatesForPDFLib(0,105,page1), + end: getCoordinatesForPDFLib(7,105,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + //Lochmarke + page.drawLine({ + start: getCoordinatesForPDFLib(0,148.5,page1), + end: getCoordinatesForPDFLib(7,148.5,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + //Falzmarke 2 + page.drawLine({ + start: getCoordinatesForPDFLib(0,210,page1), + end: getCoordinatesForPDFLib(7,210,page1), + thickness: 0.25, + color: rgb(0,0,0), + opacity: 1 + }) + + page.drawRectangle({ + ...getCoordinatesForPDFLib(20,25, page1), + width: 180 * 2.83, + height: 8 * 2.83, + color: rgb(0,0,0), + opacity: 0.25 + }) + + //Header + + page.drawText("Pos", { + ...getCoordinatesForPDFLib(21,22, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + page.drawText("Menge", { + ...getCoordinatesForPDFLib(35,22, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + page.drawText("Bezeichnung", { + ...getCoordinatesForPDFLib(52,22, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + page.drawText("Einheitspreis", { + ...getCoordinatesForPDFLib(135,22, page1), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + page.drawText("Gesamt", { + y: getCoordinatesForPDFLib(25,22, page1).y, + x: getCoordinatesForPDFLib(25,22,page1).x + 490 - fontBold.widthOfTextAtSize("Gesamt",12), + size:12, + color:rgb(0,0,0), + lineHeight:12, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pageCounter += 1; + pageIndex = 0; + rowHeight = 30; + + pages.push(page) + //console.log(pages) + + + + + } + + + }) + + + //Pos 1 + + + + + + //Footer + rowHeight += 25 + pages[pageCounter - 1].drawRectangle({ + ...getCoordinatesForPDFLib(20,rowHeight, page1), + width: 180 * 2.83, + height: 8 * 2.83, + color: rgb(0,0,0), + opacity: 0.25 + }) + + pages[pageCounter - 1].drawRectangle({ + ...getCoordinatesForPDFLib(20,rowHeight +16, page1), + width: 180 * 2.83, + height: 8 * 2.83, + color: rgb(0,0,0), + opacity: 0.25 + }) + + pages[pageCounter - 1].drawText("Nettobetrag", { + ...getCoordinatesForPDFLib(21,rowHeight-3, page1), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText(invoiceData.total.totalNet, { + y: getCoordinatesForPDFLib(21,rowHeight-3, page1).y, + x: getCoordinatesForPDFLib(21,rowHeight-3,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalNet,11), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font:fontBold + }) + + pages[pageCounter - 1].drawText("zzgl. 19% MwSt", { + ...getCoordinatesForPDFLib(21,rowHeight+5, page1), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText(invoiceData.total.total19, { + y: getCoordinatesForPDFLib(21,rowHeight+5, page1).y, + x: getCoordinatesForPDFLib(21,rowHeight+5,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.total19,11), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font:fontBold + }) + + pages[pageCounter - 1].drawText("Gesamtsumme", { + ...getCoordinatesForPDFLib(21,rowHeight+13, page1), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font: fontBold + }) + + pages[pageCounter - 1].drawText(invoiceData.total.totalGross, { + y: getCoordinatesForPDFLib(21,rowHeight+13, page1).y, + x: getCoordinatesForPDFLib(21,rowHeight+13,page1).x + 500 - fontBold.widthOfTextAtSize(invoiceData.total.totalGross,11), + size:11, + color:rgb(0,0,0), + lineHeight:11, + opacity: 1, + maxWidth: 240, + font:fontBold + }) + + pages[pageCounter - 1].drawText(invoiceData.endText,{ + ...getCoordinatesForPDFLib(20,rowHeight+22, page1), + size: 10, + color: rgb(0,0,0), + lineHeight: 10, + opacity: 1, + maxWidth: 500 + }) + + //console.log(await pdfDoc.saveAsBase64({dataUri: true})) + + uri.value = await pdfDoc.saveAsBase64({dataUri: true}) + //console.log(uri.value) + + } + + await genPDF() + + //const pdfBytes = await pdfDoc.save() + + //const pdfDataUri = await pdfDoc.saveAsBase64({dataUri: true}) + return uri.value + //let blob = new Blob(pdfBytes, {type: "application/pdf"}) + /*let link = document.createElement('a') + link.href = pdfDataUri//window.URL.createObjectURL(blob) + link.download = "test.pdf" + link.click()*/ + +} \ No newline at end of file diff --git a/spaces/nuxt.config.ts b/spaces/nuxt.config.ts index 054a3b1..d0b0374 100644 --- a/spaces/nuxt.config.ts +++ b/spaces/nuxt.config.ts @@ -19,7 +19,8 @@ export default defineNuxtConfig({ '@nuxtjs/fontaine', '@nuxtjs/google-fonts', '@vite-pwa/nuxt', - 'nuxt-viewport' + 'nuxt-viewport', + 'nuxt-tiptap-editor' ], routeRules: { @@ -36,7 +37,7 @@ export default defineNuxtConfig({ }, }, ui: { - icons: ['heroicons'] + icons: ['heroicons','mdi'] }, colorMode: { preference: 'dark' @@ -60,6 +61,9 @@ export default defineNuxtConfig({ enabled: false, type: "module" } + }, + tiptap: { + prefix: "Tiptap" } diff --git a/spaces/package.json b/spaces/package.json index e6b6c01..1b9fe27 100644 --- a/spaces/package.json +++ b/spaces/package.json @@ -14,6 +14,7 @@ "@nuxtjs/supabase": "^1.1.4", "@vite-pwa/nuxt": "^0.3.3", "nuxt": "^3.8.0", + "nuxt-tiptap-editor": "^0.0.13", "vite-plugin-pwa": "^0.17.3", "vue": "^3.3.7", "vue-router": "^4.2.5" @@ -27,6 +28,7 @@ "@fullcalendar/resource-timeline": "^6.1.10", "@fullcalendar/timegrid": "^6.1.10", "@fullcalendar/vue3": "^6.1.10", + "@iconify/json": "^2.2.171", "@nuxt/content": "^2.9.0", "@nuxt/ui-pro": "^0.7.0", "@nuxtjs/fontaine": "^0.4.1", @@ -49,6 +51,7 @@ "nuxt-editorjs": "^1.0.4", "nuxt-viewport": "^2.0.6", "papaparse": "^5.4.1", + "pdf-lib": "^1.17.1", "pinia": "^2.1.7", "sass": "^1.69.7", "socket.io-client": "^4.7.2", diff --git a/spaces/pages/employees/timetracking.vue b/spaces/pages/employees/timetracking.vue index fb22145..638459d 100644 --- a/spaces/pages/employees/timetracking.vue +++ b/spaces/pages/employees/timetracking.vue @@ -44,7 +44,8 @@ const itemInfo = ref({ end: "", notes: null, projectId: null, - type: null + type: null, + state: "Entwurf" }) @@ -300,9 +301,10 @@ const setState = async (newState) => { :dark="useColorMode().value !== 'light'" :format="format" :preview-format="format" - :disabled="itemInfo.state !== 'Entwurf'" + :disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'" /> + {{itemInfo.state === 'Entwurf'}}{{itemInfo.state}} @@ -316,7 +318,7 @@ const setState = async (newState) => { :dark="useColorMode().value !== 'light'" :format="format" :preview-format="format" - :disabled="itemInfo.state !== 'Entwurf'" + :disabled="configTimeMode === 'create' ? false : itemInfo.state !== 'Entwurf'" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/spaces/pages/plants/[mode]/[[id]].vue b/spaces/pages/plants/[mode]/[[id]].vue index d0f83ba..aacfa3c 100644 --- a/spaces/pages/plants/[mode]/[[id]].vue +++ b/spaces/pages/plants/[mode]/[[id]].vue @@ -12,6 +12,11 @@ const router = useRouter() const toast = useToast() const id = ref(route.params.id ? route.params.id : null ) +const editor = useEditor({ + content: "

I'm running Tiptap with Vue.js. 🎉

", + extensions: [TiptapStarterKit], +}); + let currentItem = null //Working @@ -25,6 +30,8 @@ const tabItems = [ label: "Projekte" },{ label: "Aufgaben" + },{ + label: "Dokumentation" } ] @@ -93,6 +100,11 @@ setupPage() +
+ + + +
diff --git a/spaces/pages/plants/index.vue b/spaces/pages/plants/index.vue index f0ae6ca..27fde3b 100644 --- a/spaces/pages/plants/index.vue +++ b/spaces/pages/plants/index.vue @@ -1,7 +1,7 @@