Ask for the optional things separately, and stop claiming numbers are issued

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>
This commit is contained in:
2026-08-11 21:47:04 +02:00
parent 4eba557121
commit c23df08648
17 changed files with 387 additions and 96 deletions

View File

@@ -1,8 +1,22 @@
import type { CollectiveAgreement, ContractType, DienstwagenArt, EmploymentType, GenderType, PaygradeType, Weekday, WorkerType } from "@/lib/supabase/types";
import type { CollectiveAgreement, ContractType, DienstwagenArt, EmploymentType, GenderType, PaygradeType, RelationshipType, Weekday, WorkerType } from "@/lib/supabase/types";
// The spec's hire wizard field list (§4.4) omits Geschlecht and Standort even
// though both are NOT NULL on employees — added here (defaults keep them
// effectively "free" for the user, same treatment as the karenz-start gap).
/**
* Angehörige:r, wie sie im Assistenten gesammelt wird.
*
* Eigener Typ statt der Zeile aus der Datenbank: es gibt weder eine Kennung
* noch eine Person, an der sie hängt — beides entsteht erst mit dem Anlegen.
*/
export type HireDraftAngehoerige = {
firstName: string;
lastName: string;
relationship: RelationshipType;
birthDate: string;
svNummer: string;
};
export type HireDraftData = {
/**
* Eingabe, nicht Vergabe.
@@ -39,6 +53,7 @@ export type HireDraftData = {
emergencyContactName: string;
emergencyContactPhone: string;
emergencyContactRelation: string;
angehoerige: HireDraftAngehoerige[];
isLateraleFuehrung: boolean;
isCLevel: boolean;
};
@@ -72,6 +87,7 @@ export const EMPTY_HIRE_DRAFT: HireDraftData = {
emergencyContactName: "",
emergencyContactPhone: "",
emergencyContactRelation: "",
angehoerige: [],
isLateraleFuehrung: false,
isCLevel: false,
};