Many Changes

This commit is contained in:
2024-02-18 19:51:00 +01:00
parent 1a0b7288df
commit fa0eb73363
11 changed files with 720 additions and 322 deletions

View File

@@ -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>

View File

@@ -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,40 +124,124 @@ export const useCreatePdf = async (invoiceData) => {
opacity: 1, opacity: 1,
maxWidth: 240 maxWidth: 240
}) })
pages[pageCounter - 1].drawText(invoiceData.recipient.contact, {
...getCoordinatesForPDFLib(21,60, page1), if(invoiceData.recipient.contact && !invoiceData.recipient.special) {
size:10, pages[pageCounter - 1].drawText(invoiceData.recipient.contact, {
color:rgb(0,0,0), ...getCoordinatesForPDFLib(21,60, page1),
lineHeight:10, size:10,
opacity: 1, color:rgb(0,0,0),
maxWidth: 240 lineHeight:10,
}) opacity: 1,
pages[pageCounter - 1].drawText(invoiceData.recipient.special, { maxWidth: 240
...getCoordinatesForPDFLib(21,65, page1), })
size:10, pages[pageCounter - 1].drawText(invoiceData.recipient.street, {
color:rgb(0,0,0), ...getCoordinatesForPDFLib(21,65, page1),
lineHeight:10, size:10,
opacity: 1, color:rgb(0,0,0),
maxWidth: 240 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 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,15 +312,7 @@ 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,
color:rgb(0,0,0),
lineHeight:10,
opacity: 1,
maxWidth: 240
})
pages[pageCounter - 1].drawText("Lieferdatum", {
...getCoordinatesForPDFLib(126,70, page1),
size:10, size:10,
color:rgb(0,0,0), color:rgb(0,0,0),
lineHeight:10, lineHeight:10,
@@ -262,15 +320,28 @@ export const useCreatePdf = async (invoiceData) => {
maxWidth: 240 maxWidth: 240
}) })
pages[pageCounter - 1].drawText(invoiceData.info.deliveryDate, { if(invoiceData.info.deliveryDateType !== "Kein Lieferdatum anzeigen") {
y: getCoordinatesForPDFLib(126,70, page1).y, pages[pageCounter - 1].drawText(invoiceData.info.deliveryDateType, {
x: getCoordinatesForPDFLib(126,70,page1).x + 210 - font.widthOfTextAtSize(invoiceData.info.deliveryDate,10), ...getCoordinatesForPDFLib(126,70, page1),
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(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", { pages[pageCounter - 1].drawText("Ansprechpartner", {
...getCoordinatesForPDFLib(126,75, page1), ...getCoordinatesForPDFLib(126,75, page1),
@@ -291,43 +362,86 @@ export const useCreatePdf = async (invoiceData) => {
maxWidth: 240 maxWidth: 240
}) })
pages[pageCounter - 1].drawText("Telefon", { if(invoiceData.info.contactTel && invoiceData.info.contactEMail) {
...getCoordinatesForPDFLib(126,80, page1), pages[pageCounter - 1].drawText("Telefon", {
size:10, ...getCoordinatesForPDFLib(126,80, page1),
color:rgb(0,0,0), size:10,
lineHeight:10, color:rgb(0,0,0),
opacity: 1, lineHeight:10,
maxWidth: 240 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:", { /*pages[pageCounter - 1].drawText("Projekt:", {
...getCoordinatesForPDFLib(126,90, page1), ...getCoordinatesForPDFLib(126,90, page1),
size:10, size:10,
@@ -382,14 +496,17 @@ export const useCreatePdf = async (invoiceData) => {
opacity: 1 opacity: 1
})*/ })*/
pages[pageCounter - 1].drawText(invoiceData.description, { if(invoiceData.description) {
...getCoordinatesForPDFLib(20,112, page1), pages[pageCounter - 1].drawText(invoiceData.description, {
size:13, ...getCoordinatesForPDFLib(20,112, page1),
color:rgb(0,0,0), size:13,
lineHeight:15, color:rgb(0,0,0),
opacity: 1, lineHeight:15,
maxWidth: 500 opacity: 1,
}) maxWidth: 500
})
}
pages[pageCounter - 1].drawText(invoiceData.startText,{ pages[pageCounter - 1].drawText(invoiceData.startText,{
...getCoordinatesForPDFLib(20,119, page1), ...getCoordinatesForPDFLib(20,119, page1),

View File

@@ -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>

View File

@@ -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",

View File

@@ -10,7 +10,13 @@
placeholder="Suche..." placeholder="Suche..."
/> />
</InputGroup>--> </InputGroup>-->
<Toolbar>
<UButton
@click="router.push('/banking/newAccount')"
>
+ Konto
</UButton>
</Toolbar>
<UTable <UTable

View 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>

View File

@@ -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

View File

@@ -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>

View File

@@ -75,156 +75,152 @@ 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'"
>
<template #item="{item}">
<UCard class="mt-5">
<div v-if="item.label === 'Informationen'">
<Toolbar>
<UButton
v-if="mode === 'show' && currentItem.id"
@click="editItem"
>
Bearbeiten
</UButton>
<UButton
v-if="currentItem.project"
@click="router.push(`/projects/show/${currentItem.project}`)"
>
Zum Projekt
</UButton>
</Toolbar>
{{currentItem.name}} <div class="truncate">
</template> <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>
<InputGroup> </div>
<UButton <!-- TODO: Logbuch Tasks -->
v-if="currentItem.project" </UCard>
@click="router.push(`/projects/show/${currentItem.project}`)" </template>
class="mb-3" </UTabs>
> <UCard v-else-if="mode === 'edit' || mode === 'create'" >
Zum Projekt <template #header v-if="mode === 'edit'">
</UButton> {{itemInfo.name}}
</InputGroup> </template>
<UFormGroup
label="Name:"
>
<UInput
v-model="itemInfo.name"
/>
</UFormGroup>
Beschreibung:<br> <UFormGroup
{{currentItem.description}}<br> label="Kategorie:"
Projekt: {{currentItem.project ? dataStore.getProjectById(currentItem.project).name : "Kein Projekt zugeordnet"}} >
<USelectMenu
v-model="itemInfo.categorie"
:options="categories"
/>
</UFormGroup>
<UFormGroup
label="Benutzer:"
>
<template #footer> <USelectMenu
<UButton v-model="itemInfo.user"
v-if="mode == 'show' && currentItem.id" :options="dataStore.profiles"
@click="editItem" option-attribute="fullName"
> value-attribute="id"
Bearbeiten searchable-placeholder="Suche..."
</UButton> searchable
</template> :search-attributes="['fullName']"
</UCard>
<UCard v-else-if="mode === 'edit' || mode === 'create'" >
<template #header v-if="mode === 'edit'">
{{itemInfo.name}}
</template>
<UFormGroup
label="Name:"
> >
<UInput <template #label>
v-model="itemInfo.name" {{dataStore.getProfileById(itemInfo.user) ? dataStore.getProfileById(itemInfo.user).fullName : "Kein Benutzer ausgewählt"}}
/> </template>
</UFormGroup> </USelectMenu>
</UFormGroup>
<UFormGroup <UFormGroup
label="Kategorie:" label="Projekt:"
>
<USelectMenu
v-model="itemInfo.project"
:options="dataStore.projects"
option-attribute="name"
value-attribute="id"
searchable-placeholder="Suche..."
searchable
:search-attributes="['name']"
> >
<USelectMenu <template #label>
v-model="itemInfo.categorie" {{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
:options="categories" </template>
/> </USelectMenu>
</UFormGroup> </UFormGroup>
<UFormGroup
<UFormGroup label="Objekt:"
label="Benutzer:" >
<USelectMenu
v-model="itemInfo.plant"
:options="dataStore.plants"
option-attribute="name"
value-attribute="id"
searchable-placeholder="Suche..."
searchable
:search-attributes="['name']"
> >
<USelectMenu <template #label>
v-model="itemInfo.user" {{dataStore.getPlantById(itemInfo.plant) ? dataStore.getPlantById(itemInfo.plant).name : "Kein Objekt ausgewählt"}}
:options="dataStore.profiles" </template>
option-attribute="fullName" </USelectMenu>
value-attribute="id" </UFormGroup>
searchable-placeholder="Suche..."
searchable
:search-attributes="['fullName']"
>
<template #label> <UFormGroup
{{dataStore.getProfileById(itemInfo.user) ? dataStore.getProfileById(itemInfo.user).fullName : "Kein Benutzer ausgewählt"}} label="Beschreibung:"
</template> >
</USelectMenu> <UTextarea
</UFormGroup> v-model="itemInfo.description"
<UFormGroup />
label="Projekt:" </UFormGroup>
<template #footer>
<UButton
v-if="mode === 'edit'"
@click="dataStore.updateItem('tasks',itemInfo)"
> >
<USelectMenu Speichern
v-model="itemInfo.project" </UButton>
:options="dataStore.projects" <UButton
option-attribute="name" v-else-if="mode === 'create'"
value-attribute="id" @click="dataStore.createNewItem('tasks',itemInfo)"
searchable-placeholder="Suche..."
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Objekt:"
> >
<USelectMenu Erstellen
v-model="itemInfo.plant" </UButton>
:options="dataStore.plants" <UButton
option-attribute="name" @click="cancelEditorCreate"
value-attribute="id" color="red"
searchable-placeholder="Suche..." class="ml-2"
searchable
:search-attributes="['name']"
>
<template #label>
{{dataStore.getPlantById(itemInfo.plant) ? dataStore.getPlantById(itemInfo.plant).name : "Kein Objekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Beschreibung:"
> >
<UTextarea Abbrechen
v-model="itemInfo.description" </UButton>
/> </template>
</UFormGroup>
</UCard>
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('tasks',itemInfo)"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('tasks',itemInfo)"
>
Erstellen
</UButton>
<UButton
@click="cancelEditorCreate"
color="red"
class="ml-2"
>
Abbrechen
</UButton>
</template>
</UCard>
</div>
</template> </template>
<style scoped> <style scoped>

View File

@@ -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>

View File

@@ -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,