Mitarbeiter:innen, Organisationsstruktur, Planstellen, Eintritt, Austritt, Versetzung, Befoerderung, Karenz, On- und Offboarding, Berichte, Massenimport und ein lueckenloser Nachweis jeder Aenderung. Next.js 16 mit React 19 und TypeScript, PostgreSQL 17 ueber Kysely, Anmeldung ueber Microsoft Entra ID. Die Fachlogik liegt in der Datenbank: rund dreissig PL/pgSQL-Funktionen fuehren eine Aenderung, ihren Historieneintrag und ihren Protokolleintrag in einer Transaktion aus. Die Zugriffsschranke ist Row Level Security, nicht die Oberflaeche. Betrieb auf Windows Server ohne Docker: ein fertiges Paket, ein Windows-Dienst, der IIS als HTTPS-Vorschaltung und zwei geplante Aufgaben. Siehe deploy/windows/README.md.
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { TextField } from "@/components/ui/Field";
|
|
import { formatSvnr, requiresAustrianSvnr, svnrErrorMessage, validateSvnr } from "@/lib/svnr";
|
|
|
|
type SvNummerFieldProps = {
|
|
value: string;
|
|
onChange: (value: string) => void;
|
|
/** Country of the employee's work location — validation applies to Austria only. */
|
|
locationCountry: string | null | undefined;
|
|
/** ISO yyyy-mm-dd; enables the cross-check against the TTMMJJ tail. */
|
|
birthDate?: string | null;
|
|
dense?: boolean;
|
|
};
|
|
|
|
/**
|
|
* Shared by the hire wizard and the "Daten ändern" panel so both apply the
|
|
* same rule. Errors are shown only once the field has been left, so the
|
|
* message does not flash while the ten digits are still being typed.
|
|
*/
|
|
export function SvNummerField({ value, onChange, locationCountry, birthDate, dense }: SvNummerFieldProps) {
|
|
const [touched, setTouched] = useState(false);
|
|
const applies = requiresAustrianSvnr(locationCountry);
|
|
const error = applies && value.trim() !== "" ? validateSvnr(value, birthDate) : null;
|
|
|
|
return (
|
|
<TextField
|
|
label="SV-Nummer"
|
|
dense={dense}
|
|
value={value}
|
|
onChange={onChange}
|
|
inputMode="numeric"
|
|
placeholder={applies ? "1237 010180" : undefined}
|
|
error={touched && error ? svnrErrorMessage(error) : null}
|
|
hint={applies ? "10 Ziffern: laufende Nummer, Prüfziffer, Geburtsdatum (TTMMJJ)." : undefined}
|
|
onBlur={() => {
|
|
setTouched(true);
|
|
// Normalise to the conventional "NNNN TTMMJJ" spacing once the value
|
|
// is complete; anything else is left exactly as typed.
|
|
const formatted = formatSvnr(value);
|
|
if (formatted !== value) onChange(formatted);
|
|
}}
|
|
/>
|
|
);
|
|
}
|