From 4f2dc3351a65a8412de748215daa27f0449d2aeb Mon Sep 17 00:00:00 2001 From: Andrei Laas Date: Tue, 3 Nov 2026 09:38:46 +0100 Subject: [PATCH] Checkliste drucken: Grund mit Art der Abwesenheit oder Beendigungsart Auf dem Blatt steht als "Grund" der Anlass mit dem, was ihn naeher bestimmt: "Langzeitabwesenheit - Wochenhilfe (Mutterschutz)", "Austritt - Kuendigung AN". Ohne ihn liesse der Ausdruck nicht erkennen, worum es geht. Geprueft: lint, tsc, 1029 Tests, Waechter. --- components/employees/PrintChecklist.tsx | 2 +- lib/checklist-print-data.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/employees/PrintChecklist.tsx b/components/employees/PrintChecklist.tsx index 57d3b6f..7e3035d 100644 --- a/components/employees/PrintChecklist.tsx +++ b/components/employees/PrintChecklist.tsx @@ -128,7 +128,7 @@ export function PrintChecklist({ {kopf.anlass && ( <> -
Anlass
+
Grund
{kopf.anlass}
Angelegt am
{fmtDate(kopf.angelegt_am)}
diff --git a/lib/checklist-print-data.ts b/lib/checklist-print-data.ts index 9111400..c449f57 100644 --- a/lib/checklist-print-data.ts +++ b/lib/checklist-print-data.ts @@ -31,6 +31,20 @@ export type ChecklistDruckDaten = { staende: AufgabenStand[]; }; +/** + * Der Anlass mit seinem Grund: „Langzeitabwesenheit – Wochenhilfe + * (Mutterschutz)", „Austritt – Kündigung AN". Wer das Blatt in der Hand hat, + * sieht so, worum es geht, ohne die Akte zu öffnen. + */ +export function anlassMitGrund( + anlass: string | null, + person: { absence_type: string | null; exit_reason: string | null } +): string | null { + if (!anlass) return null; + const grund = anlass === "Langzeitabwesenheit" ? person.absence_type : anlass === "Austritt" ? person.exit_reason : null; + return grund ? `${anlass} – ${grund}` : anlass; +} + export async function loadChecklistPrint( tx: Tx, employeeId: string, @@ -44,7 +58,7 @@ export async function loadChecklistPrint( jsonObjectFrom( eb .selectFrom("employees") - .select(["personnel_number", "first_name", "last_name", "entry_date", "exit_date", "job_title"]) + .select(["personnel_number", "first_name", "last_name", "entry_date", "exit_date", "job_title", "absence_type", "exit_reason"]) .where("id", "=", employeeId) ).as("person"), jsonArrayFrom(besetzungenAbfrage(eb, [employeeId])).as("placementRows"), @@ -98,7 +112,7 @@ export async function loadChecklistPrint( job_title: person.job_title, position_number: placement?.positionNumber ?? null, position_title: placement?.jobTitle ?? null, - anlass: gelesen.liste?.anlass ?? null, + anlass: anlassMitGrund(gelesen.liste?.anlass ?? null, person), angelegt_am: gelesen.liste?.created_at ?? null, }, staende: gelesen.staende as AufgabenStand[],