fix: Gesamt-Gewinn, kurze Badges (W/A/F/B), Stats sofort beim Mount laden
This commit is contained in:
@@ -726,7 +726,9 @@ function BestellStats() {
|
|||||||
if (loaded) return;
|
if (loaded) return;
|
||||||
api('/dashboard/stats').then(s => { setStats(s); setLoaded(true); }).catch(() => {});
|
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 }) => (
|
const Row = ({ label, val, color='rgba(255,255,255,0.85)', sub }) => (
|
||||||
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',
|
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',
|
||||||
@@ -756,10 +758,10 @@ function BestellStats() {
|
|||||||
{/* Status-Badges im zugeklappten Zustand */}
|
{/* Status-Badges im zugeklappten Zustand */}
|
||||||
{!open && stats && (
|
{!open && stats && (
|
||||||
<div style={{display:'flex',gap:4,flexWrap:'wrap',flex:1}}>
|
<div style={{display:'flex',gap:4,flexWrap:'wrap',flex:1}}>
|
||||||
<Badge val={stats.byStatus.warteliste||0} color="#ffe66d" label="Warteliste"/>
|
<Badge val={stats.byStatus.warteliste||0} color="#ffe66d" label="W"/>
|
||||||
<Badge val={stats.byStatus.in_arbeit||0} color="#4ecdc4" label="In Arbeit"/>
|
<Badge val={stats.byStatus.in_arbeit||0} color="#4ecdc4" label="A"/>
|
||||||
<Badge val={stats.byStatus.fertig||0} color="#6bcb77" label="Fertig"/>
|
<Badge val={stats.byStatus.fertig||0} color="#6bcb77" label="F"/>
|
||||||
<Badge val={stats.bezahltOrders} color="#c084fc" label="Bezahlt"/>
|
<Badge val={stats.bezahltOrders} color="#c084fc" label="B"/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<span style={{color:'rgba(255,255,255,0.3)',fontSize:11,marginLeft:'auto',flexShrink:0,
|
<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"
|
sub="in Arbeit/Fertig"
|
||||||
/>
|
/>
|
||||||
<Row
|
<Row
|
||||||
label="Gesamt-Potenzial"
|
label="Gesamt-Gewinn"
|
||||||
val={`${((stats.totalProfit??0)+(stats.offeneProfit??0)).toFixed(2)} €`}
|
val={`${((stats.totalProfit??0)+(stats.offeneProfit??0)).toFixed(2)} €`}
|
||||||
color="rgba(255,255,255,0.5)"
|
color="rgba(255,255,255,0.5)"
|
||||||
sub="bezahlt + offen"
|
sub="bezahlt + offen"
|
||||||
|
|||||||
Reference in New Issue
Block a user