Flag people who cannot simply be dismissed

Works council members, expectant mothers, parents on leave, registered
disabled employees, apprentices — each has its own rules that come
before a dismissal. The tool does not judge whether one is lawful, but
it must not stay quiet about it either, and looking it up on the
contract tab is exactly the step that gets skipped under time pressure.

So: a checkbox, an optional end date, and a red warning at the top of
the termination panel naming the date — or saying plainly that no end
was recorded. It shows for a no-show too; the protection runs from the
start of the contract, not the first day worked.

The date is optional on purpose. A works council mandate has a known
end, a pregnancy does not, and a mandatory field would force an invented
number. A constraint says only what cannot be: an end date without the
flag, which would be a leftover nobody could interpret.

The field goes the whole way through — hire, data change, contract
sheet, export, report criteria (as a yes/no and as a date range), and
the import. A field that exists in one screen and not the next is how
people stop trusting the numbers.

Terminating is now offered for planned entries as well, labelled "Nicht
angetreten", with No Show preselected. Without it a person who never
turned up stayed a planned entry forever, since nothing else can end
one.

One finding worth recording: tsc has been reporting success on a broken
program. A generated file under .next got corrupted when a build ran
against a live dev server, and its syntax errors suppressed semantic
checking everywhere else — two genuine type errors in this change went
unreported until I typechecked with .next excluded. The file is removed
and the ordinary typecheck is meaningful again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 12:44:00 +02:00
parent 0144267a59
commit 6681dcda77
18 changed files with 544 additions and 9 deletions

View File

@@ -237,6 +237,10 @@ export async function laden(
emergency_contact_relation: txt(w.emergency_contact_relation),
is_laterale_fuehrung: bool(w.is_laterale_fuehrung, false),
is_c_level: bool(w.is_c_level, false),
has_kuendigungsschutz: bool(w.has_kuendigungsschutz, false),
// Ohne Schutz kein Enddatum — chk_kuendigungsschutz_bis weist es sonst
// ab, und die ganze Datei scheiterte an einer einzelnen Zeile.
kuendigungsschutz_bis: bool(w.has_kuendigungsschutz, false) ? (txt(w.kuendigungsschutz_bis) ?? null) : null,
entry_date: eintritt,
exit_date: austritt,
exit_reason: txt(w.exit_reason),

View File

@@ -391,6 +391,22 @@ export const BLATT_PERSONEN: BlattSchema = {
},
{ name: "Laterale Führung", ziel: "is_laterale_fuehrung", pflicht: false, typ: { art: "janein" }, hinweis: "", beispiel: "nein" },
{ name: "C-Level", ziel: "is_c_level", pflicht: false, typ: { art: "janein" }, hinweis: "", beispiel: "nein" },
{
name: "Besonderer Kündigungsschutz",
ziel: "has_kuendigungsschutz",
pflicht: false,
typ: { art: "janein" },
hinweis: "Leer = nein.",
beispiel: "nein",
},
{
name: "Kündigungsschutz bis",
ziel: "kuendigungsschutz_bis",
pflicht: false,
typ: { art: "datum" },
hinweis: "Nur mit gesetztem Schutz; freiwillig.",
beispiel: "",
},
{
name: "Abwesenheit ab",
ziel: "karenz_start_date",

View File

@@ -69,6 +69,7 @@ export const JANEIN_KRITERIEN: readonly JaNeinKriterium[] = [
{ key: "betriebsrat", label: "Betriebsrat" },
{ key: "lateral", label: "Laterale Führung" },
{ key: "clevel", label: "C-Level" },
{ key: "kuendigungsschutz", label: "Besonderer Kündigungsschutz" },
{ key: "dependents", label: "Angehörige erfasst" },
] as const;
@@ -79,6 +80,7 @@ export const ZEITRAUM_KRITERIEN: readonly ZeitraumKriterium[] = [
{ key: "entry", label: "Eintritt" },
{ key: "exit", label: "Austritt" },
{ key: "birth", label: "Geburtsdatum" },
{ key: "schutz", label: "Kündigungsschutz bis" },
] as const;
export type Criteria = {

View File

@@ -70,6 +70,7 @@ export function applyCriteria<O>(
if (j.betriebsrat) q = q.where("is_betriebsrat", "=", j.betriebsrat === "ja");
if (j.lateral) q = q.where("is_laterale_fuehrung", "=", j.lateral === "ja");
if (j.clevel) q = q.where("is_c_level", "=", j.clevel === "ja");
if (j.kuendigungsschutz) q = q.where("has_kuendigungsschutz", "=", j.kuendigungsschutz === "ja");
// Ein Austrittszeitraum schliesst alle ohne Austritt aus — ein Vergleich
// mit NULL ist nicht wahr, und das ist hier genau die richtige Bedeutung.
@@ -79,6 +80,8 @@ export function applyCriteria<O>(
if (c.zeitraum.exit?.bis) q = q.where("exit_date", "<=", c.zeitraum.exit.bis);
if (c.zeitraum.birth?.von) q = q.where("birth_date", ">=", c.zeitraum.birth.von);
if (c.zeitraum.birth?.bis) q = q.where("birth_date", "<=", c.zeitraum.birth.bis);
if (c.zeitraum.schutz?.von) q = q.where("kuendigungsschutz_bis", ">=", c.zeitraum.schutz.von);
if (c.zeitraum.schutz?.bis) q = q.where("kuendigungsschutz_bis", "<=", c.zeitraum.schutz.bis);
if (c.stundenVon !== undefined) q = q.where("weekly_hours", ">=", c.stundenVon);
if (c.stundenBis !== undefined) q = q.where("weekly_hours", "<=", c.stundenBis);

View File

@@ -172,6 +172,10 @@ export type Database = {
has_dienstwagen: boolean;
/** Null genau dann, wenn kein Dienstwagen vorhanden ist — chk_dienstwagen_art. */
dienstwagen_art: DienstwagenArt | null;
/** Besonderer Kündigungsschutz — löst beim Austritt eine Warnung aus. */
has_kuendigungsschutz: boolean;
/** Ende des Schutzes, falls bekannt. Nur mit dem Kennzeichen zusammen erlaubt. */
kuendigungsschutz_bis: string | null;
/** Nur gemeinsam gesetzt oder gemeinsam leer — chk_emergency_contact. */
emergency_contact_name: string | null;
emergency_contact_phone: string | null;
@@ -219,6 +223,8 @@ export type Database = {
is_betriebsrat?: boolean;
has_dienstwagen?: boolean;
dienstwagen_art?: DienstwagenArt | null;
has_kuendigungsschutz?: boolean;
kuendigungsschutz_bis?: string | null;
emergency_contact_name?: string | null;
emergency_contact_phone?: string | null;
emergency_contact_relation?: string | null;