This commit is contained in:
2024-10-08 13:57:23 +02:00
parent 06badd590c
commit 7fb9744847
3 changed files with 75 additions and 15 deletions

View File

@@ -143,6 +143,11 @@ export const useDataStore = defineStore('data', () => {
labelSingle: "Artikelkategorie",
redirect: true
},
servicecategories: {
label: "Leistungskategorie",
labelSingle: "Leistungskategorien",
redirect: true
},
trackingtrips: {
label: "Fahrten",
labelSingle: "Fahrt",
@@ -157,6 +162,10 @@ export const useDataStore = defineStore('data', () => {
labelSingle: "Rechnung",
},
serialInvoices: {
label: "Serienrechnungen",
labelSingle: "Serienrechnung",
},
advanceInvoices: {
label: "Abschlagsrechnungen",
labelSingle: "Abschlagsrechnung"
@@ -234,7 +243,7 @@ export const useDataStore = defineStore('data', () => {
const emailAccounts = ref([])
const texttemplates =ref([])
const services =ref([])
const serviceCategories =ref([])
const servicecategories =ref([])
const resources =ref([])
@@ -442,7 +451,7 @@ export const useDataStore = defineStore('data', () => {
emailAccounts.value = []
texttemplates.value = []
services.value = []
serviceCategories.value = []
servicecategories.value = []
resources.value = []
}
@@ -646,11 +655,11 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "customer") {
name = "Kunde"
if(prop.data.o) oldVal = customers.value.find(i => i.id === prop.data.o).name
if(prop.data.o) newVal = customers.value.find(i => i.id === prop.data.n).name
if(prop.data.n) newVal = customers.value.find(i => i.id === prop.data.n).name
} else if(key === "vendor") {
name = "Lieferant"
if(prop.data.o) oldVal = vendors.value.find(i => i.id === prop.data.o).name
if(prop.data.o) newVal = vendors.value.find(i => i.id === prop.data.n).name
if(prop.data.n) newVal = vendors.value.find(i => i.id === prop.data.n).name
} else if(key === "description") {
name = "Beschreibung"
@@ -659,11 +668,11 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "profile") {
name = "Mitarbeiter"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
if(prop.data.o) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
} else if(key === "plant") {
name = "Objekt"
if(prop.data.o) oldVal = plants.value.find(i => i.id === prop.data.o).name
if(prop.data.o) newVal = plants.value.find(i => i.id === prop.data.n).name
if(prop.data.n) newVal = plants.value.find(i => i.id === prop.data.n).name
} else if(key === "annualPaidLeaveDays") {
name = "Urlaubstage"
} else if(key === "employeeNumber") {
@@ -677,7 +686,16 @@ export const useDataStore = defineStore('data', () => {
} else if(key === "driver") {
name = "Fahrer"
if(prop.data.o) oldVal = profiles.value.find(i => i.id === prop.data.o).fullName
if(prop.data.o) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
if(prop.data.n) newVal = profiles.value.find(i => i.id === prop.data.n).fullName
} else if(key === "fixed") {
name = "Festgeschrieben"
if(newVal === true){
oldVal = "Nein"
newVal = "Ja"
} else if(newVal === false) {
oldVal = "Ja"
newVal = "Nein"
}
}
@@ -798,7 +816,7 @@ export const useDataStore = defineStore('data', () => {
}
} else if(dataType === "createddocuments") {
} else if(dataType === "createddocuments" && data.type !== "serialInvoices") {
console.log(data.type)
let type = ""
@@ -1074,7 +1092,7 @@ export const useDataStore = defineStore('data', () => {
}
async function fetchServiceCategories() {
serviceCategories.value = (await supabase.from("serviceCategories").select().eq('tenant', currentTenant.value)).data
servicecategories.value = (await supabase.from("servicecategories").select().eq('tenant', currentTenant.value)).data
}
async function fetchResources() {
@@ -1224,7 +1242,18 @@ export const useDataStore = defineStore('data', () => {
})
const getTextTemplatesByDocumentType = computed(() => (documentType) => {
return texttemplates.value.filter(i => i.documentType === documentType)
console.log(documentType)
let type = ""
if(documentType === "serialInvoices") {
type = "invoices"
} else {
type = documentType
}
console.log(type)
return texttemplates.value.filter(i => i.documentType === type)
})
const getCreatedDocumentsByProject = computed(() => (project) => {
@@ -1652,7 +1681,7 @@ export const useDataStore = defineStore('data', () => {
emailAccounts,
texttemplates,
services,
serviceCategories,
servicecategories,
documentTypesForCreation,
//Functions