From 4eba5571214db62bb345e9c05903e32cd7088a7c Mon Sep 17 00:00:00 2001 From: Maximilian Stubhan Date: Tue, 11 Aug 2026 21:33:28 +0200 Subject: [PATCH] Show every field the edit dialog can change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The master-data tab summarised where the edit dialog itemises. Titles were collapsed into one line, street, postcode and town were fused into a single "Adresse", and first and last name appeared only in the page header — so checking a value meant opening the change dialog to see it, which puts you inside a form when you only wanted to look. The tab now mirrors the dialog's "Person" section field for field and in the same order, personnel number included. Two deliberate departures from a literal mirror: - Standort sits at the end rather than between Adresse and Land. It is the workplace, not part of the person's address, and next to the postal fields it reads as though it were. - The emergency contact keeps the separate block it got earlier today, with its phone number as a tel: link. In an emergency someone reaches for it in a hurry; it should not be one cell among fourteen. Co-Authored-By: Claude Opus 5 --- components/employees/tabs/StammdatenTab.tsx | 88 +++++++++++++++------ 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/components/employees/tabs/StammdatenTab.tsx b/components/employees/tabs/StammdatenTab.tsx index 663a5ab..4389cf4 100644 --- a/components/employees/tabs/StammdatenTab.tsx +++ b/components/employees/tabs/StammdatenTab.tsx @@ -6,42 +6,41 @@ type EmployeeRow = Database["public"]["Tables"]["employees"]["Row"]; type Location = Database["public"]["Tables"]["locations"]["Row"]; type Dependent = Database["public"]["Tables"]["employee_dependents"]["Row"]; -function formatAddress(employee: EmployeeRow): string { - const cityLine = [employee.postal_code, employee.city].filter(Boolean).join(" "); - return [employee.address, cityLine].filter(Boolean).join(", ") || "–"; -} - export function StammdatenTab({ employee, location, dependents }: { employee: EmployeeRow; location?: Location; dependents: Dependent[] }) { // Defensive against a DB that hasn't received the title_prefix/title_suffix // migration yet — select("*") simply omits unknown columns, so these can // be undefined rather than the empty array the column default implies. - const titles = [...(employee.title_prefix ?? []), ...(employee.title_suffix ?? [])]; + const prefixe = employee.title_prefix ?? []; + const suffixe = employee.title_suffix ?? []; + + // Feld für Feld dieselbe Liste wie im Abschnitt „Person" von „Daten + // ändern", in derselben Reihenfolge. + // + // Vorher fasste die Anzeige zusammen: Titel in einer Zeile, Adresse mit + // Postleitzahl und Ort verschmolzen, Vor- und Nachname gar nicht — die + // standen nur in der Kopfzeile. Wer eine Angabe prüfen wollte, musste den + // Änderungsdialog öffnen, um sie überhaupt zu sehen, und stand dann schon + // in einem Formular. Was sich ändern lässt, soll sich auch ansehen lassen. const rows: [string, string][] = [ - ["Titel", titles.length > 0 ? titles.join(", ") : "–"], + ["Personalnummer", String(employee.personnel_number)], + ["Vorname", employee.first_name], + ["Nachname", employee.last_name], + ["Titel (vorangestellt)", prefixe.length > 0 ? prefixe.join(", ") : "–"], + ["Titel (nachgestellt)", suffixe.length > 0 ? suffixe.join(", ") : "–"], + ["Geschlecht", employee.gender === "m" ? "männlich" : "weiblich"], ["Geburtsdatum", `${fmtDate(employee.birth_date)} (${fmtAge(employee.birth_date)} Jahre)`], ["SV-Nummer", employee.sv_nummer ?? "–"], ["Staatsbürgerschaft", employee.nationality], + ["Adresse", employee.address ?? "–"], + ["Postleitzahl", employee.postal_code ?? "–"], + ["Ort", employee.city ?? "–"], + ["Land", employee.address_country ?? "–"], ["E-Mail", employee.email], ["Telefon", employee.phone ?? "–"], + // Der Standort ist keine Angabe zur Person, sondern die Betriebsstätte — + // er steht deshalb am Ende und nicht zwischen Adresse und Land, wo man + // ihn für den Wohnort halten könnte. ["Standort", location ? `${location.name} (${location.country})` : "–"], - ["Adresse", formatAddress(employee)], - ["Land", employee.address_country ?? "–"], - ["Geschlecht", employee.gender === "m" ? "männlich" : "weiblich"], - // Der Notfallkontakt steht als eigene Zeile und nicht in einer Zeile mit - // dem Telefon der Person: im Ernstfall greift jemand danach, und dann - // darf keine Verwechslung möglich sein. - [ - "Notfallkontakt", - employee.emergency_contact_name - ? [ - employee.emergency_contact_name, - employee.emergency_contact_relation ? `(${employee.emergency_contact_relation})` : "", - employee.emergency_contact_phone, - ] - .filter(Boolean) - .join(" ") - : "–", - ], ]; return (
@@ -53,6 +52,45 @@ export function StammdatenTab({ employee, location, dependents }: { employee: Em
))} + + {/* Eigener Abschnitt statt einer Zelle im Raster. + Der Notfallkontakt sind drei Angaben — Name, Verhältnis, Nummer —, + und in eine Zelle gepresst standen sie als eine Zeile Fliesstext da. + Im Ernstfall greift jemand in Eile danach; dann muss die Nummer + sofort zu finden sein und nicht zwischen Adresse und Geschlecht. */} +
+

Notfallkontakt

+ {employee.emergency_contact_name ? ( +
+
+
Name
+
{employee.emergency_contact_name}
+
+
+
Telefon
+
+ {employee.emergency_contact_phone ? ( + + {employee.emergency_contact_phone} + + ) : ( + "–" + )} +
+
+
+
Verhältnis
+
{employee.emergency_contact_relation || "–"}
+
+
+ ) : ( +

Kein Notfallkontakt hinterlegt.

+ )} +
+ );