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) => { const generateContext = (itemInfo, contactData) => {
return { return {
lohnkosten: documentReport.value.totalHoursSellingPrice ? useCurrency(documentReport.value.totalHoursSellingPrice) : null, 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), vorname:(contactData && contactData.firstName) || (customerData && customerData.firstname),
nachname: (contactData && contactData.lastName) || (customerData && customerData.lastname), nachname: (contactData && contactData.lastName) || (customerData && customerData.lastname),
kundenname: customerData && customerData.name, kundenname: customerData && customerData.name,

View File

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