Let the export select on everything the data model holds

The export offered four criteria — unit, location, status, employment
type — while the employee record carries around twenty selectable
attributes. Anything else had to be filtered by hand in Excel afterwards,
which is how a payroll hand-off stops matching the application it came
from.

All of them are now filters: contract type, blue/white collar,
collective agreement, paygrade, internal/external, gender, company car
and its drivetrain, works council, lateral leadership, C-level, type of
long-term absence, weekday worked, dependents on file, and open ranges
for entry, exit, birth date and weekly hours. The unit filter covers
every level rather than only divisions, so a single department can be
selected without going the long way round.

They live in one table in lib/report-criteria.ts, which the filter panel
builds itself from, the parser validates against, and the query turns
into conditions. A new criterion is one entry there and nothing else —
and it cannot end up working in the report while being silently ignored
by the export.

The two export links and the saved-report config now carry the query
string through as it stands instead of listing the parameters they know
about. That enumeration was the actual defect: adding a filter meant
remembering three separate places, and forgetting one produced an export
that quietly disagreed with the figure on screen.

Validation is not housekeeping here. These values reach SQL comparisons
and the download filename, i.e. a Content-Disposition header; what is not
in the list does not get through.

The company car dropdown leaves the employee list. It is one of twenty
equals under Berichte now, where the selection can also be exported —
which was the point of asking in the first place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 12:40:47 +02:00
parent f14f1cb8df
commit 0b8f874fa5
10 changed files with 586 additions and 102 deletions

View File

@@ -104,22 +104,12 @@ export function EmployeeFilters({ units, depthOf, locations }: EmployeeFiltersPr
</option>
))}
</select>
{/* „Wer hat einen Dienstwagen" ist eine wiederkehrende Frage — als
Filter beantwortet sie sich mit einem Klick, statt über einen
Export mit Nachbearbeitung. E-KFZ getrennt, weil das die Frage
hinter der Frage ist. */}
<select
aria-label="Nach Dienstwagen filtern"
defaultValue={searchParams.get("dienstwagen") ?? ""}
onChange={(e) => updateParam("dienstwagen", e.target.value)}
className={FILTER_SELECT_CLASS}
>
<option value="">Dienstwagen: alle</option>
<option value="ja">Mit Dienstwagen</option>
<option value="elektro">Nur E-KFZ</option>
<option value="verbrenner">Nur Verbrenner</option>
<option value="nein">Ohne Dienstwagen</option>
</select>
{/* Der Dienstwagen stand hier einmal als eigenes Auswahlfeld. Er ist
jetzt eines von rund zwanzig Kriterien unter Berichte, zusammen mit
Vertragsart, Kollektivvertrag, Eintrittszeitraum und dem Rest —
dort lässt sich die Auswahl auch exportieren, was der eigentliche
Zweck der Frage war. In dieser Leiste, die vor allem zum Suchen da
ist, wäre er ein Sonderfall unter vielen gleichrangigen. */}
</div>
);
}