From 55038d2bcbaf3a8cb205aeac614cf2b2b2336fc9 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 18 May 2025 19:09:32 +0200 Subject: [PATCH] Added Salutation and Title to Customer and Contact Added Vars to GenerateContext for Salutation and title --- pages/createDocument/edit/[[id]].vue | 2 + stores/data.js | 80 +++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 9d876b2..59ac87d 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -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, diff --git a/stores/data.js b/stores/data.js index b91747c..82deea1 100644 --- a/stores/data.js +++ b/stores/data.js @@ -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",