Added Salutation and Title to Customer and Contact

Added Vars to GenerateContext for Salutation and title
This commit is contained in:
2025-05-18 19:09:32 +02:00
parent a0ffdce1bb
commit 55038d2bcb
2 changed files with 74 additions and 8 deletions

View File

@@ -903,6 +903,8 @@ const getDocumentData = () => {
const generateContext = (itemInfo, contactData) => {
return {
lohnkosten: documentReport.value.totalHoursSellingPrice ? useCurrency(documentReport.value.totalHoursSellingPrice) : null,
anrede:(contactData && contactData.salutation) || (customerData && customerData.salutation),
titel:(contactData && contactData.title) || (customerData && customerData.title),
vorname:(contactData && contactData.firstName) || (customerData && customerData.firstname),
nachname: (contactData && contactData.lastName) || (customerData && customerData.lastname),
kundenname: customerData && customerData.name,

View File

@@ -184,16 +184,68 @@ export const useDataStore = defineStore('data', () => {
disabledFunction: function (item) {
return !item.isCompany
},
},{
key: "salutation",
label: "Anrede",
inputType: "text",
inputChangeFunction: function (row) {
row.name = ""
if(row.salutation) {
row.name += `${row.salutation}`
}
if(row.title) {
row.name += ` ${row.title}`
}
if(row.firstname) {
row.name += ` ${row.firstname}`
}
if(row.lastname) {
row.name += ` ${row.lastname}`
}
},
disabledFunction: function (item) {
return item.isCompany
},
},{
key: "title",
label: "Titel",
inputType: "text",
inputChangeFunction: function (row) {
row.name = ""
if(row.salutation) {
row.name += `${row.salutation}`
}
if(row.title) {
row.name += ` ${row.title}`
}
if(row.firstname) {
row.name += ` ${row.firstname}`
}
if(row.lastname) {
row.name += ` ${row.lastname}`
}
},
disabledFunction: function (item) {
return item.isCompany
},
},{
key: "firstname",
label: "Vorname",//TODO: Add Conditional Rendering to Datatypes
title: true,
inputType: "text",
inputChangeFunction: function (row) {
if(row.firstname && row.lastname) {
row.name = `${row.firstname} ${row.lastname}`
} else {
row.name = row.firstname
row.name = ""
if(row.salutation) {
row.name += `${row.salutation}`
}
if(row.title) {
row.name += ` ${row.title}`
}
if(row.firstname) {
row.name += ` ${row.firstname}`
}
if(row.lastname) {
row.name += ` ${row.lastname}`
}
},
disabledFunction: function (item) {
@@ -205,10 +257,18 @@ export const useDataStore = defineStore('data', () => {
title: true,
inputType: "text",
inputChangeFunction: function (row) {
if(row.firstname && row.lastname) {
row.name = `${row.firstname} ${row.lastname}`
} else {
row.name = row.lastname
row.name = ""
if(row.salutation) {
row.name += `${row.salutation}`
}
if(row.title) {
row.name += ` ${row.title}`
}
if(row.firstname) {
row.name += ` ${row.firstname}`
}
if(row.lastname) {
row.name += ` ${row.lastname}`
}
},
disabledFunction: function (item) {
@@ -341,6 +401,10 @@ export const useDataStore = defineStore('data', () => {
key: "salutation",
label: "Anrede",
inputType: "text",
},{
key: "title",
label: "Titel",
inputType: "text",
},{
key: "firstName",
label: "Vorname",