Files
alpenwerk-hr/components/hire/StepSummary.tsx
Andrei Laas bb92dca1ae
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m46s
CI / Ausrollen (push) Successful in 7s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m25s
Lehrzeit von / bis beim Lehrling
Bei der Beschaeftigtengruppe "Lehrling" fragen Einstellung,
Wiedereintritt und Daten aendern nach Beginn und Ende der Lehrzeit (beide
freiwillig, Ende nach Beginn: chk_lehrzeit). Bei jeder anderen Gruppe
bleiben sie leer. Sichtbar im Reiter Vertrag und in der Zusammenfassung der
Einstellung, in der Historie berichtigbar, im Nachtlauf mitgefuehrt.

Rauchtest: Schritt 27.

Geprueft: lint, tsc, types:check, 947 Tests, Uebergabe-Waechter
2026-10-20 15:29:07 +02:00

82 lines
3.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { hrName, useHrBenutzer } from "@/components/shell/HrBenutzerContext";
import { dienstwagenLabel } from "@/lib/dienstwagen";
import { fmtDate, fmtFullName } from "@/lib/format";
import { geschlechtLabel } from "@/lib/geschlecht";
import { hayGradeLabel } from "@/lib/hay-grade";
import { lehrzeitText } from "@/lib/lehrzeit";
import { anzeige } from "@/lib/anzeige";
import type { OpenPositionResolved } from "@/lib/positions";
import { bonusanspruchLabel } from "@/lib/vertragsangaben";
import type { HireDraftData } from "./types";
type StepSummaryProps = {
draft: HireDraftData;
selectedPosition: OpenPositionResolved | null;
locations: { id: string; name: string; country: string }[];
};
export function StepSummary({ draft, selectedPosition, locations }: StepSummaryProps) {
const hrBenutzer = useHrBenutzer();
const location = locations.find((l) => l.id === draft.locationId);
const flags = [
draft.isBetriebsrat && "Betriebsrat",
draft.hasDienstwagen && `Dienstwagen (${dienstwagenLabel(draft.dienstwagenArt)})`,
draft.isLateraleFuehrung && "Laterale Führung",
draft.isCLevel && "C-Level",
draft.hasKuendigungsschutz &&
`Besonderer Kündigungsschutz${draft.kuendigungsschutzBis ? ` bis ${fmtDate(draft.kuendigungsschutzBis)}` : ""}`,
].filter(Boolean);
const notfall = [
draft.emergencyContactName,
draft.emergencyContactRelation && `(${anzeige(draft.emergencyContactRelation)})`,
draft.emergencyContactPhone,
]
.filter(Boolean)
.join(" ");
const rows: [string, string][] = [
["Personalnummer", draft.personnelNumber || "–"],
["Name", fmtFullName(draft.firstName, draft.lastName, draft.titlePrefix, draft.titleSuffix)],
["Geschlecht", geschlechtLabel(draft.gender)],
["Geburtsdatum", fmtDate(draft.birthDate)],
["SV-Nummer", draft.svNummer || "–"],
["Erlernter Beruf", draft.erlernterBeruf.trim() || "–"],
["E-Mail (privat)", draft.email || "–"],
["Telefon", draft.phone || "–"],
["Notfallkontakt", notfall || "–"],
["Standort", location ? `${location.name} (${location.country})` : "–"],
["Zuständige HR", hrName(hrBenutzer, draft.zustaendigeHrId)],
["Position", selectedPosition ? `${selectedPosition.title} (${selectedPosition.position_number})` : "–"],
["Organisationseinheit", selectedPosition?.orgLabel ?? "–"],
["Führungskraft", selectedPosition?.managerName ?? "–"],
["Besetzung", draft.besetzung],
["Eintrittsdatum", fmtDate(draft.entryDate)],
["Vertragsart", draft.contractType === "befristet" ? `befristet bis ${fmtDate(draft.contractEndDate)}` : "unbefristet"],
["Beschäftigungsausmaß", `${draft.employmentType} (${draft.weeklyHours} h)`],
["Hay-Grade", hayGradeLabel(draft.paygrade)],
["VL", draft.vl || "–"],
["Bonusanspruch", bonusanspruchLabel(draft.hasBonusanspruch, draft.bonusanspruchArt)],
["Beschäftigtengruppe", anzeige(draft.workerType)],
...(draft.workerType === "Lehrling"
? ([["Lehrzeit", lehrzeitText(draft.lehrzeitVon || null, draft.lehrzeitBis || null)]] as [string, string][])
: []),
["Anstellungs-/Beschäftigungsart", anzeige(draft.mitarbeiterart)],
["Kollektivvertrag", draft.collectiveAgreement],
["Arbeitstage", draft.workDays.join(", ") || "–"],
["Merkmale", flags.length > 0 ? flags.join(", ") : "–"],
];
return (
<div className="flex flex-col gap-4">
<dl className="grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2">
{rows.map(([label, value]) => (
<div key={label}>
<dt className="text-xs font-semibold uppercase tracking-wide text-ink-muted">{label}</dt>
<dd className="mt-0.5 text-sm text-ink">{value}</dd>
</div>
))}
</dl>
</div>
);
}