// VMAX Store Manager — Reports: sales & operations read derived from the day's records. (function () { const DS = window.VMAX365DesignSystem_0f78b2; const { StatTile, Badge, SegmentedControl } = DS; const { Icon, Overline } = window.VMAXUI; const { Avatar } = window.VMAXW; const { K, dashboard } = window.VMAXP; const { useVMAX } = window.VMAXStore; const { Panel } = window.VMAXMGRUI; function ReportsPage({ mobile }) { const [s] = useVMAX(); const [range, setRange] = React.useState('today'); const t = s.tally; const mobileTotal = Object.values(t.mobile).reduce((a, b) => a + b, 0); const turnover = t.cash + mobileTotal; const cashPct = turnover ? Math.round((t.cash / turnover) * 100) : 0; const mobPct = turnover ? Math.round((mobileTotal / turnover) * 100) : 0; const cups = t.coldCups + t.hotCups; const coldPct = cups ? Math.round((t.coldCups / cups) * 100) : 0; const members = new Set(s.sales.filter((x) => x.member).map((x) => x.member)).size; const refunds = s.ledger.filter((e) => e.type === 'refund' && !e.reverted).length; const remakes = s.ledger.filter((e) => e.type === 'remake' && !e.reverted).length; const byCashier = {}; s.sales.forEach((o) => { byCashier[o.by] = byCashier[o.by] || { name: o.by, count: 0, value: 0 }; byCashier[o.by].count += 1; byCashier[o.by].value += o.amount; }); const cashiers = Object.values(byCashier).sort((a, b) => b.value - a.value); const maxVal = Math.max(1, ...cashiers.map((c) => c.value)); return (
{Object.keys(t.mobile).map((ch) =>
{K(t.mobile[ch])} {ch}
)}
{cups} cups}>
{t.coldCups}
cold · {coldPct}%
{t.hotCups}
hot · {100 - coldPct}%
attributed at print}> {cashiers.length === 0 ?
No sales recorded yet.
: (
{cashiers.map((c) => (
{c.name}{K(c.value)}
{c.count} order{c.count > 1 ? 's' : ''}
))}
)}
{dashboard.ranking.slice(0, 6).map((d, i) => (
{i + 1} {d.name} {d.qty}
))}
); } function Bar({ label, pct, value, tone }) { const c = tone === 'red' ? 'var(--vmax-red)' : tone === 'mint' ? 'var(--vmax-mint-deep)' : 'var(--vmax-ink)'; return (
{label}{value} · {pct}%
); } function Pill({ icon, label, value, tone }) { const c = tone === 'red' ? 'var(--vmax-red)' : 'var(--vmax-amber-deep)'; return
{value}
{label}
; } window.VMAXREPORTS = { ReportsPage }; })();