Standort: locations.parent_id, eine Ebene. Neu "Shop" mit sechs Shops (Shop W17, Shop Wodo, Shop Parndorf, Shop Donaupark, Shop W1, Shop Wien Hauptbahnhof). Personen sitzen nur auf Standorten ohne Unterstandorte; zwei Trigger halten das auch fuer Import und Nachtlauf fest. Einstellung, Externe und Versetzung zeigen bei "Shop" eine zweite Auswahl (StandortAuswahl). Filter in Liste und Berichten und die Importliste bieten "Shop" selbst nicht an; der Import nennt bei "Shop" die Shops. rauchtest.sql und vertragsangaben.sql waehlen einen zuweisbaren Standort. C-Level: ueberall nur der Code (Formular, Akte, Zusammenfassung, Historie, Berichte, Import). Export ohne Spalte "C-Level Bezeichnung". Angehoerige und Notfallkontakte im Import wie im Formular: Auswahl als feste Liste und daneben "Verhaeltnis (Sonstige)" fuer den eigenen Text. Gespeichert wird bei "Sonstige" der Text; ein Text ohne "Sonstige" ist ein Fehler. Der Download teilt einen eigenen Text in beide Spalten. Geprueft: lint, tsc, types:check, npm test, waechter; Migrationen auf leerer Datenbank zweimal (Nichts anzuwenden), rauchtest.sql, vertragsangaben.sql; als alpenwerk_app: Einstellung auf "Shop" abgewiesen, auf "Shop W17" angenommen, Wechsel auf "Shop" abgewiesen, auf "Shop Wodo" angenommen, Unterstandort unter einem Shop abgewiesen.
115 lines
4.8 KiB
TypeScript
115 lines
4.8 KiB
TypeScript
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 }[];
|
||
/** Externe Person: nur, was der Schritt „Externe Person" gefragt hat. */
|
||
extern?: boolean;
|
||
/**
|
||
* Übernahme: die Planstelle bleibt, wie sie in der Akte steht, und wird
|
||
* hier nicht gefragt; das Datum ist der Tag der Übernahme.
|
||
*/
|
||
uebernahme?: boolean;
|
||
};
|
||
|
||
const NICHT_BEI_UEBERNAHME = new Set(["Position", "Organisationseinheit", "Führungskraft"]);
|
||
|
||
// Bei einer externen Person stünden sonst Vorgaben da, die niemand erfasst
|
||
// hat („Vollzeit (38,5 h)", „unbefristet") und die wie Angaben aussähen.
|
||
const NUR_EXTERN = new Set([
|
||
"Personalnummer",
|
||
"Name",
|
||
"Geschlecht",
|
||
"Geburtsdatum",
|
||
"Standort",
|
||
"Position",
|
||
"Organisationseinheit",
|
||
"Führungskraft",
|
||
"Besetzung",
|
||
"Eintrittsdatum",
|
||
]);
|
||
|
||
export function StepSummary({ draft, selectedPosition, locations, extern = false, uebernahme = false }: 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.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],
|
||
...(uebernahme && draft.istUebernahmeLeiharbeit
|
||
? ([["Übernahme Leiharbeitskraft", draft.uebernahmeLeiharbeitText.trim() || "Ja"]] as [string, string][])
|
||
: []),
|
||
[uebernahme ? "Übernahme zum" : "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],
|
||
["C-Level", draft.cLevel || "–"],
|
||
["Arbeitstage", draft.workDays.join(", ") || "–"],
|
||
["Merkmale", flags.length > 0 ? flags.join(", ") : "–"],
|
||
];
|
||
|
||
const sichtbar = extern
|
||
? rows.filter(([label]) => NUR_EXTERN.has(label))
|
||
: uebernahme
|
||
? rows.filter(([label]) => !NICHT_BEI_UEBERNAHME.has(label))
|
||
: rows;
|
||
|
||
return (
|
||
<div className="flex flex-col gap-4">
|
||
<dl className="grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2">
|
||
{sichtbar.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>
|
||
);
|
||
}
|