fix: Gesamt-Gewinn, kurze Badges (W/A/F/B), Stats sofort beim Mount laden

This commit is contained in:
2026-06-16 15:59:08 +02:00
parent 30ecc89ba6
commit f35629cc96

View File

@@ -726,7 +726,9 @@ function BestellStats() {
if (loaded) return;
api('/dashboard/stats').then(s => { setStats(s); setLoaded(true); }).catch(() => {});
};
const toggle = () => { setOpen(v => !v); if (!open) load(); };
// Sofort beim Mount laden damit Badges im zugeklappten Zustand sichtbar sind
useEffect(() => { load(); }, []);
const toggle = () => { setOpen(v => !v); };
const Row = ({ label, val, color='rgba(255,255,255,0.85)', sub }) => (
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',
@@ -756,10 +758,10 @@ function BestellStats() {
{/* Status-Badges im zugeklappten Zustand */}
{!open && stats && (
<div style={{display:'flex',gap:4,flexWrap:'wrap',flex:1}}>
<Badge val={stats.byStatus.warteliste||0} color="#ffe66d" label="Warteliste"/>
<Badge val={stats.byStatus.in_arbeit||0} color="#4ecdc4" label="In Arbeit"/>
<Badge val={stats.byStatus.fertig||0} color="#6bcb77" label="Fertig"/>
<Badge val={stats.bezahltOrders} color="#c084fc" label="Bezahlt"/>
<Badge val={stats.byStatus.warteliste||0} color="#ffe66d" label="W"/>
<Badge val={stats.byStatus.in_arbeit||0} color="#4ecdc4" label="A"/>
<Badge val={stats.byStatus.fertig||0} color="#6bcb77" label="F"/>
<Badge val={stats.bezahltOrders} color="#c084fc" label="B"/>
</div>
)}
<span style={{color:'rgba(255,255,255,0.3)',fontSize:11,marginLeft:'auto',flexShrink:0,
@@ -806,7 +808,7 @@ function BestellStats() {
sub="in Arbeit/Fertig"
/>
<Row
label="Gesamt-Potenzial"
label="Gesamt-Gewinn"
val={`${((stats.totalProfit??0)+(stats.offeneProfit??0)).toFixed(2)}`}
color="rgba(255,255,255,0.5)"
sub="bezahlt + offen"