Modulare Startseite: Kartenraster, eigene Anordnung je Benutzer, Auswertungen
Die Uebersicht war fest verdrahtet und fuer alle gleich. Jetzt besteht sie aus Karten in einem 12-Spalten-Raster, die sich ziehen, in der Groesse aendern und einrasten lassen (react-grid-layout). "Anordnen" schaltet das frei, gespeichert wird ausdruecklich - Probieren bleibt folgenlos. Anordnung: - Neue Tabelle dashboard_layouts; user_id = NULL ist die Admin-Vorgabe. - Jeder Benutzer hat seine eigene Anordnung. Admins speichern eine Vorgabe fuer alle und koennen sie ueber die Einstellung dashboard_enforced verbindlich machen; dann lehnt das Backend das Speichern eigener Anordnungen ab. - "Auf Vorgabe zuruecksetzen" verwirft die persoenliche Anordnung. 15 Karten (Verzeichnis web/src/dashboard/cards.jsx, neue Karte = ein Eintrag): Schnellzugriff, Status, Artikelzahl, Artikeleinheiten, Bald ablaufend, Abgelaufen, Einkaufsliste, letzte Bewegungen sowie sechs Auswertungen (Ablauf-Ring, Kategorien-Ring, Kategorien nach Zustand, Bestandsverlauf, Verlauf eines Artikels, Ein-/Auslagerungen). Diagramme als eigene SVG-Komponenten statt Diagramm-Paket: - Zustandsfarben (ok/bald/abgelaufen) sind Statusangaben aus den Tokens und stehen nie ohne Beschriftung; Kategorien nutzen eine gepruefte Farbreihe in fester Ordnung, ab sieben Kategorien wird zu "Andere" gebuendelt. - Eine Werteachse, duenne Marken, zurueckhaltendes Gitter, Fadenkreuz mit Kurzinfo. Hell und Dunkel haben eigene Farbstufen. Mengen durchgehend in Artikeleinheiten (Glaeser, Packungen, Stueck): Gramm und Stueck lassen sich nicht addieren, Gebinde schon. Der bisher dreifach vorhandene Helfer liegt jetzt einmal in services/conversion.py::article_unit. Der Verlauf wird rueckwaerts vom heutigen Bestand aus den Bewegungen rekonstruiert. Bekannte Ungenauigkeit, im Code und in der Roadmap vermerkt: Die Umrechnung nutzt die heutige Packungsgroesse. Geprueft: "npm run build" laeuft durch. Die neuen pytest-Tests (backend/tests/test_dashboard.py) konnten hier nicht laufen - auf diesem Rechner ist kein Python installiert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -466,6 +466,130 @@ td select { width: auto; min-width: 0; max-width: 100%; }
|
||||
.stat .stat-label { font-size: 0.75rem; color: var(--muted); font-weight: 560; display: flex; align-items: center; gap: 6px; }
|
||||
.stat .stat-value { font-size: 1.6rem; font-weight: 680; letter-spacing: -0.02em; margin-top: 6px; }
|
||||
|
||||
/* ---------- Startseite: Raster ----------
|
||||
react-grid-layout bringt eigenes CSS mit. Statt es einzubinden, setzen wir
|
||||
die wenigen noetigen Regeln selbst - so sehen die Karten aus wie alle
|
||||
anderen und die Anfasser folgen unseren Tokens. */
|
||||
.dash-grid { position: relative; }
|
||||
.react-grid-item { transition: transform 160ms ease, width 160ms ease, height 160ms ease; }
|
||||
.react-grid-item.react-draggable-dragging,
|
||||
.react-grid-item.resizing { transition: none; z-index: 5; }
|
||||
/* Platzhalter, der beim Ziehen anzeigt, wo die Karte landet. */
|
||||
.react-grid-placeholder {
|
||||
background: var(--accent-soft);
|
||||
border: 1px dashed var(--accent);
|
||||
border-radius: var(--radius);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.dash-card {
|
||||
margin-bottom: 0; /* Abstand macht das Raster */
|
||||
display: flex; flex-direction: column;
|
||||
overflow: hidden; padding: 0;
|
||||
}
|
||||
.dash-card-head {
|
||||
display: flex; align-items: center; gap: var(--sp-2);
|
||||
padding: var(--sp-3) var(--sp-4);
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.dash-card-head h2 { margin: 0; flex: 1; font-size: 0.9rem; }
|
||||
.dash-card-head .icon { color: var(--muted); }
|
||||
.dash-card-body { flex: 1; min-height: 0; overflow: auto; padding: var(--sp-4); }
|
||||
|
||||
/* Anfasser nur im Bearbeitungsmodus - sonst stoert er beim Lesen. */
|
||||
.dash-grid .react-resizable-handle { display: none; }
|
||||
.dash-grid.editing .dash-card-head { cursor: grab; }
|
||||
.dash-grid.editing .dash-card { outline: 1px dashed var(--border-strong); }
|
||||
.dash-grid.editing .react-resizable-handle {
|
||||
display: block; position: absolute; right: 3px; bottom: 3px;
|
||||
width: 14px; height: 14px; cursor: se-resize;
|
||||
border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
|
||||
border-bottom-right-radius: 3px; opacity: 0.7;
|
||||
}
|
||||
|
||||
.dash-foot {
|
||||
display: flex; align-items: center; gap: var(--sp-3);
|
||||
flex-wrap: wrap; margin-top: var(--sp-5);
|
||||
padding-top: var(--sp-4); border-top: 1px solid var(--border);
|
||||
}
|
||||
.enforce-toggle {
|
||||
display: flex; align-items: center; gap: var(--sp-2);
|
||||
margin: 0; font-size: 0.85rem; color: var(--muted); font-weight: 500;
|
||||
}
|
||||
.enforce-toggle input { width: auto; margin: 0; accent-color: var(--accent); }
|
||||
|
||||
/* Menue "Karte hinzufuegen" */
|
||||
.menu-wrap { position: relative; }
|
||||
.menu {
|
||||
position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
|
||||
list-style: none; margin: 0; padding: var(--sp-2);
|
||||
min-width: 240px; max-height: 320px; overflow: auto;
|
||||
background: var(--surface); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); box-shadow: 0 6px 20px rgba(16, 24, 40, 0.14);
|
||||
}
|
||||
.menu li { padding: 0; }
|
||||
.menu .link-btn {
|
||||
display: flex; align-items: center; gap: var(--sp-2);
|
||||
width: 100%; padding: 7px var(--sp-2); border-radius: var(--radius-sm);
|
||||
color: var(--text);
|
||||
}
|
||||
.menu .link-btn:hover { background: var(--surface-2); text-decoration: none; }
|
||||
|
||||
/* ---------- Startseite: Kartentypen ---------- */
|
||||
.card-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
|
||||
.card-stack { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; }
|
||||
|
||||
.kpi-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
|
||||
.kpi { flex: 1 1 120px; min-width: 0; }
|
||||
.kpi-label {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
font-size: 0.75rem; color: var(--muted); font-weight: 560;
|
||||
}
|
||||
.kpi-value { font-size: 1.7rem; font-weight: 680; letter-spacing: -0.02em; margin-top: 2px; }
|
||||
.kpi.warn .kpi-value { color: var(--warn); }
|
||||
.kpi.danger .kpi-value { color: var(--danger); }
|
||||
|
||||
/* ---------- Diagramme ---------- */
|
||||
.chart-donut { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
|
||||
.donut-svg { width: 160px; height: 160px; flex: 0 0 auto; }
|
||||
.donut-svg circle { transition: stroke-width 120ms ease; cursor: default; }
|
||||
.donut-value { font-size: 20px; font-weight: 680; fill: var(--text); }
|
||||
.donut-label { font-size: 10px; fill: var(--muted); }
|
||||
|
||||
.chart-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 140px; }
|
||||
.chart-legend li {
|
||||
display: flex; align-items: center; gap: var(--sp-2);
|
||||
padding: 3px 0; font-size: 0.82rem;
|
||||
}
|
||||
.chart-legend.inline { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-3); }
|
||||
.chart-legend.inline li { padding: 0; }
|
||||
.chart-legend .legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.chart-legend .legend-value { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
|
||||
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
|
||||
|
||||
.chart-bars { display: flex; flex-direction: column; gap: 7px; }
|
||||
.bar-row { display: grid; grid-template-columns: minmax(80px, 26%) 1fr auto; align-items: center; gap: var(--sp-3); }
|
||||
.bar-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.bar-track { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
|
||||
/* 2px Luecke in Flaechenfarbe: trennt angrenzende Abschnitte zuverlaessig. */
|
||||
.bar-part + .bar-part { border-left: 2px solid var(--surface); }
|
||||
.bar-total { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.chart-hint { font-size: 0.8rem; color: var(--muted); margin-top: var(--sp-2); }
|
||||
|
||||
.chart-line { width: 100%; }
|
||||
.line-plot { position: relative; }
|
||||
.line-plot svg { display: block; }
|
||||
.line-tooltip {
|
||||
position: absolute; top: 4px; transform: translateX(-50%);
|
||||
background: var(--surface); border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-sm); padding: 6px 9px; pointer-events: none;
|
||||
box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12); font-size: 0.8rem; white-space: nowrap;
|
||||
}
|
||||
.line-tooltip .tip-date { color: var(--muted); font-size: 0.72rem; margin-bottom: 3px; }
|
||||
.line-tooltip .tip-row { display: flex; align-items: center; gap: 6px; }
|
||||
.line-tooltip .tip-name { color: var(--muted); }
|
||||
|
||||
/* ---------- Login ---------- */
|
||||
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-4); }
|
||||
.login-card { width: 100%; max-width: 360px; }
|
||||
|
||||
Reference in New Issue
Block a user