Checkliste drucken: Grund mit Art der Abwesenheit oder Beendigungsart
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 13m1s
CI / Migrationen auf leerer Datenbank (push) Successful in 11m23s
CI / Ausrollen (push) Successful in 8s

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.
This commit is contained in:
2026-11-03 09:38:46 +01:00
parent 5abaaa36dd
commit 4f2dc3351a
2 changed files with 17 additions and 3 deletions

View File

@@ -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[],