diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 89de0d66..5b74149c 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -166,6 +166,9 @@ model Customer { // Geburtstagsmodal: Jahr in dem dem Kunden der Geburtstagsgruß gezeigt wurde (vermeidet mehrfaches Anzeigen) lastBirthdayGreetingYear Int? + // Anrede-Verhältnis: true = Du (informell), false = Sie (formell, Default) + useInformalAddress Boolean @default(false) + user User? addresses Address[] bankCards BankCard[] diff --git a/backend/src/services/birthday.service.ts b/backend/src/services/birthday.service.ts index 3430475c..dd3d7b16 100644 --- a/backend/src/services/birthday.service.ts +++ b/backend/src/services/birthday.service.ts @@ -140,6 +140,9 @@ export interface MyBirthdayCheck { isToday: boolean; daysAgo: number; // 0 = heute, >0 = x Tage her firstName: string; + lastName: string; + salutation: string | null; + useInformalAddress: boolean; age: number; } @@ -153,6 +156,9 @@ export async function checkMyBirthday(customerId: number): Promise 7) { - return { show: false, isToday: false, daysAgo: 0, firstName: customer.firstName, age: 0 }; + return { show: false, isToday: false, daysAgo: 0, ...baseInfo, age: 0 }; } const age = calculateAge(customer.birthDate, today); @@ -186,7 +199,7 @@ export async function checkMyBirthday(customerId: number): Promise ackMutation.mutate(); + // Anrede abhängig vom Du/Sie-Verhältnis zusammenstellen + const greetingName = info.useInformalAddress + ? info.firstName + : [info.salutation, info.lastName].filter(Boolean).join(' ') || info.firstName; + const greetingPronoun = info.useInformalAddress ? 'dir' : 'Ihnen'; + const greetingPossessive = info.useInformalAddress ? 'deinem' : 'Ihrem'; + const greetingYour = info.useInformalAddress ? 'Dein' : 'Ihr'; + const hadBirthday = info.useInformalAddress ? 'hattest' : 'hatten'; + const becameOld = info.useInformalAddress ? 'bist' : 'sind'; + return (
@@ -50,26 +60,26 @@ export default function BirthdayModal() { {info.isToday ? ( <>

- Herzlichen Glückwunsch, {info.firstName}! + Herzlichen Glückwunsch, {greetingName}!

- Alles Gute zu Ihrem {info.age}. Geburtstag! + Alles Gute zu {greetingPossessive} {info.age}. Geburtstag!

- Wir wünschen Ihnen einen wunderschönen Tag und alles Gute für das neue Lebensjahr. 🌟 + Wir wünschen {greetingPronoun} einen wunderschönen Tag und alles Gute für {greetingYour.toLowerCase()} neues Lebensjahr. 🌟

) : ( <>

- Nachträglich alles Gute, {info.firstName}! + Nachträglich alles Gute, {greetingName}!

- Sie hatten vor {info.daysAgo} Tag{info.daysAgo === 1 ? '' : 'en'} Geburtstag - {info.age > 0 && ` und sind ${info.age} Jahre alt geworden`}. + {greetingYour === 'Ihr' ? 'Sie' : 'Du'} {hadBirthday} vor {info.daysAgo} Tag{info.daysAgo === 1 ? '' : 'en'} Geburtstag + {info.age > 0 && ` und ${becameOld} ${info.age} Jahre alt geworden`}.

- Wir wünschen Ihnen alles Gute nachträglich und eine tolle Zeit im neuen Lebensjahr. 🌟 + Wir wünschen {greetingPronoun} alles Gute nachträglich und eine tolle Zeit im neuen Lebensjahr. 🌟

)} diff --git a/frontend/src/pages/customers/CustomerDetail.tsx b/frontend/src/pages/customers/CustomerDetail.tsx index 5ed554e8..95de82a5 100644 --- a/frontend/src/pages/customers/CustomerDetail.tsx +++ b/frontend/src/pages/customers/CustomerDetail.tsx @@ -267,6 +267,14 @@ export default function CustomerDetail({ portalCustomerId }: { portalCustomerId?
)} +
+
Anrede per
+
+ + {c.useInformalAddress ? 'Du (informell)' : 'Sie (formell)'} + +
+
Vorname
diff --git a/frontend/src/pages/customers/CustomerForm.tsx b/frontend/src/pages/customers/CustomerForm.tsx index 49843750..f0d15cf7 100644 --- a/frontend/src/pages/customers/CustomerForm.tsx +++ b/frontend/src/pages/customers/CustomerForm.tsx @@ -135,6 +135,17 @@ export default function CustomerForm() { ]} /> +