diff --git a/frontend/src/tools/bestellungen.jsx b/frontend/src/tools/bestellungen.jsx index 8d4edaf..0510f65 100644 --- a/frontend/src/tools/bestellungen.jsx +++ b/frontend/src/tools/bestellungen.jsx @@ -147,8 +147,8 @@ function BestellungDetail({ id, toast, onBack }) { {/* Bezahlt-Zeile – immer eigene Card unter dem Header */} {order && !editMode && (
- {order.bezahlt && ( + {!!order.bezahlt && (
🔒 Bezahlte Bestellungen können nicht mehr bearbeitet werden.
@@ -207,7 +207,7 @@ function BestellungDetail({ id, toast, onBack }) { <> {(order.bemerkung || order.bezahlt) && (
- {order.bezahlt && ( + {!!order.bezahlt && (
💜 Bezahlt am {new Date(order.bezahlt_am).toLocaleDateString('de-DE',{day:'2-digit',month:'2-digit',year:'numeric'})}
@@ -240,7 +240,7 @@ function BestellungDetail({ id, toast, onBack }) {
{item.calc_name}
- cycleItemStatus(item)} small/> + cycleItemStatus(item)} small/> {!order.bezahlt && (
{/* Status pro Stück */} -
+
STATUS PRO STÜCK
{[ @@ -287,18 +287,34 @@ function BestellungDetail({ id, toast, onBack }) { ['in_arbeit', 'In Arbeit', '#4ecdc4', item.qty_in_arbeit||0], ['fertig', 'Fertig', '#6bcb77', item.qty_fertig||0], ].map(([key, label, color, qty]) => { - const others = item.stueckzahl - qty; + const w = item.qty_warteliste||0, a = item.qty_in_arbeit||0, f = item.qty_fertig||0; + // + nimmt aus Warteliste (oder In Arbeit), - gibt zurück an Warteliste + const canInc = key==='warteliste' ? false : (key==='in_arbeit' ? w>0 : w>0||a>0); + const canDec = qty > 0; + const handleInc = () => { + if (!canInc) return; + let nw=w,na=a,nf=f; + if (key==='in_arbeit') { na++; nw=Math.max(0,nw-1); } + if (key==='fertig') { nf++; if(nw>0) nw--; else na=Math.max(0,na-1); } + updateItem(item.id,{qty_warteliste:nw,qty_in_arbeit:na,qty_fertig:nf}); + }; + const handleDec = () => { + if (!canDec) return; + let nw=w,na=a,nf=f; + if (key==='warteliste') { nw--; } + if (key==='in_arbeit') { na--; nw++; } + if (key==='fertig') { nf--; nw++; } + updateItem(item.id,{qty_warteliste:nw,qty_in_arbeit:na,qty_fertig:nf}); + }; return (
{label.toUpperCase()}
- + {qty} - +
); @@ -531,7 +547,7 @@ export default function Bestellungen({ toast, mobile }) {
- {order.bezahlt && ( + {!!order.bezahlt && ( 💜 Bezahlt