Web: Gegenstaende-Liste - Spalte/Filter "Verwaltung"
Neue Spalte "Verwaltung" (nur in der Gegenstaende-Liste): Menge je Lagerort / Einzelstuecke / Verbrauchsgegenstand - sortier- und filterbar wie die anderen Spalten. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,12 @@ function fmtDateTime(iso) {
|
||||
day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit",
|
||||
});
|
||||
}
|
||||
// Verwaltungsart eines Gegenstands (nur für die Gegenstände-Liste sinnvoll).
|
||||
function verwaltungLabel(p) {
|
||||
if (p.individual) return "Einzelstücke";
|
||||
if (p.bulk) return "Verbrauchsgegenstand";
|
||||
return "Menge je Lagerort";
|
||||
}
|
||||
|
||||
export default function Products({ fixedType = null }) {
|
||||
const { isAdmin } = useAuth();
|
||||
@@ -80,6 +86,12 @@ export default function Products({ fixedType = null }) {
|
||||
filterOptionLabel: (v) => (v === "" ? "(Leere)" : <CategoryPathLabel parts={pathParts(v)} />),
|
||||
sortValue: (p) => catInfo.get(p.category_id)?.path || p.category_name || "",
|
||||
render: (p) => <CategoryPathLabel parts={catInfo.get(p.category_id)?.parts} fallback={p.category_name || "–"} /> },
|
||||
// Nur in der Gegenstände-Liste: Menge je Lagerort / Einzelstücke / Verbrauchsgegenstand.
|
||||
activeTyp === "object" && { key: "verwaltung", header: "Verwaltung", label: "Verwaltung", width: 190,
|
||||
filterText: (p) => verwaltungLabel(p),
|
||||
filterValues: (p) => [verwaltungLabel(p)],
|
||||
sortValue: (p) => verwaltungLabel(p),
|
||||
render: (p) => <span className="muted">{verwaltungLabel(p)}</span> },
|
||||
{ key: "unit", header: "Einheit", width: 200, filterText: einheitText,
|
||||
render: einheitText },
|
||||
{ key: "stock", header: "Bestand", width: 130, align: "num",
|
||||
@@ -106,7 +118,7 @@ export default function Products({ fixedType = null }) {
|
||||
render: (p) => <span className="muted nowrap">{fmtDateTime(p.updated_at)}</span> },
|
||||
{ key: "details", header: "", label: "Details", fixed: true, width: 84, align: "num",
|
||||
render: (p) => <Link to={`/products/${p.id}`}>Details</Link> },
|
||||
];
|
||||
].filter(Boolean);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user