Many Changes
This commit is contained in:
@@ -85,11 +85,44 @@ const createVendorInvoice = async () => {
|
|||||||
|
|
||||||
|
|
||||||
const archiveDocument = () => {
|
const archiveDocument = () => {
|
||||||
documentData.tags = ["Archiviert"]
|
documentData.tags.push("Archiviert")
|
||||||
updateDocument()
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -196,7 +229,36 @@ const archiveDocument = () => {
|
|||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
<p>Dokument zuweisen:</p>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
|
label="Resource auswählen"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="resourceOptions"
|
||||||
|
v-model="resourceToAssign"
|
||||||
|
value-attribute="value"
|
||||||
|
option-attribute="label"
|
||||||
|
@change="getItemsBySelectedResource"
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Eintrag auswählen:"
|
||||||
|
>
|
||||||
|
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
<USelectMenu
|
||||||
|
:options="itemOptions"
|
||||||
|
v-model="idToAssign"
|
||||||
|
:option-attribute="resourceOptions.find(i => i.value === resourceToAssign)? resourceOptions.find(i => i.value === resourceToAssign).optionAttr : 'name'"
|
||||||
|
value-attribute="id"
|
||||||
|
@change="updateDocumentAssignment"
|
||||||
|
></USelectMenu>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <UFormGroup
|
||||||
label="Projekt zuweisen:"
|
label="Projekt zuweisen:"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
@@ -230,7 +292,7 @@ const archiveDocument = () => {
|
|||||||
{{dataStore.customers.find(item => item.id === documentData.customer) ? dataStore.customers.find(item => item.id === documentData.customer).name : "Kein Kunde ausgewählt" }}
|
{{dataStore.customers.find(item => item.id === documentData.customer) ? dataStore.customers.find(item => item.id === documentData.customer).name : "Kein Kunde ausgewählt" }}
|
||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>-->
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,26 +1,6 @@
|
|||||||
import {PDFDocument, StandardFonts, rgb} from "pdf-lib"
|
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) => {
|
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 uri = ref("test")
|
||||||
const genPDF = async () => {
|
const genPDF = async () => {
|
||||||
@@ -57,11 +37,13 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
let pages = []
|
let pages = []
|
||||||
let pageCounter = 1
|
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 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")
|
//console.log("TEST")
|
||||||
const page1 = pdfDoc.addPage()
|
const page1 = pdfDoc.addPage()
|
||||||
@@ -142,6 +124,33 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 240
|
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, {
|
pages[pageCounter - 1].drawText(invoiceData.recipient.contact, {
|
||||||
...getCoordinatesForPDFLib(21,60, page1),
|
...getCoordinatesForPDFLib(21,60, page1),
|
||||||
size:10,
|
size:10,
|
||||||
@@ -176,6 +185,63 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 240
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +264,7 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
pages[pageCounter - 1].drawText("Rechnungsnummer", {
|
pages[pageCounter - 1].drawText(invoiceData.info.documentNumberTitle, {
|
||||||
...getCoordinatesForPDFLib(126,55, page1),
|
...getCoordinatesForPDFLib(126,55, page1),
|
||||||
size:10,
|
size:10,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
@@ -207,9 +273,9 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
maxWidth: 240
|
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,
|
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,
|
size:10,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
lineHeight:10,
|
lineHeight:10,
|
||||||
@@ -227,7 +293,7 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
|
|
||||||
pages[pageCounter - 1].drawText(invoiceData.info.customerNumber, {
|
pages[pageCounter - 1].drawText(invoiceData.info.customerNumber, {
|
||||||
y: getCoordinatesForPDFLib(126,60, page1).y,
|
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,
|
size:10,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
lineHeight:10,
|
lineHeight:10,
|
||||||
@@ -246,14 +312,16 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
|
|
||||||
pages[pageCounter - 1].drawText(invoiceData.info.documentDate, {
|
pages[pageCounter - 1].drawText(invoiceData.info.documentDate, {
|
||||||
y: getCoordinatesForPDFLib(126,65, page1).y,
|
y: getCoordinatesForPDFLib(126,65, page1).y,
|
||||||
x: getCoordinatesForPDFLib(126,65,page1).x + 210 - font.widthOfTextAtSize(headerData.info.invoiceDate,10),
|
x: getCoordinatesForPDFLib(126,65,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.documentDate,10),
|
||||||
size:10,
|
size:10,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
lineHeight:10,
|
lineHeight:10,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 240
|
maxWidth: 240
|
||||||
})
|
})
|
||||||
pages[pageCounter - 1].drawText("Lieferdatum", {
|
|
||||||
|
if(invoiceData.info.deliveryDateType !== "Kein Lieferdatum anzeigen") {
|
||||||
|
pages[pageCounter - 1].drawText(invoiceData.info.deliveryDateType, {
|
||||||
...getCoordinatesForPDFLib(126,70, page1),
|
...getCoordinatesForPDFLib(126,70, page1),
|
||||||
size:10,
|
size:10,
|
||||||
color:rgb(0,0,0),
|
color:rgb(0,0,0),
|
||||||
@@ -271,6 +339,9 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 240
|
maxWidth: 240
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pages[pageCounter - 1].drawText("Ansprechpartner", {
|
pages[pageCounter - 1].drawText("Ansprechpartner", {
|
||||||
...getCoordinatesForPDFLib(126,75, page1),
|
...getCoordinatesForPDFLib(126,75, page1),
|
||||||
@@ -291,6 +362,7 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
maxWidth: 240
|
maxWidth: 240
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if(invoiceData.info.contactTel && invoiceData.info.contactEMail) {
|
||||||
pages[pageCounter - 1].drawText("Telefon", {
|
pages[pageCounter - 1].drawText("Telefon", {
|
||||||
...getCoordinatesForPDFLib(126,80, page1),
|
...getCoordinatesForPDFLib(126,80, page1),
|
||||||
size:10,
|
size:10,
|
||||||
@@ -328,6 +400,48 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 240
|
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("Projekt:", {
|
/*pages[pageCounter - 1].drawText("Projekt:", {
|
||||||
...getCoordinatesForPDFLib(126,90, page1),
|
...getCoordinatesForPDFLib(126,90, page1),
|
||||||
size:10,
|
size:10,
|
||||||
@@ -382,6 +496,7 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
|
if(invoiceData.description) {
|
||||||
pages[pageCounter - 1].drawText(invoiceData.description, {
|
pages[pageCounter - 1].drawText(invoiceData.description, {
|
||||||
...getCoordinatesForPDFLib(20,112, page1),
|
...getCoordinatesForPDFLib(20,112, page1),
|
||||||
size:13,
|
size:13,
|
||||||
@@ -390,6 +505,8 @@ export const useCreatePdf = async (invoiceData) => {
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
maxWidth: 500
|
maxWidth: 500
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pages[pageCounter - 1].drawText(invoiceData.startText,{
|
pages[pageCounter - 1].drawText(invoiceData.startText,{
|
||||||
...getCoordinatesForPDFLib(20,119, page1),
|
...getCoordinatesForPDFLib(20,119, page1),
|
||||||
|
|||||||
@@ -303,7 +303,11 @@ const links = [[{
|
|||||||
label: "Inventar",
|
label: "Inventar",
|
||||||
to: "/inventoryitems",
|
to: "/inventoryitems",
|
||||||
icon: "i-heroicons-puzzle-piece"
|
icon: "i-heroicons-puzzle-piece"
|
||||||
},]
|
},],[{
|
||||||
|
label: "Einstellungen",
|
||||||
|
to:"/settings",
|
||||||
|
icon: "i-heroicons-cog-8-tooth"
|
||||||
|
}]
|
||||||
]
|
]
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -441,6 +445,13 @@ const links = [[{
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</UVerticalNavigation>
|
</UVerticalNavigation>
|
||||||
|
<!-- <UButton
|
||||||
|
:icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'"
|
||||||
|
color="white"
|
||||||
|
variant="outline"
|
||||||
|
aria-label="Theme"
|
||||||
|
@click="isLight = !isLight"
|
||||||
|
/>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="m-3" id="contentContainer">
|
<div class="m-3" id="contentContainer">
|
||||||
@@ -476,13 +487,13 @@ const links = [[{
|
|||||||
#contentContainer {
|
#contentContainer {
|
||||||
width: 77vw;
|
width: 77vw;
|
||||||
height: 95vh;
|
height: 95vh;
|
||||||
}
|
overflow-y: scroll;
|
||||||
/* -ms-overflow-style: none; !* IE and Edge *!
|
-ms-overflow-style: none; /* IE and Edge */
|
||||||
scrollbar-width: none; !* Firefox *!
|
scrollbar-width: none; /* Firefox */
|
||||||
}
|
}
|
||||||
|
|
||||||
#contentContainer::-webkit-scrollbar {
|
#contentContainer::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -48,6 +48,7 @@
|
|||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"client-oauth2": "^4.3.3",
|
"client-oauth2": "^4.3.3",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
|
"handlebars": "^4.7.8",
|
||||||
"jsprintmanager": "^6.0.3",
|
"jsprintmanager": "^6.0.3",
|
||||||
"nuxt-editorjs": "^1.0.4",
|
"nuxt-editorjs": "^1.0.4",
|
||||||
"nuxt-viewport": "^2.0.6",
|
"nuxt-viewport": "^2.0.6",
|
||||||
|
|||||||
@@ -10,7 +10,13 @@
|
|||||||
placeholder="Suche..."
|
placeholder="Suche..."
|
||||||
/>
|
/>
|
||||||
</InputGroup>-->
|
</InputGroup>-->
|
||||||
|
<Toolbar>
|
||||||
|
<UButton
|
||||||
|
@click="router.push('/banking/newAccount')"
|
||||||
|
>
|
||||||
|
+ Konto
|
||||||
|
</UButton>
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
|
|
||||||
<UTable
|
<UTable
|
||||||
|
|||||||
25
spaces/pages/banking/newAccount/index.vue
Normal file
25
spaces/pages/banking/newAccount/index.vue
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<script setup>
|
||||||
|
import Axios from "axios"
|
||||||
|
|
||||||
|
|
||||||
|
const newAccounts = ref([])
|
||||||
|
|
||||||
|
const setupPage = async () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
New
|
||||||
|
<UButton
|
||||||
|
@click="setupPage"
|
||||||
|
>
|
||||||
|
Setup
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -62,11 +62,11 @@ setupPage()
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1
|
<h1
|
||||||
class="text-center my-3 font-bold text-2xl"
|
class="mb-3 truncate font-bold text-2xl"
|
||||||
v-if="currentItem"
|
v-if="currentItem"
|
||||||
>{{currentItem.name}}</h1>
|
>Vertrag: {{currentItem.name}}</h1>
|
||||||
<UTabs
|
<UTabs
|
||||||
v-if="currentItem && mode == 'show'"
|
v-if="currentItem && mode === 'show'"
|
||||||
:items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Dokumente'}]"
|
:items="[{label: 'Informationen'}, {label: 'Logbuch'}, {label: 'Dokumente'}]"
|
||||||
>
|
>
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
@@ -74,7 +74,7 @@ setupPage()
|
|||||||
<div v-if="item.label === 'Informationen'">
|
<div v-if="item.label === 'Informationen'">
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="mode == 'show' && currentItem.id"
|
v-if="mode === 'show' && currentItem.id"
|
||||||
@click="editCustomer"
|
@click="editCustomer"
|
||||||
>
|
>
|
||||||
Bearbeiten
|
Bearbeiten
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
|
import Handlebars from "handlebars"
|
||||||
|
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const user = useSupabaseUser()
|
const user = useSupabaseUser()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const supabase = useSupabaseClient()
|
const supabase = useSupabaseClient()
|
||||||
import {decode} from 'base64-arraybuffer'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const tabItems = [
|
|
||||||
{
|
|
||||||
label: "Editor"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Vorschau"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const itemInfo = ref({
|
const itemInfo = ref({
|
||||||
type: "invoices",
|
type: "invoices",
|
||||||
@@ -31,8 +25,10 @@ const itemInfo = ref({
|
|||||||
},
|
},
|
||||||
project: null,
|
project: null,
|
||||||
documentNumber: null,
|
documentNumber: null,
|
||||||
documentDate: null,
|
documentNumberTitle: "Rechnungsnummer",
|
||||||
deliveryDate: null,
|
documentDate: dayjs(),
|
||||||
|
deliveryDate: dayjs(),
|
||||||
|
deliveryDateType: "Lieferdatum",
|
||||||
dateOfPerformance: null,
|
dateOfPerformance: null,
|
||||||
createdBy: user.value.id,
|
createdBy: user.value.id,
|
||||||
title: null,
|
title: null,
|
||||||
@@ -41,6 +37,22 @@ const itemInfo = ref({
|
|||||||
endText: null,
|
endText: null,
|
||||||
rows: [
|
rows: [
|
||||||
|
|
||||||
|
],
|
||||||
|
contactPerson: null,
|
||||||
|
contactPersonName: null,
|
||||||
|
contactTel: null,
|
||||||
|
contactEMail: null,
|
||||||
|
})
|
||||||
|
|
||||||
|
const tabItems = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: "Editor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Vorschau",
|
||||||
|
disabled: !itemInfo.value.customer && !itemInfo.value.contact
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -51,11 +63,52 @@ const setupPage = () => {
|
|||||||
|
|
||||||
if(route.query) {
|
if(route.query) {
|
||||||
if(route.query.type) itemInfo.value.type = route.query.type
|
if(route.query.type) itemInfo.value.type = route.query.type
|
||||||
|
|
||||||
|
if(itemInfo.value.type === "invoices") {
|
||||||
|
itemInfo.value.documentNumberTitle = "Rechnungsnummer"
|
||||||
|
itemInfo.value.title = `Rechnung-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
||||||
|
} else if(itemInfo.value.type === "quotes") {
|
||||||
|
itemInfo.value.documentNumberTitle = "Angebotsnummer"
|
||||||
|
itemInfo.value.title = `Angebot-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
||||||
|
} else if(itemInfo.value.type === "deliveryNotes") {
|
||||||
|
itemInfo.value.documentNumberTitle = "Lieferscheinnummer"
|
||||||
|
itemInfo.value.title = `Lieferschein-Nr. ${itemInfo.value.documentNumber ? itemInfo.value.documentNumber : "XXXX"}`
|
||||||
|
}
|
||||||
|
|
||||||
|
itemInfo.value.startText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "startText").text
|
||||||
|
itemInfo.value.endText = dataStore.getTextTemplatesByDocumentType(itemInfo.value.type).find(i => i.default && i.pos === "endText").text
|
||||||
|
|
||||||
|
setContactPersonData()
|
||||||
|
|
||||||
|
|
||||||
if(route.query.project) itemInfo.value.project = Number(route.query.project)
|
if(route.query.project) itemInfo.value.project = Number(route.query.project)
|
||||||
|
if(route.query.contact) itemInfo.value.contact = Number(route.query.contact)
|
||||||
if(route.query.customer) itemInfo.value.customer = Number(route.query.customer)
|
if(route.query.customer) itemInfo.value.customer = Number(route.query.customer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setCustomerData = () => {
|
||||||
|
let customer = dataStore.getCustomerById(itemInfo.value.customer)
|
||||||
|
itemInfo.value.contact = null
|
||||||
|
if(customer) {
|
||||||
|
itemInfo.value.address.street = customer.infoData.street
|
||||||
|
itemInfo.value.address.zip = customer.infoData.zip
|
||||||
|
itemInfo.value.address.city = customer.infoData.city
|
||||||
|
itemInfo.value.address.special = customer.infoData.special
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const setContactPersonData = () => {
|
||||||
|
if(!itemInfo.value.contactPerson) itemInfo.value.contactPerson = user.value.id
|
||||||
|
|
||||||
|
let profile = dataStore.getProfileById(itemInfo.value.contactPerson)
|
||||||
|
|
||||||
|
itemInfo.value.contactPersonName = profile.fullName
|
||||||
|
itemInfo.value.contactTel = profile.mobileTel || profile.fixedTel || ""
|
||||||
|
itemInfo.value.contactEMail = profile.email
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const getRowAmount = (row) => {
|
const getRowAmount = (row) => {
|
||||||
@@ -122,11 +175,13 @@ const documentTotal = computed(() => {
|
|||||||
|
|
||||||
itemInfo.value.rows.forEach(row => {
|
itemInfo.value.rows.forEach(row => {
|
||||||
if(row.mode === 'free' || row.mode === 'normal'){
|
if(row.mode === 'free' || row.mode === 'normal'){
|
||||||
let rowPrice = Number(Number(row.quantity) * Number(row.price)).toFixed(2)
|
console.log(row)
|
||||||
totalNet += Number(rowPrice)
|
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2)
|
||||||
|
console.log(rowPrice)
|
||||||
|
totalNet = totalNet + Number(rowPrice)
|
||||||
|
|
||||||
if(row.taxPercent === 19) {
|
if(row.taxPercent === 19) {
|
||||||
total19 += Number(rowPrice * 0.19)
|
total19 = total19 + Number(rowPrice * 0.19)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -170,18 +225,21 @@ const getDocumentData = () => {
|
|||||||
} else {
|
} else {
|
||||||
return row
|
return row
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//Compile Start & EndText
|
||||||
|
const templateStartText = Handlebars.compile(itemInfo.value.startText);
|
||||||
|
const templateEndText = Handlebars.compile(itemInfo.value.endText);
|
||||||
|
console.log(templateStartText({vorname: contactData.firstName, nachname: contactData.lastName}))
|
||||||
|
console.log(templateEndText({zahlungsziel_in_tagen: 14}))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const returnData = {
|
const returnData = {
|
||||||
|
|
||||||
recipient: {
|
recipient: {
|
||||||
name: customerData.name,
|
name: customerData.name,
|
||||||
contact: `${contactData.firstName} ${contactData.lastName}`,
|
contact: contactData ? `${contactData.firstName} ${contactData.lastName}` : "",
|
||||||
street: customerData.infoData.street,
|
street: customerData.infoData.street,
|
||||||
special: "",
|
special: "",
|
||||||
city: customerData.infoData.city,
|
city: customerData.infoData.city,
|
||||||
@@ -190,17 +248,19 @@ const getDocumentData = () => {
|
|||||||
info: {
|
info: {
|
||||||
customerNumber: customerData.customerNumber,
|
customerNumber: customerData.customerNumber,
|
||||||
documentNumber: itemInfo.value.documentNumber,
|
documentNumber: itemInfo.value.documentNumber,
|
||||||
|
documentNumberTitle: itemInfo.value.documentNumberTitle,
|
||||||
documentDate: dayjs(itemInfo.value.documentDate, 'DD.MM.YYYY').format("DD.MM.YYYY"),
|
documentDate: dayjs(itemInfo.value.documentDate, 'DD.MM.YYYY').format("DD.MM.YYYY"),
|
||||||
deliveryDate: dayjs(itemInfo.value.deliveryDate, 'DD.MM.YYYY').format("DD.MM.YYYY"),
|
deliveryDate: dayjs(itemInfo.value.deliveryDate, 'DD.MM.YYYY').format("DD.MM.YYYY"),
|
||||||
contactPerson: userData.fullName ||"",
|
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||||
contactTel: userData.mobileTel ||"",
|
contactPerson: itemInfo.value.contactPersonName,
|
||||||
contactEMail: userData.email,
|
contactTel: itemInfo.value.contactTel,
|
||||||
project: dataStore.getProjectById(itemInfo.value.project).name
|
contactEMail: itemInfo.value.contactEMail,
|
||||||
|
project: dataStore.getProjectById(itemInfo.value.project) ? dataStore.getProjectById(itemInfo.value.project).name : null
|
||||||
},
|
},
|
||||||
title: itemInfo.value.title,
|
title: itemInfo.value.title,
|
||||||
description: itemInfo.value.description,
|
description: itemInfo.value.description,
|
||||||
endText: itemInfo.value.endText,
|
endText: templateEndText({zahlungsziel_in_tagen: 14}),
|
||||||
startText: itemInfo.value.startText,
|
startText: templateStartText({vorname: contactData.firstName, nachname: contactData.lastName}),
|
||||||
rows: rows,
|
rows: rows,
|
||||||
total: documentTotal.value
|
total: documentTotal.value
|
||||||
}
|
}
|
||||||
@@ -214,7 +274,16 @@ const getDocumentData = () => {
|
|||||||
const showDocument = ref(false)
|
const showDocument = ref(false)
|
||||||
const uri = ref("")
|
const uri = ref("")
|
||||||
const generateDocument = async () => {
|
const generateDocument = async () => {
|
||||||
uri.value = await useCreatePdf(getDocumentData())
|
const ownTenant = dataStore.ownTenant
|
||||||
|
const path = ownTenant.letterheadConfig[itemInfo.value.type]
|
||||||
|
console.log(path)
|
||||||
|
console.log(ownTenant)
|
||||||
|
|
||||||
|
const {data,error} = await supabase.storage.from("files").download(path)
|
||||||
|
console.log(data)
|
||||||
|
console.log(error)
|
||||||
|
|
||||||
|
uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer())
|
||||||
//alert(uri.value)
|
//alert(uri.value)
|
||||||
showDocument.value = true
|
showDocument.value = true
|
||||||
}
|
}
|
||||||
@@ -316,7 +385,6 @@ const closeDocument = async () => {
|
|||||||
//console.log(uri)
|
//console.log(uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -365,11 +433,19 @@ setupPage()
|
|||||||
searchable
|
searchable
|
||||||
searchable-placeholder="Suche..."
|
searchable-placeholder="Suche..."
|
||||||
v-model="itemInfo.customer"
|
v-model="itemInfo.customer"
|
||||||
|
@change="setCustomerData"
|
||||||
>
|
>
|
||||||
<template #label>
|
<UButton
|
||||||
|
:color="itemInfo.customer ? 'primary' : 'rose'"
|
||||||
|
variant="outline"
|
||||||
|
class="flex-1 justify-between">
|
||||||
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||||
</template>
|
|
||||||
|
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
||||||
|
</UButton>
|
||||||
|
<!-- <template #label>
|
||||||
|
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
|
||||||
|
</template>-->
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
@@ -384,6 +460,14 @@ setupPage()
|
|||||||
searchable-placeholder="Suche..."
|
searchable-placeholder="Suche..."
|
||||||
v-model="itemInfo.contact"
|
v-model="itemInfo.contact"
|
||||||
>
|
>
|
||||||
|
<UButton
|
||||||
|
:color="itemInfo.contact ? 'primary' : 'rose'"
|
||||||
|
variant="outline"
|
||||||
|
class="flex-1 justify-between">
|
||||||
|
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}
|
||||||
|
|
||||||
|
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
|
||||||
|
</UButton>
|
||||||
<template #label>
|
<template #label>
|
||||||
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}
|
{{dataStore.getContactById(itemInfo.contact) ? dataStore.getContactById(itemInfo.contact).fullName : "Kein Kontakt ausgewählt"}}
|
||||||
</template>
|
</template>
|
||||||
@@ -422,52 +506,78 @@ setupPage()
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex-auto">
|
<div class="flex-auto">
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Rechnungsnummer:"
|
:label="itemInfo.documentNumberTitle + ':'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="itemInfo.documentNumber"
|
v-model="itemInfo.documentNumber"
|
||||||
placeholder="Leer lassen für automatisch generierte Nummer"
|
placeholder="XXXX"
|
||||||
|
disabled
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Datum:"
|
label="Datum:"
|
||||||
>
|
>
|
||||||
<UInput
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
v-model="itemInfo.documentDate"
|
<UButton
|
||||||
|
icon="i-heroicons-calendar-days-20-solid"
|
||||||
|
:label="itemInfo.documentDate ? dayjs(itemInfo.documentDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||||
|
variant="outline"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<template #panel="{ close }">
|
||||||
|
<LazyDatePicker v-model="itemInfo.documentDate" @close="close" />
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Lieferdatum:"
|
class="mt-3"
|
||||||
>
|
>
|
||||||
<UInput
|
<USelectMenu
|
||||||
v-model="itemInfo.deliveryDate"
|
:options="['Lieferdatum'/*,'Lieferzeitraum'*/,'Leistungsdatum'/*,'Leistungszeitraum'*/,'Kein Lieferdatum anzeigen']"
|
||||||
|
v-model="itemInfo.deliveryDateType"
|
||||||
|
class="mb-2"
|
||||||
/>
|
/>
|
||||||
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-calendar-days-20-solid"
|
||||||
|
:label="itemInfo.deliveryDate ? dayjs(itemInfo.deliveryDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #panel="{ close }">
|
||||||
|
<LazyDatePicker v-model="itemInfo.deliveryDate" @close="close" />
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Ansprechpartner:"
|
label="Ansprechpartner:"
|
||||||
>
|
>
|
||||||
<UInput
|
<USelectMenu
|
||||||
|
:options="dataStore.profiles"
|
||||||
|
v-model="itemInfo.contactPerson"
|
||||||
|
option-attribute="fullName"
|
||||||
|
value-attribute="id"
|
||||||
|
@change="setContactPersonData"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Kontakt Telefon:"
|
label="Kontakt Telefon:"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
|
v-model="itemInfo.contactTel"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Kontakt E-Mail:"
|
label="Kontakt E-Mail:"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
|
v-model="itemInfo.contactEMail"
|
||||||
/>
|
|
||||||
</UFormGroup><UFormGroup
|
|
||||||
label="Kontakt E-Mail:"
|
|
||||||
>
|
|
||||||
<UInput
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
@@ -514,14 +624,35 @@ setupPage()
|
|||||||
class="my-3"
|
class="my-3"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Vorlage auswählen"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.getTextTemplatesByDocumentType(itemInfo.type)"
|
||||||
|
v-model="itemInfo.startText"
|
||||||
|
option-attribute="text"
|
||||||
|
value-attribute="text"
|
||||||
|
>
|
||||||
|
<template #option="{option}">
|
||||||
|
{{option.name}} - {{option.text}}
|
||||||
|
</template>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.texttemplates.find(i => i.text === itemInfo.startText) ? dataStore.texttemplates.find(i => i.text === itemInfo.startText).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Einleitung:"
|
label="Einleitung:"
|
||||||
>
|
>
|
||||||
<UTextarea
|
<UTextarea
|
||||||
v-model="itemInfo.startText"
|
v-model="itemInfo.startText"
|
||||||
|
:rows="6"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
|
||||||
<UDivider
|
<UDivider
|
||||||
class="my-3"
|
class="my-3"
|
||||||
/>
|
/>
|
||||||
@@ -673,7 +804,7 @@ setupPage()
|
|||||||
<td
|
<td
|
||||||
v-if="row.mode === 'free' || row.mode === 'normal'"
|
v-if="row.mode === 'free' || row.mode === 'normal'"
|
||||||
>
|
>
|
||||||
<div class="text-right font-bold">{{getRowAmount(row)}} €</div>
|
<p class="text-right font-bold whitespace-nowrap">{{getRowAmount(row)}} €</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<UButton
|
<UButton
|
||||||
@@ -880,11 +1011,30 @@ setupPage()
|
|||||||
class="my-3"
|
class="my-3"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Vorlage auswählen"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.getTextTemplatesByDocumentType(itemInfo.type)"
|
||||||
|
v-model="itemInfo.endText"
|
||||||
|
option-attribute="text"
|
||||||
|
value-attribute="text"
|
||||||
|
>
|
||||||
|
<template #option="{option}">
|
||||||
|
{{option.name}} - {{option.text}}
|
||||||
|
</template>
|
||||||
|
<template #label>
|
||||||
|
{{dataStore.texttemplates.find(i => i.text === itemInfo.endText) ? dataStore.texttemplates.find(i => i.text === itemInfo.endText).name : "Keine Vorlage ausgewählt oder Vorlage verändert"}}
|
||||||
|
</template>
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Nachbemerkung:"
|
label="Nachbemerkung:"
|
||||||
>
|
>
|
||||||
<UTextarea
|
<UTextarea
|
||||||
v-model="itemInfo.endText"
|
v-model="itemInfo.endText"
|
||||||
|
:rows="6"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,46 +75,43 @@ setupPage()
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<h1
|
||||||
<UCard v-if="currentItem && mode == 'show'" >
|
class="mb-3 truncate font-bold text-2xl"
|
||||||
<template #header>
|
v-if="currentItem"
|
||||||
<UBadge>
|
>Aufgabe: {{currentItem.name}}</h1>
|
||||||
{{currentItem.categorie}}
|
<UTabs
|
||||||
</UBadge>
|
:items="[{label: 'Informationen'},{label: 'Logbuch'}]"
|
||||||
|
v-if="currentItem && mode === 'show'"
|
||||||
{{currentItem.name}}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<InputGroup>
|
|
||||||
<UButton
|
|
||||||
v-if="currentItem.project"
|
|
||||||
@click="router.push(`/projects/show/${currentItem.project}`)"
|
|
||||||
class="mb-3"
|
|
||||||
>
|
>
|
||||||
Zum Projekt
|
<template #item="{item}">
|
||||||
</UButton>
|
<UCard class="mt-5">
|
||||||
</InputGroup>
|
<div v-if="item.label === 'Informationen'">
|
||||||
|
<Toolbar>
|
||||||
|
|
||||||
Beschreibung:<br>
|
|
||||||
{{currentItem.description}}<br>
|
|
||||||
Projekt: {{currentItem.project ? dataStore.getProjectById(currentItem.project).name : "Kein Projekt zugeordnet"}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<UButton
|
<UButton
|
||||||
v-if="mode == 'show' && currentItem.id"
|
v-if="mode === 'show' && currentItem.id"
|
||||||
@click="editItem"
|
@click="editItem"
|
||||||
>
|
>
|
||||||
Bearbeiten
|
Bearbeiten
|
||||||
</UButton>
|
</UButton>
|
||||||
</template>
|
<UButton
|
||||||
|
v-if="currentItem.project"
|
||||||
|
@click="router.push(`/projects/show/${currentItem.project}`)"
|
||||||
|
>
|
||||||
|
Zum Projekt
|
||||||
|
</UButton>
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
|
<div class="truncate">
|
||||||
|
<p>Kategorie: {{currentItem.categorie}}</p>
|
||||||
|
<p v-if="currentItem.project">Projekt: <nuxt-link :to="`/projects/show/${currentItem.project}`">{{dataStore.getProjectById(currentItem.project).name}}</nuxt-link></p>
|
||||||
|
<p>Beschreibung: {{currentItem.description}}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- TODO: Logbuch Tasks -->
|
||||||
</UCard>
|
</UCard>
|
||||||
|
</template>
|
||||||
|
</UTabs>
|
||||||
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
|
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
|
||||||
<template #header v-if="mode === 'edit'">
|
<template #header v-if="mode === 'edit'">
|
||||||
{{itemInfo.name}}
|
{{itemInfo.name}}
|
||||||
@@ -203,13 +200,13 @@ setupPage()
|
|||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="mode == 'edit'"
|
v-if="mode === 'edit'"
|
||||||
@click="dataStore.updateItem('tasks',itemInfo)"
|
@click="dataStore.updateItem('tasks',itemInfo)"
|
||||||
>
|
>
|
||||||
Speichern
|
Speichern
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
v-else-if="mode == 'create'"
|
v-else-if="mode === 'create'"
|
||||||
@click="dataStore.createNewItem('tasks',itemInfo)"
|
@click="dataStore.createNewItem('tasks',itemInfo)"
|
||||||
>
|
>
|
||||||
Erstellen
|
Erstellen
|
||||||
@@ -224,7 +221,6 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
14
spaces/pages/vendors/[mode]/[[id]].vue
vendored
14
spaces/pages/vendors/[mode]/[[id]].vue
vendored
@@ -55,7 +55,7 @@ setupPage()
|
|||||||
v-if="currentItem "
|
v-if="currentItem "
|
||||||
>Lieferant: {{currentItem.name}}</h1>
|
>Lieferant: {{currentItem.name}}</h1>
|
||||||
<UTabs
|
<UTabs
|
||||||
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Ansprechpartner'}]"
|
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Ansprechpartner'},{label: 'Dokumente'}]"
|
||||||
v-if="currentItem && mode == 'show'"
|
v-if="currentItem && mode == 'show'"
|
||||||
>
|
>
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
@@ -105,6 +105,18 @@ setupPage()
|
|||||||
</UTable>
|
</UTable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="item.label === 'Dokumente'">
|
||||||
|
<InputGroup>
|
||||||
|
<DocumentUpload
|
||||||
|
type="vendor"
|
||||||
|
:element-id="currentItem.id"
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
<DocumentList
|
||||||
|
:documents="dataStore.getDocumentsByVendorId(currentItem.id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
</UTabs>
|
</UTabs>
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
const workingtimes = ref([])
|
const workingtimes = ref([])
|
||||||
const phasesTemplates = ref([])
|
const phasesTemplates = ref([])
|
||||||
const emailAccounts = ref([])
|
const emailAccounts = ref([])
|
||||||
|
const texttemplates =ref([])
|
||||||
|
|
||||||
|
|
||||||
const rights = ref({
|
const rights = ref({
|
||||||
@@ -277,6 +278,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
await fetchWorkingTimes()
|
await fetchWorkingTimes()
|
||||||
await fetchPhasesTemplates()
|
await fetchPhasesTemplates()
|
||||||
await fetchEmailAccounts()
|
await fetchEmailAccounts()
|
||||||
|
await fetchTextTemplates()
|
||||||
loaded.value = true
|
loaded.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,6 +320,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
workingtimes.value = []
|
workingtimes.value = []
|
||||||
phasesTemplates.value = []
|
phasesTemplates.value = []
|
||||||
emailAccounts.value = []
|
emailAccounts.value = []
|
||||||
|
texttemplates.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasRight (right) {
|
function hasRight (right) {
|
||||||
@@ -574,6 +577,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
emailAccounts.value = (await supabase.from("emailAccounts").select().eq('tenant', currentTenant.value)).data
|
emailAccounts.value = (await supabase.from("emailAccounts").select().eq('tenant', currentTenant.value)).data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchTextTemplates() {
|
||||||
|
texttemplates.value = (await supabase.from("textTemplates").select().eq('tenant', currentTenant.value)).data
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchDocuments () {
|
async function fetchDocuments () {
|
||||||
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
|
let tempDocuments = (await supabase.from("documents").select().eq('tenant', currentTenant.value)).data
|
||||||
|
|
||||||
@@ -680,6 +687,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
return documents.value.filter(item => item.product === itemId && !item.tags.includes("Archiviert"))
|
return documents.value.filter(item => item.product === itemId && !item.tags.includes("Archiviert"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getDocumentsByVendorId = computed(() => (itemId) => {
|
||||||
|
return documents.value.filter(item => item.vendor === itemId && !item.tags.includes("Archiviert"))
|
||||||
|
})
|
||||||
|
|
||||||
const getEventsByProjectId = computed(() => (projectId) => {
|
const getEventsByProjectId = computed(() => (projectId) => {
|
||||||
return events.value.filter(item => item.project === projectId)
|
return events.value.filter(item => item.project === projectId)
|
||||||
})
|
})
|
||||||
@@ -712,6 +723,10 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
return messages.value.filter(i => i.destination === chatId)
|
return messages.value.filter(i => i.destination === chatId)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getTextTemplatesByDocumentType = computed(() => (documentType) => {
|
||||||
|
return texttemplates.value.filter(i => i.documentType === documentType)
|
||||||
|
})
|
||||||
|
|
||||||
const getStockByProductId = computed(() => (productId) => {
|
const getStockByProductId = computed(() => (productId) => {
|
||||||
let productMovements = movements.value.filter(movement => movement.productId === productId)
|
let productMovements = movements.value.filter(movement => movement.productId === productId)
|
||||||
|
|
||||||
@@ -1006,6 +1021,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
workingtimes,
|
workingtimes,
|
||||||
phasesTemplates,
|
phasesTemplates,
|
||||||
emailAccounts,
|
emailAccounts,
|
||||||
|
texttemplates,
|
||||||
documentTypesForCreation,
|
documentTypesForCreation,
|
||||||
|
|
||||||
//Functions
|
//Functions
|
||||||
@@ -1057,6 +1073,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
getDocumentsByContractId,
|
getDocumentsByContractId,
|
||||||
getDocumentsByVehicleId,
|
getDocumentsByVehicleId,
|
||||||
getDocumentsByProductId,
|
getDocumentsByProductId,
|
||||||
|
getDocumentsByVendorId,
|
||||||
getEventsByProjectId,
|
getEventsByProjectId,
|
||||||
getTimesByProjectId,
|
getTimesByProjectId,
|
||||||
getTasksByProjectId,
|
getTasksByProjectId,
|
||||||
@@ -1064,6 +1081,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
getProjectsByPlantId,
|
getProjectsByPlantId,
|
||||||
getMovementsBySpaceId,
|
getMovementsBySpaceId,
|
||||||
getMessagesByChatId,
|
getMessagesByChatId,
|
||||||
|
getTextTemplatesByDocumentType,
|
||||||
getStockByProductId,
|
getStockByProductId,
|
||||||
getIncomingInvoicesByVehicleId,
|
getIncomingInvoicesByVehicleId,
|
||||||
getEventTypes,
|
getEventTypes,
|
||||||
|
|||||||
Reference in New Issue
Block a user