A round of interface corrections from use, plus one schema change behind them. The private email address is now optional. It was NOT NULL — the wrong default for a private detail: someone without one had to invent one, and invented data in a personnel file is worse than missing data. Both fields are relabelled to say whose they are, "Private E-Mail" and "Private Telefonnummer", because the company address does not exist until the person starts. Uniqueness stays; several NULLs coexist in a Postgres unique index, which is exactly what is wanted. The summary step still promised that "Personalnummer und Firmen-E-Mail-Adresse werden automatisch vergeben". Neither is true any more. Removed rather than reworded — the step lists what was entered, and a banner claiming otherwise is worse than no banner. Dependents move into the wizard as step three, optional. They can only be attached after the hire, because add_employee_dependent needs an id that does not exist while the form is open, so they are collected in the draft and written afterwards. That puts them outside the transaction the person is created in: if one fails the person still exists, so the message names who is missing instead of failing silently, and the SV number is checked in the step rather than after. The emergency contact gets its own step, second to last, and its relationship is a dropdown of the common ones rather than free text — otherwise "Gattin", "Ehefrau" and "Frau" end up side by side and nothing can be counted. "Sonstige" is there because a closed list would otherwise be presumptuous. On the master-data tab it now sits below the dependents rather than above: both are people around the employee, and this is the one you reach for in a hurry. Returning from a long absence: the choice read "unverändert", which made you open the file to find out what you were agreeing to. It now reads "Wie vor Abwesenheit (38,5 h)" with the hours actually worked, and the alternative is "Reduziert" — whose hours field starts empty on purpose. A number already filled in gets confirmed rather than read off the agreement it comes from. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
65 lines
2.8 KiB
TypeScript
65 lines
2.8 KiB
TypeScript
import { SvNummerField } from "@/components/employees/SvNummerField";
|
|
import { TitleFields } from "@/components/employees/TitleFields";
|
|
import { SelectField, TextField } from "@/components/ui/Field";
|
|
import type { HireDraftData } from "./types";
|
|
|
|
type StepPersonProps = {
|
|
draft: HireDraftData;
|
|
update: (patch: Partial<HireDraftData>) => void;
|
|
locations: { id: string; name: string; country: string }[];
|
|
};
|
|
|
|
export function StepPerson({ draft, update, locations }: StepPersonProps) {
|
|
return (
|
|
<div className="flex flex-col gap-4">
|
|
<TextField
|
|
label="Personalnummer"
|
|
required
|
|
inputMode="numeric"
|
|
value={draft.personnelNumber}
|
|
onChange={(personnelNumber) => update({ personnelNumber: personnelNumber.replace(/\D/g, "") })}
|
|
hint="Muss mit Loga und Interflex übereinstimmen. Wird nicht automatisch vergeben."
|
|
/>
|
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
<TextField label="Vorname" required value={draft.firstName} onChange={(firstName) => update({ firstName })} />
|
|
<TextField label="Nachname" required value={draft.lastName} onChange={(lastName) => update({ lastName })} />
|
|
</div>
|
|
<TitleFields value={draft} onChange={update} />
|
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
<SelectField
|
|
label="Geschlecht"
|
|
required
|
|
value={draft.gender}
|
|
onChange={(gender) => update({ gender: gender as HireDraftData["gender"] })}
|
|
options={[
|
|
{ value: "m", label: "männlich" },
|
|
{ value: "w", label: "weiblich" },
|
|
]}
|
|
/>
|
|
<TextField label="Geburtsdatum" required type="date" value={draft.birthDate} onChange={(birthDate) => update({ birthDate })} />
|
|
</div>
|
|
<SvNummerField
|
|
value={draft.svNummer}
|
|
onChange={(svNummer) => update({ svNummer })}
|
|
locationCountry={locations.find((l) => l.id === draft.locationId)?.country}
|
|
birthDate={draft.birthDate || null}
|
|
/>
|
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
{/* Die private Adresse, nicht die Firmenadresse — die entsteht erst
|
|
mit dem Eintritt. Freiwillig: wer keine hat oder keine angeben
|
|
will, soll nicht gezwungen sein, eine zu erfinden. */}
|
|
<TextField label="Private E-Mail" type="email" value={draft.email} onChange={(email) => update({ email })} />
|
|
<TextField label="Private Telefonnummer" type="tel" value={draft.phone} onChange={(phone) => update({ phone })} />
|
|
</div>
|
|
<SelectField
|
|
label="Standort"
|
|
required
|
|
value={draft.locationId}
|
|
onChange={(locationId) => update({ locationId })}
|
|
placeholder="Bitte wählen…"
|
|
options={locations.map((l) => ({ value: l.id, label: `${l.name} (${l.country})` }))}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|