diff --git a/web/src/dashboard/cards.jsx b/web/src/dashboard/cards.jsx
index a04a78f..58ef4ba 100644
--- a/web/src/dashboard/cards.jsx
+++ b/web/src/dashboard/cards.jsx
@@ -312,6 +312,7 @@ function KarteAblauf({ modus = "alle" }) {
*/
function KarteEinkaufsliste({ props: karteProps }) {
const ortId = karteProps?.location_id || "";
+ const [erledigt, setErledigt] = useState({}); // abgehakte Zeilen (nur in dieser Sitzung)
const { daten, fehler } = useDaten(async () => {
const [produkte, gruppen, orte] = await Promise.all([
api.shoppingList(), api.groupShoppingList(), api.shoppingByLocation(),
@@ -327,49 +328,67 @@ function KarteEinkaufsliste({ props: karteProps }) {
const orteLeer = orte.every((o) => !o.products.length && !o.groups.length);
if (gesamtLeer && orteLeer) return
Alle Mindestbestände erreicht.
;
- // Ein Abschnitt (Gesamt oder ein Ort). Die Produkt-Formatierung kommt herein,
- // weil Gesamt-Produkte Gebinde/Basiseinheit tragen, je-Ort-Bedarfe aber schon
- // eine fertige Einheit (unit_label).
- const abschnitt = (gruppen, produkte, prodWert) => (
-
-
- | Bedarf | Bestand | Fehlt |
-
- {gruppen.map((it) => (
-
- | Gruppe {it.name} |
- {fmt(it.stock)} {it.unit_name} |
- {fmt(it.deficit)} {it.unit_name} |
-
- ))}
- {produkte.map((it) => (
-
- | {it.name} |
- {prodWert(it, "stock")} |
- {prodWert(it, "deficit")} |
-
- ))}
-
-
-
+ const abhaken = (key, val) => setErledigt((e) => ({ ...e, [key]: val }));
+
+ // Ein Abschnitt (Gesamt oder ein Ort) als abhakbare Liste – wie die volle Seite.
+ // `prefix` macht die Schlüssel über die Abschnitte hinweg eindeutig, `prodInfo`
+ // formatiert die Produktzeile (Gesamt trägt Gebinde/Basiseinheit, je-Ort schon
+ // eine fertige Einheit).
+ const abschnitt = (gruppen, produkte, prefix, prodInfo) => (
+
+ );
+ const gesamtInfo = (it) => (
+ <>fehlt {amountText(it.deficit, it.package_size, it.base_unit)}{" "}
+ (Bestand {amountText(it.stock, it.package_size, it.base_unit)})>
+ );
+ const ortInfo = (it) => (
+ <>fehlt {fmt(it.deficit)} {it.unit_label}{" "}
+ (Bestand {fmt(it.stock)} / min {fmt(it.min_stock)})>
);
- const gesamtProd = (it, feld) => amountText(it[feld], it.package_size, it.base_unit);
- const ortProd = (it, feld) => `${fmt(it[feld])} ${it.unit_label}`;
return (
{!gesamtLeer && (
-
Gesamt
- {abschnitt(daten.gruppen, daten.produkte, gesamtProd)}
+
Gesamt
+ {abschnitt(daten.gruppen, daten.produkte, "", gesamtInfo)}
)}
{orte.map((o) => ((o.products.length || o.groups.length) ? (
-
+
{o.location_name}
- {abschnitt(o.groups, o.products, ortProd)}
+ {abschnitt(o.groups, o.products, `l${o.location_id}`, ortInfo)}
) : null))}