Bestückungs-Pflege: Fach-Sidebar + Verwaltung linksbündig statt zentriert
ObjektPositionenPanel: Fach-Sidebar (Vorlagen-Feature "feste Fächer-Liste") links, damit die Bestückung übersichtlich bleibt und auch Dritte (Vertretung ohne die Kontrollperson) sehen, wo welches Material im Rucksack hingehört. Gruppierungslogik aus KontrollPage in gemeinsames Util (utils/fachGruppierung) ausgelagert, da jetzt zweimal gebraucht. .page-wide: margin:0 statt zentriert (Nutzer-Vorgabe: bei 1200px sonst viel verschenkter Platz links/rechts auf breiten Monitoren). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
This commit is contained in:
@@ -2,35 +2,8 @@ import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
import { NachfuellDialog } from "./kontrolle/NachfuellDialog";
|
||||
import { PositionCard } from "./kontrolle/PositionCard";
|
||||
import type { PositionZustand } from "./kontrolle/types";
|
||||
import { useKontrolle } from "./kontrolle/useKontrolle";
|
||||
|
||||
const OHNE_FACH = "Ohne Fach";
|
||||
|
||||
// Gruppierung nach Fach (Vorlagen-Feature "feste Fächer-Liste je Objekttyp"):
|
||||
// Reihenfolge folgt dem ersten Auftreten in der Positionsliste (die wiederum
|
||||
// die Vorlagen-Reihenfolge widerspiegelt), "Ohne Fach" immer zuletzt - so
|
||||
// bleibt die Erfassung nah am Regal/Fahrzeug-Layout statt alphabetisch zu
|
||||
// springen.
|
||||
function gruppiereNachFach(positionen: PositionZustand[]): [string, PositionZustand[]][] {
|
||||
const gruppen = new Map<string, PositionZustand[]>();
|
||||
for (const zustand of positionen) {
|
||||
const fach = zustand.fach ?? OHNE_FACH;
|
||||
const liste = gruppen.get(fach);
|
||||
if (liste) {
|
||||
liste.push(zustand);
|
||||
} else {
|
||||
gruppen.set(fach, [zustand]);
|
||||
}
|
||||
}
|
||||
const eintraege = [...gruppen.entries()];
|
||||
eintraege.sort(([a], [b]) => {
|
||||
if (a === OHNE_FACH) return 1;
|
||||
if (b === OHNE_FACH) return -1;
|
||||
return 0;
|
||||
});
|
||||
return eintraege;
|
||||
}
|
||||
import { gruppiereNachFach, OHNE_FACH } from "../utils/fachGruppierung";
|
||||
|
||||
export function KontrollPage() {
|
||||
const { objektId } = useParams<{ objektId: string }>();
|
||||
@@ -55,7 +28,7 @@ export function KontrollPage() {
|
||||
nachfuellDialogSchliessen,
|
||||
} = useKontrolle(objektId);
|
||||
|
||||
const fachGruppen = gruppiereNachFach(positionen);
|
||||
const fachGruppen = gruppiereNachFach(positionen, (zustand) => zustand.fach);
|
||||
const nurOhneFach = fachGruppen.length === 1 && fachGruppen[0][0] === OHNE_FACH;
|
||||
|
||||
async function handleAbschliessen() {
|
||||
|
||||
Reference in New Issue
Block a user