Commit Graph

20 Commits

Author SHA1 Message Date
1738768e74 Keine Vorgaben fuer Geschlecht und Staatsbuergerschaft; Uebernahme Leiharbeitskraft nur bei der Uebernahme
Some checks failed
CI / Lint, Typen, Tests, Build (push) Successful in 12m58s
CI / Ausrollen (push) Has been cancelled
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
Staatsbuergerschaft: die Spalte war Pflicht mit Vorgabe "Oesterreich",
hire_employee setzte sie ohne Angabe ein. Ein leeres Feld stand damit als
Angabe in der Akte. 20261105130000 macht sie freiwillig ohne Vorgabe;
hire, rehire, change_employee_data und der naechtliche Lauf nehmen die
leere Zeichenkette als null (case when ? then nullif). Bestehende Zeilen
bleiben. Die Uebernahme schickt das Feld auch leer und raeumt so die
Vorgabe der externen Person weg.

Neueinstellung: Geschlecht und Staatsbuergerschaft stehen leer,
Geschlecht ist Pflicht mit "Bitte waehlen".

Geburtsdatum in der Zukunft: auch bei Angehoerigen (Assistent und Akte)
und in "Eintrag berichtigen" abgewiesen.

"Uebernahme Leiharbeitskraft": nur noch im Assistenten "Uebernahme". Aus
Neueinstellung und Wiedereintritt entfernt; in "Daten aendern" nur bei
Personen, die das Kennzeichen tragen, zum Berichtigen.

Geprueft: lint, tsc, types:check, npm test (1075), waechter; alle
Migrationen auf leerer Datenbank, zweiter Lauf "Nichts anzuwenden";
rauchtest.sql und vertragsangaben.sql bestanden. Nicht im Browser geprueft.
2026-11-05 13:58:25 +01:00
3ed76a019b Uebernahme mit Angehoerigen und Notfallkontakt; Geburtsdatum in der Zukunft abgewiesen
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m58s
CI / Migrationen auf leerer Datenbank (push) Successful in 11m9s
CI / Ausrollen (push) Successful in 7s
Uebernahme: die Schritte der Neueinstellung ausser der Planstelle -
dazu Angehoerige und Notfallkontakt. Beide werden nach der Uebernahme
angelegt (add_employee_dependent, add_emergency_contact); scheitert
einer, sagt die Meldung, wer fehlt. Bestehende bleiben in der Akte.
Staatsbuergerschaft und Land stehen leer, wenn bei der externen Person
nur die Vorgabe der Spalte steht; eine leere Staatsbuergerschaft wird
nicht geschickt und laesst den gespeicherten Wert stehen.

Geburtsdatum: in der Zukunft oder nicht vor dem Eintritt haelt
Neueinstellung (intern und extern), Wiedereintritt und Uebernahme an und
steht am Feld (lib/geburtsdatum.ts). "Daten aendern" weist es ab, wenn
das Geburtsdatum dort geaendert wird.

Geprueft: lint, tsc, types:check, npm test (1072), waechter. Nicht im
Browser geprueft.
2026-11-05 13:17:03 +01:00
da10b4dda2 Uebernahme als eigener Vorgang; Weiter markiert Pflichtfelder; Filter "Austritt geplant"
Some checks failed
CI / Lint, Typen, Tests, Build (push) Successful in 13m20s
CI / Ausrollen (push) Has been cancelled
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
Uebernahme: neuer Knopf "Uebernahme" in der Akte, nur bei externer
Besetzung ohne erfassten Austritt. Der Assistent fragt Tag, Person und
Vertrag wie eine Einstellung, vorbelegt aus der Akte, Planstelle und
Notfallkontakte bleiben. uebernahme_erfassen (20261105120000) setzt die
Besetzungsart auf Intern ueber change_employee_data, das das Ereignis
"Uebernahme" schreibt, und auf Wunsch eine neue Personalnummer (sofort
wirksam, in der Zeile "Uebernahme" und im Protokoll). In "Daten aendern"
ist die Besetzungsart bei externen Personen gesperrt und verweist auf den
Knopf.

Weiter: in Neueinstellung, Wiedereintritt und Uebernahme immer
bedienbar. An einem unvollstaendigen Schritt bleibt der Assistent stehen,
leere Pflichtfelder tragen "Bitte ausfuellen.", dazu ein Hinweis. Die
Markierung kommt ueber einen Kontext in components/ui/Field.tsx und
greift an jedem Feld mit required.

Wochenstunden: Teilzeit mit 38,5 Stunden oder mehr haelt im Schritt
Vertrag an und steht am Feld, statt erst beim Anlegen an chk_weekly_hours
zu scheitern (lib/wochenstunden.ts, auch fuer "Eintrag berichtigen").

Mitarbeiterliste: Statusfilter "Austritt geplant" - erfasster Austritt
nach heute, ohne Nichtantritt, sortiert nach dem naechsten Austritt.

Rauchtest 35c: Uebernahme mit neuer Personalnummer, vergebene Nummer und
zweite Uebernahme abgewiesen.

Geprueft: lint, tsc, types:check, npm test (1065), waechter; alle
Migrationen auf leerer Datenbank, zweiter Lauf "Nichts anzuwenden";
rauchtest.sql und vertragsangaben.sql bestanden. Nicht im Browser geprueft.
2026-11-05 12:58:02 +01:00
c077f7b908 Neueinstellung: eigene Maske fuer externe Personen
Some checks failed
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
CI / Ausrollen (push) Has been cancelled
CI / Lint, Typen, Tests, Build (push) Has been cancelled
Fachlich vorgegeben: bei Besetzung "Extern" fragt die Einstellung nur
Vorname, Nachname, Geschlecht, Geburtsdatum, OE (Planstelle) und
Standort. Vertrag, Angehoerige und Notfallkontakt fuehrt der Ueberlasser.

- Der Assistent hat bei "Extern" drei Schritte: Eintritt, Externe Person,
  Zusammenfassung. Die Personalnummer steht mit dabei - die Anwendung
  fuehrt jede Person ueber sie.
- Geschickt wird nur, was die Maske fragt; was vor dem Wechsel auf
  "Extern" in anderen Schritten stand, geht nicht mit. Den Rest setzt
  hire_employee auf seine Vorgaben.
- Die Zusammenfassung zeigt bei "Extern" keine Vorgaben, die niemand
  erfasst hat (Vollzeit, unbefristet ...).

Geprueft: lint, tsc, 1007 Tests (neu: Abfolge, Pflichtfelder,
Zusammenfassung und gesendete Angaben bei externer Besetzung),
Uebergabe-Waechter.
2026-10-29 16:01:03 +01:00
3f6c7e0ca0 Uebernahme Leiharbeitskraft bei Einstellung und in den Stammdaten
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m32s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m10s
CI / Ausrollen (push) Successful in 7s
Neues Kennzeichen "Uebernahme Leiharbeitskraft" mit einem freien Feld
dazu, das erst mit dem Haken erscheint. Gefragt bei interner Besetzung in
Einstellung und Wiedereintritt, aenderbar in "Daten aendern", sichtbar in
den Stammdaten, der Zusammenfassung und im Mitarbeiterexport.

Die Spalten gehoeren zur Gruppe person. Einstellung, Wiedereintritt,
"Daten aendern", Nachtlauf und Feldkarte sind an der laufenden Definition
ergaenzt; ein CHECK haelt Angaben ohne Kennzeichen fern, die Funktionen
leeren sie beim Entfernen des Hakens.

Geprueft: lint, tsc, types:check, 957 Tests, Waechter; alle Migrationen auf
leerer Datenbank, zweiter Lauf ohne Befund; Rauchtest 32/32 mit neuem
Schritt; datierte Aenderung im Nachtlauf als alpenwerk_app.
2026-10-29 08:43:00 +01:00
bb92dca1ae Lehrzeit von / bis beim Lehrling
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
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
9637471f29 Austrittsdatum am Status, Behinderung eigene Ebene, Mutterschutz, geplante Vorgaenge aendern
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m41s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m24s
CI / Ausrollen (push) Successful in 9s
- Statuschip: bei Ausgetretenen das Austrittsdatum in Klammern (Liste und
  Akte).
- "Beguenstigt behindert" steht auf derselben Ebene wie der besondere
  Kuendigungsschutz und gilt auch ohne ihn; nennt der Personenkreis die
  Beguenstigung, ist das Kaestchen angehakt und gesperrt.
- Personenkreis "Schwangerschaft" heisst in Anzeige und Export
  "Mutterschutz"; gespeichert bleibt der Wert. lib/ohne-gendern.ts wird
  dafuer zu lib/anzeige.ts (anzeige, anzeigeAuswahl).
- Geplante Versetzung und Befoerderung lassen sich aendern: Stift in der
  Historie oeffnet Versetzen bzw. Befoerdern vorbelegt (Datum, Planstelle,
  Bezeichnung, Hay-Grade). Gespeichert wird als Abbrechen und neu Erfassen
  in einer Transaktion (geplantenVorgangErsetzen), damit dieselben
  Pruefungen gelten wie bei einer neuen; scheitert eine, bleibt die alte
  Vormerkung stehen. Ohne Migration.

Geprueft: lint, tsc, types:check, 904 Tests, Waechter
2026-10-19 14:18:38 +02:00
002472741a Bezeichnungen ohne Gendern in Oberflaeche und Exporten
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m0s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m27s
CI / Ausrollen (push) Successful in 5s
Fachlich vorgegeben: nicht gendern, auch in den Exporten. Gespeichert
bleibt der Wert der Datenbank ("Angestellte:r", "Arbeiter:in",
"Praktikant:in", "Ehepartner:in", "Lebenspartner:in") - er steht in
Aufzaehlungstypen, Pruefbedingungen, der Historie und der Sicht fuer die
IT. Uebersetzt wird nur die Anzeige.

lib/ohne-gendern.ts: eine Regel ueber den Text (":innen", ":in", "e:r",
"e:n"), damit auch Texte aus der Datenbank wie "Angehoerige:r
hinzugefuegt" und Feldnamen der Historie ohne Gendern erscheinen.
Auswahllisten senden weiter den gespeicherten Wert.

Angewendet in Formularen, Historie, Protokoll, Berichten und Filtern,
Mitarbeiter- und Ereignisexport, Importvorlage; der Import nimmt beide
Schreibweisen an. Feste Texte (Menue, Liste, Notizen, Anmeldung)
direkt umformuliert.

Geprueft: lint, tsc, types:check, 885 Tests, Waechter
2026-10-19 12:24:29 +02:00
e1bbcc949f Geschlecht: divers, offen und inter
Some checks failed
CI / Lint, Typen, Tests, Build (push) Has been cancelled
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
CI / Ausrollen (push) Has been cancelled
- Migration 20261015150000: gender_type um d, o, i erweitert (add value,
  aus demselben Grund wie bei worker_type: die Sicht it.mitarbeiter
  liest die Spalte). Die Funktionen wandeln mit ::gender_type um und
  nehmen die Werte ohne Aenderung an.
- lib/geschlecht.ts fuehrt Kuerzel und Bezeichnung. Formulare
  (Einstellung, Daten aendern), Stammdaten, Zusammenfassung,
  Mitarbeiterexport, Berichtsfilter und Import lesen von dort. Die
  Anzeigen der Form gender === "m" ? "maennlich" : "weiblich" sind
  ersetzt; sie haetten jeden weiteren Wert als "weiblich" gezeigt.
- Cornerstone fuehrt d/o/i als "not specified", LOLYO laesst die Anrede
  leer (beides schon bisher das Verhalten fuer unbekannte Werte).

Geprueft: lint, tsc, types:check, 857 Tests (neu: geschlecht.test.ts),
Waechter; Migration in der CI.
2026-10-15 14:30:26 +02:00
e77eaf7fba Erlernter Beruf und zustaendige HR im Report
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m57s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m15s
- Neues freiwilliges Textfeld "Erlernter Beruf": Hiring Wizard (Person,
  Zusammenfassung), Daten aendern, Stammdaten, Wiedereintritt, Export,
  Historie. Gespeichert getrimmt, leer heisst nicht erfasst.
- Reports: Aufteilen nach "Zustaendige HR" mit Gruppe "Nicht zugeordnet"
  und Vorlage "Headcount nach zustaendiger HR".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 11:21:11 +02:00
0e9d2f2296 VL, Bonusanspruch, zustaendige HR und getrennte Suesswaren-Kollektivvertraege
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m39s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m41s
Vertrag: VL (1-8, freiwillig) und Bonusanspruch (Vorgabe Nein; bei Ja eine
Bonusregelung: RL ab 01.01.2027, RL bis 31.12.2026, Aussendienst, Shop)
direkt nach dem Hay-Grade -- im Einstellungsassistenten, im Wiedereintritt
und in "Daten aendern", sichtbar im Reiter Vertrag und im Datenexport.

Stammdaten: zustaendige HR. Auswaehlbar sind alle aktiven HR-Konten; die
Datenbank prueft das. Historie und Audit-Log zeigen den Namen.

Kollektivvertraege: Suessware Arbeiter, Suessware Angestellter, Handel.
collective_agreement wird wie der Hay-Grade eine Domain ueber text. Der
Bestand mit "Suesswaren" wird nach der Beschaeftigtengruppe aufgeteilt
(Angestellte -> Angestellter, Arbeiter:innen und Lehrlinge -> Arbeiter),
ebenso geplante Aenderungen und Entwuerfe.

Die Funktionen werden an einzeiligen Ankern der laufenden Definition
ergaenzt (Einstellung, Wiedereintritt, Daten aendern, Nachtlauf,
Feldkarte). app_feld_karte hatte mit 100 Argumenten die Grenze von
jsonb_build_object erreicht; die neuen Felder stehen in einem zweiten
Objekt.

Gegen eine frische Datenbank geprueft: alle Migrationen samt
Selbstpruefung, zweiter Lauf leer, db/tests/rauchtest.sql und der neue
db/tests/vertragsangaben.sql (9 Schritte) bestanden, Umstellung des
Suesswaren-Bestands nachgestellt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 14:56:23 +02:00
779beb4478 Hay-Grade statt Verwendungsgruppe A--F
A--F stammte aus der Spezifikation, nicht vom Kunden: sechs erfundene Stufen
mit erfundenen Beschreibungen. Der Kunde bewertet nach Hay und hat die Liste
geschickt -- 13 Stufen plus einen Generic Grade.

Dieselbe Spalte fuellt im Cornerstone-Extrakt die Grade ID. Solange dort A--F
steht, ist die Datei in jeder Zeile falsch, ohne dass es beim Erzeugen
auffaellt: das Zielsystem kennt diese Kennungen nicht.

Der Typ heisst weiter paygrade_type, ist aber jetzt eine Domain ueber text mit
CHECK statt eines Aufzaehlungstyps. Ein Enum laesst sich nicht umschreiben --
Werte entfernen geht gar nicht, und add value darf im selben Vorgang, der den
neuen Wert schreibt, nicht benutzt werden. Wichtiger: die rund zehn
SQL-Funktionen, die den Wert nach paygrade_type umwandeln, bleiben unveraendert
gueltig. Jede von ihnen neu zu erzeugen hiesse, zehnmal die Gelegenheit zu
haben, aus einer veralteten Vorlage zu kopieren.

Zwei Funktionen muessen doch angefasst werden, beide per Punktaenderung an der
laufenden Definition statt per Kopie aus einer Datei: der Vorgabewert B in
hire_employee und die Beschriftung im Protokoll von promote_employee.

Der Bestand bekommt den Generic Grade. Aus A--F liesse sich kein Hay-Grade
ableiten: andere Einteilung, andere Anzahl. Geraten saehe im Extrakt genauso
aus wie erhoben.
2026-09-28 11:13:41 +02:00
f17d299045 Lehrling, and a field that stops being named after its values
Some checks failed
CI / Lint, Typen, Tests, Build (push) Successful in 10m51s
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
worker_type had two values because the field was named after them:
"Angestellte:r / Arbeiter:in". Lehrlinge are the third social-insurance
category in Austria; until now they were filed as one of the other two,
which they are not -- and which skewed every report grouped by this
column by exactly those people.

Adding the value is one line. The label was the work: the field was
called after its two values in six places, and each of them becomes
wrong with a third. They now read "Beschaeftigtengruppe", the name the
import has used all along.

One label deliberately keeps the old wording: app_feld_karte() in the
database. That string is not a caption there but a key -- stored rows in
employee_history and pending_changes carry it, and the map is how
reverting or correcting a history entry finds the field again. Renaming
it without rewriting those rows would make every older entry for this
field unrevertable, and nobody would notice until they tried.

The migration's assertion reads pg_enum rather than comparing against
'Lehrling'::worker_type: migrations run inside a transaction, and
Postgres refuses to use a freshly added enum value in the transaction
that added it. This has not been run against a live database here -- the
CI migration job is the first real execution.

Three hand-kept lists of the same enum (reports, import, the form) now
have a test holding them to one another, each mutation-checked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 17:28:49 +02:00
6681dcda77 Flag people who cannot simply be dismissed
Works council members, expectant mothers, parents on leave, registered
disabled employees, apprentices — each has its own rules that come
before a dismissal. The tool does not judge whether one is lawful, but
it must not stay quiet about it either, and looking it up on the
contract tab is exactly the step that gets skipped under time pressure.

So: a checkbox, an optional end date, and a red warning at the top of
the termination panel naming the date — or saying plainly that no end
was recorded. It shows for a no-show too; the protection runs from the
start of the contract, not the first day worked.

The date is optional on purpose. A works council mandate has a known
end, a pregnancy does not, and a mandatory field would force an invented
number. A constraint says only what cannot be: an end date without the
flag, which would be a leftover nobody could interpret.

The field goes the whole way through — hire, data change, contract
sheet, export, report criteria (as a yes/no and as a date range), and
the import. A field that exists in one screen and not the next is how
people stop trusting the numbers.

Terminating is now offered for planned entries as well, labelled "Nicht
angetreten", with No Show preselected. Without it a person who never
turned up stayed a planned entry forever, since nothing else can end
one.

One finding worth recording: tsc has been reporting success on a broken
program. A generated file under .next got corrupted when a build ran
against a live dev server, and its syntax errors suppressed semantic
checking everywhere else — two genuine type errors in this change went
unreported until I typechecked with .next excluded. The file is removed
and the ordinary typecheck is meaningful again.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 12:44:00 +02:00
a3fac47f47 Give each characteristic its own line, and name the car
The contract sheet had one field, "Merkmale", holding whatever applied,
comma-separated — and a dash when nothing did. Two problems in one row.
A dash cannot distinguish "has no company car" from "nobody ever
answered the question", and the entry read "Dienstwagen" without saying
which kind, which is the thing worth knowing since electric vehicles are
tracked separately.

Betriebsrat, Dienstwagen, laterale Führung and C-Level are now four
lines like every other line on the sheet, each with Ja or Nein. The
company car shows its drivetrain instead: E-KFZ or Verbrenner.

That label existed in three places — the dropdown, the hire summary and
now here. It lives in lib/dienstwagen.ts, so the same car cannot end up
named differently depending on which screen you are looking at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 07:06:58 +02:00
c23df08648 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>
2026-08-11 21:47:04 +02:00
9d754359e0 Enter the personnel number, tell the two kinds of company car apart, record who to call
Three requests from use, one of which changes the schema's mind about
something.

The personnel number is no longer issued. It was GENERATED ALWAYS AS
IDENTITY, which refuses a supplied value outright — but it has to match Loga
and Interflex, and a number this application invents is unknown there, so the
same person ends up with two. Identity dropped, entered everywhere instead:
in the wizard, in the import, and validated against a duplicate with a
message that names the number.

Worth stating plainly: the column had no unique constraint. The identity
prevented collisions as a side effect, and once the value comes from outside
that side effect is gone. The constraint is the point now, and it was
missing.

Company cars distinguish Verbrenner from Elektro, tied to has_dienstwagen by
a CHECK so "E-KFZ" cannot appear against someone without a car. The list
filters on it — with, without, only electric, only combustion — which is the
question the report was really about; it was answerable before only through
an export and manual work.

Emergency contact is name, phone and relationship. Relationship stays free
text: the examples given — Gattin/Gatte, Schwester/Bruder, Freund — are not
a list that closes without telling someone their arrangement does not count.
Name and phone are all-or-nothing, in the database and in both forms: a name
without a number helps nobody, a number without a name does not say who
answers.

Two mistakes of mine on the way, both caught by checks I had written into
the migrations rather than by me:

  - The first CHECK on the car type would have permitted exactly the case it
    was written against. `art in (…)` yields NULL rather than false when the
    column is null, and a CHECK counts NULL as satisfied. It needs an
    explicit `is not null` in front.
  - The constraint was added before the backfill, so it rejected every
    existing row with a car.

Existing cars are recorded as Verbrenner, which is an assumption — but a
visible one: "Elektro" appears nowhere nobody confirmed it.

hire_employee and change_employee_data both had to learn the new columns.
They name their columns one by one, and what is missing there is dropped in
silence — the interface would have collected the fields and thrown them
away, which is what happened to the email address this morning.

Verified against the live database, all rolled back: a hire without a number
is refused, a duplicate is refused naming it, a freely chosen one goes
through; E-KFZ plus contact arrive intact; a contact without a phone is
refused. A change records both, with before and after in the audit detail.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 21:27:00 +02:00
79f0e19bf8 Org assignment history, mobile support, and a correctness pass
Data model
- employee_assignments records org placement over time (valid_from/valid_to),
  written by a trigger on `employees` rather than inside each RPC: ~70
  `update employees` statements spread over fifteen migrations mean per-call
  bookkeeping would miss paths today and again with every future RPC. A
  partial unique index enforces the one-open-interval invariant the trigger
  relies on when closing the current row.
- The Organigramm gains a Stichtag (default today). Membership comes from
  entry/exit/karenz, past placement from the new history, future placement
  projected from pending_org_changes. Placements predating the migration are
  backfilled with today's values and flagged as such in the UI, since
  employee_history only ever stored free text and cannot be reconstructed.

Correctness
- Reports and exports silently truncated at PostgREST's 1000-row cap
  (db.max_rows); employee_history is already past it at ~800 staff. Every
  whole-table read now pages explicitly.
- XLSX date cells were a day early: ExcelJS converts a Date to an Excel
  serial straight off getTime(), so a Date built at local midnight lands on
  the previous day's serial in any positive-offset zone.
- Date handling is pinned to Europe/Vienna throughout, and date-only strings
  are formatted without a Date round-trip. The dashboard's YTD window was
  built by round-tripping a local Date through toISOString(), which shifted
  it a day early and dropped 31 December entirely.
- Export routes parsed measure/group/split/eventType with unchecked `as`
  casts, so an unknown value reached column headers as `undefined` and the
  Content-Disposition filename. Parsed against the label maps now, with the
  filename slugged as a backstop.
- toXlsx keyed columns by header text, silently dropping the second of any
  two columns sharing a name — split columns take their header from data.
- The org chart tree walks had no cycle guard; nothing in the schema forbids
  a manager_id cycle, and one would hang the tab rather than misreport.
- The login page reflected ?error= verbatim, letting anyone put arbitrary
  text on the real sign-in screen; messages are looked up by code now.
- React Flow needs elementsSelectable on, or it sets pointer-events:none on
  the whole node and the expand control stops responding.

UI
- Mobile: the shell was unusable below lg — a fixed 236px margin pushed
  content off-screen with no mobile navigation at all. The sidebar is now a
  drawer, dvh replaces vh, safe-area insets are honoured, inputs are 16px so
  iOS stops zooming on focus, and form grids stack.
- Org chart nodes redesigned: per-kind accent stripes and icons, vacant
  roles called out, expand control moved to the bottom edge carrying the
  child count.
- Pagination is windowed; it previously rendered one link per page (54 for
  the employee list, unbounded for the audit log).
- Positions page reduced to open positions with a single "Besetzen" action.
- The employee Organisation tab links into the org chart focused on that
  person, reusing the chart's existing search-match highlighting.

Also included, uncommitted until now
- Dependants, HR notes, academic titles, split address fields, position
  validity and role/employment fields, with their migrations and UI.
- Docker/compose deployment setup, data-model and security-review docs.
2026-07-24 23:38:10 +02:00
901c5c426e Consolidation pass: HR-only access, effective-dated mutations, data integrity guards, test suite
Reworks the app from a two-role (hr_admin/manager) model to a single
HR-only role gated by profiles.is_active, fixes transfer/promote/karenz/
reorg RPCs to actually defer future-dated changes via a new
pending_org_changes table instead of writing them immediately (applied
by a daily Vercel Cron route), makes reorg undo append-only instead of
deleting history, adds Karenz-return and history-date integrity guards,
deprecates the salary column, and adds explicit schema grants + perf
indexes needed to run against a fresh (non-hosted) Postgres instance.

Adds vitest unit + integration test suites (the latter against a real
local Supabase instance) covering all of the above, plus lint/typecheck/
build wiring (`npm run check`).
2026-07-14 20:32:20 +02:00
f91a69147e Phase 3: Hire wizard, draft resume, and two real SQL bugfixes
- components/hire/: 4-step Hire Wizard (Person/Position/Vertrag/
  Zusammenfassung) matching sec4.4, with a HireWizardProvider context so it
  can be opened both from the global "+ Neueinstellung" button and from a
  "Fortsetzen" link on a saved draft.
- actions/hireDrafts.ts: save/delete hire_drafts (owner-scoped RLS already
  in place from Phase 1). Dashboard now shows the "Entwuerfe" card the
  Phase 1 plan deferred, since the wizard it depends on now exists.
- lib/positions.ts: shared open-positions loader (position number, org
  breadcrumb, resolved manager name) used by both the wizard and (later)
  the Positions page.

Two real bugs found via live testing and fixed in supabase/functions.sql:
1. hire_employee/rehire_employee: a two-branch CASE returning bare string
   literals defaults to `text`, not the target enum, so `status = case
   when ... then 'Geplant' else 'Aktiv' end` failed against the
   employment_status column. Fixed with an explicit ::employment_status
   cast on the whole CASE expression.
2. Postgres precedence gotcha: ->> and || sit at the *same* precedence
   tier and left-associate, so `payload->>'first_name' || ' ' ||
   payload->>'last_name'` does not group the way it reads - it tries to
   apply ->> to an intermediate text value and fails with "operator does
   not exist: text ->> unknown". Fixed by parenthesizing every ->>'...'
   expression that participates in a || chain.

Also fixed: hire_employee referenced v_position.title outside the branch
that assigns v_position, raising "record not assigned" whenever a hire
wasn't tied to a position_id; extracted a v_job_title variable instead.

Verified live end-to-end: wizard search -> select position -> submit
creates the employee, closes the position, and writes matching
employee_history + audit_log rows atomically.
2026-07-13 22:37:59 +02:00