Files
alpenwerk-hr/lib/offboarding.ts
Maximilian Stubhan f85731dde5
Some checks failed
CI / Lint, Typen, Tests, Build (push) Failing after 5m42s
CI / Integrationstests (echtes Postgres) (push) Failing after 5m35s
Give exits their own checklist, next to the entry one
The offboarding list was a checkbox fieldset inside the exit panel — four
items, never sent anywhere. Nothing in terminateEmployee's payload
carried them; ticking a box there recorded exactly nothing.

It's replaced with the same kind of list the entries got: its own tab,
appearing the moment an exit is recorded, with one item per row, a
comment on each, and — unlike the fieldset — a record of who touched it
and when.

The eleven items come from the same printed sheet as the entry list.
Nine are plain checkboxes. Two are text fields under "Vermerke":
remaining vacation and the balance transferred for payout — the sheet
names "Überleitung Salden für Auszahlung" twice, once as a task to do
and once as the actual figure, and those are genuinely two different
questions, kept as two items. Where the sheet still says "GKK" rather
than today's "ÖGK", it's left as written — that's the name the process
runs under internally, not a typo.

No Show gets no list. Never having worked a single day, there's no IT
access to revoke, no GKK registration to undo, no Dienstzettel to
collect — an empty checklist there would be a label with nothing behind
it. Both the tab and the auto-creation on exit check for this
specifically, not just the "Ausgetreten" status that No Show shares with
a real exit. Rehiring the same person hides the tab again — the data
stays, since it happened, but a checklist for someone currently working
has nothing to point at.

The engine (what counts as done, how progress is computed) moved into
lib/checklist.ts so onboarding and offboarding can't drift into two
different ideas of "done" the way two independent copies eventually do;
lib/onboarding.ts and lib/offboarding.ts bind it to their own item list,
and the tab UI is a single ChecklistPanel bound the same way.

Checked against the real database: a real exit creates all eleven items
in the same transaction as the exit itself; a No Show creates none;
rehiring flips the tab off while the old answers stay queryable. One
false alarm during that check turned out to be the user's own clicks on
a real employee's onboarding list, made in the browser while trying the
earlier feature — left untouched, not test debris.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:25:58 +02:00

81 lines
3.5 KiB
TypeScript

import {
alleReichungen,
fortschrittVon,
punktZuVon,
type AufgabenGruppe,
type AufgabenPunkt,
type AufgabenStand,
type Fortschritt,
} from "./checklist";
export type { AufgabenArt, AufgabenGruppe, AufgabenPunkt, AufgabenStand, Fortschritt } from "./checklist";
export { istErledigt, wertIstGueltig } from "./checklist";
// Die Offboarding-Checkliste — vom selben Blatt Papier wie die Onboarding-
// Liste, nur für den anderen Weg. Was dort steht, ist hier eins zu eins
// übernommen; wo die Bezeichnung „GKK" auf dem Blatt steht statt des heute
// gebräuchlichen „ÖGK", ist sie unverändert stehengeblieben — das ist der
// Name, unter dem der Vorgang im Haus läuft, nicht ein Tippfehler.
//
// Zwei Punkte auf dem Blatt tragen denselben Namen zweimal: „Überleitung
// Salden für Auszahlung" steht einmal als abzuhakende Aufgabe und daneben als
// Feld für den tatsächlichen Betrag. Das ist kein Versehen im Blatt, sondern
// zwei verschiedene Fragen — „ist es veranlasst?" und „wie viel ist es?" —,
// die hier auch zwei verschiedene Punkte sind.
//
// Warum kein Ja/Nein-Punkt hier steht (anders als Prämienanspruch beim
// Onboarding): auf diesem Blatt gibt es keine Stelle mit zwei Kästchen
// nebeneinander. Taucht künftig eine auf, ist `art: "janein"` bereit.
export const OFFBOARDING_GRUPPEN: readonly AufgabenGruppe[] = [
{
key: "aufgaben",
label: "Zu erledigende Aufgaben",
punkte: [
{ key: "br_verstaendigung", label: "BR Verständigung bei KDG", art: "haken" },
{ key: "kuendigungsschreiben", label: "Kündigungsschreiben (KDG)", art: "haken" },
{ key: "bestaetigung_kdn_bei", label: "Bestätigung KDN / BEI", art: "haken" },
{ key: "lgv_austritt", label: "LGV Austritt", art: "haken" },
{ key: "gkk_abmeldung", label: "GKK-Abmeldung", art: "haken" },
{ key: "if6020_austritt", label: "IF 6020 Austritt", art: "haken" },
{ key: "ueberleitung_salden", label: "Überleitung Salden für Auszahlung", art: "haken" },
{ key: "endabrechnung", label: "Endabrechnung", art: "haken" },
{ key: "offboarding_gestartet", label: "Offboarding gestartet", art: "haken" },
],
},
{
key: "vermerke",
label: "Vermerke",
punkte: [
{ key: "resturlaub", label: "Resturlaub", art: "text" },
{ key: "ueberleitung_salden_betrag", label: "Überleitung Salden für Auszahlung — Betrag", art: "text" },
],
},
] as const;
export const OFFBOARDING_PUNKTE: readonly AufgabenPunkt[] = alleReichungen(OFFBOARDING_GRUPPEN);
export function punktZu(key: string): AufgabenPunkt | undefined {
return punktZuVon(OFFBOARDING_PUNKTE, key);
}
export function fortschritt(staende: AufgabenStand[]): Fortschritt {
return fortschrittVon(OFFBOARDING_PUNKTE, staende);
}
/**
* Ob eine Person offzuboarden ist — die Regel hinter dem Reiter.
*
* Nur ein echter Austritt zählt. No Show scheidet zwar mit demselben Status
* „Ausgetreten" aus, hat aber nie einen Tag gearbeitet: keinen IT-Zugang, der
* eingerichtet wurde, keine GKK-Anmeldung, kein Dienstzettel. Ein Reiter mit
* einer leeren Liste wäre dort ein Etikett ohne Inhalt.
*
* Wird die Person wiedereingestellt, wechselt der Status weg von
* „Ausgetreten", und die Regel verneint wieder — die Checkliste bleibt in den
* Daten stehen, nur ihr Reiter verschwindet, solange sie ohne Gegenstand ist.
*/
export function gehoertOffboarding(employee: { status: string; exit_reason: string | null }): boolean {
return employee.status === "Ausgetreten" && employee.exit_reason !== "No Show";
}