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>
62 lines
2.7 KiB
TypeScript
62 lines
2.7 KiB
TypeScript
import { dienstwagenLabel } from "@/lib/dienstwagen";
|
||
import { fmtDate } from "@/lib/format";
|
||
import type { Database } from "@/lib/supabase/types";
|
||
|
||
type EmployeeRow = Database["public"]["Tables"]["employees"]["Row"];
|
||
|
||
const PAYGRADE_LABELS: Record<string, string> = {
|
||
A: "A – Einstieg",
|
||
B: "B – Qualifiziert",
|
||
C: "C – Erfahren",
|
||
D: "D – Spezialist:in",
|
||
E: "E – Teamleitung",
|
||
F: "F – Bereichsleitung / GF",
|
||
};
|
||
|
||
export function VertragTab({ employee }: { employee: EmployeeRow }) {
|
||
// Früher stand hier eine einzige Zeile „Merkmale" mit allem, was zutraf,
|
||
// durch Kommas getrennt — und ein Gedankenstrich, wenn nichts zutraf. Damit
|
||
// liess sich nicht ablesen, ob jemand *keinen* Dienstwagen hat oder ob
|
||
// niemand die Frage je beantwortet hat. Jedes Merkmal steht jetzt für sich,
|
||
// mit Ja oder Nein, wie jede andere Zeile auf diesem Blatt auch.
|
||
const rows: [string, string][] = [
|
||
["Eintrittsdatum", fmtDate(employee.entry_date)],
|
||
["Vertragsart", employee.contract_type === "befristet" ? `befristet bis ${fmtDate(employee.contract_end_date)}` : "unbefristet"],
|
||
["Kollektivvertrag", employee.collective_agreement ?? "–"],
|
||
["Beschäftigungsausmaß", employee.employment_type],
|
||
["Wochenstunden", `${employee.weekly_hours} h`],
|
||
["Urlaubsanspruch", "25 Tage"],
|
||
["Paygrade", PAYGRADE_LABELS[employee.paygrade] ?? employee.paygrade],
|
||
["Angestellte:r / Arbeiter:in", employee.worker_type ?? "–"],
|
||
["Arbeitstage", employee.work_days?.join(", ") || "–"],
|
||
// Beim Dienstwagen steht die Antriebsart statt eines blossen „Ja" — das
|
||
// war die Frage dahinter, seit E-Fahrzeuge getrennt zu führen sind.
|
||
["Dienstwagen", employee.has_dienstwagen ? dienstwagenLabel(employee.dienstwagen_art) : "Nein"],
|
||
["Betriebsrat", employee.is_betriebsrat ? "Ja" : "Nein"],
|
||
["Laterale Führung", employee.is_laterale_fuehrung ? "Ja" : "Nein"],
|
||
["C-Level", employee.is_c_level ? "Ja" : "Nein"],
|
||
// Das Enddatum steht gleich dabei: „Ja" allein liesse offen, ob der
|
||
// Schutz noch läuft, und genau danach fragt man.
|
||
[
|
||
"Besonderer Kündigungsschutz",
|
||
employee.has_kuendigungsschutz
|
||
? employee.kuendigungsschutz_bis
|
||
? `bis ${fmtDate(employee.kuendigungsschutz_bis)}`
|
||
: "Ja (Ende offen)"
|
||
: "Nein",
|
||
],
|
||
];
|
||
if (employee.exit_date) rows.push(["Austrittsdatum", fmtDate(employee.exit_date)]);
|
||
|
||
return (
|
||
<dl className="grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-2 lg:grid-cols-3">
|
||
{rows.map(([label, value]) => (
|
||
<div key={label}>
|
||
<dt className="text-xs font-semibold uppercase tracking-wide text-ink-muted">{label}</dt>
|
||
<dd className="mt-1 text-sm text-ink">{value}</dd>
|
||
</div>
|
||
))}
|
||
</dl>
|
||
);
|
||
}
|