--- import Admin from '../../../layouts/Admin.astro'; import { listOrders } from '../../../lib/store.js'; import { formatPrice } from '../../../lib/seed.js'; const orders = await listOrders(); const badge = (s) => ({ fulfilled:['green','Erfüllt'], pending:['amber','Offen'], cancelled:['gray','Storniert'], refunded:['blue','Erstattet'] }[s] || ['gray', s]); const fmtDate = (s) => new Date(s).toLocaleDateString('de-DE', { day:'2-digit', month:'short', year:'numeric' }); const items = (o) => o.items.reduce((s,i)=>s+i.qty,0); --- {orders.length} Bestellungen
{orders.map((o) => { const [c,l] = badge(o.status); return ( ); })} {orders.length === 0 && }
BestellungDatumKundeArtikelStatusBetrag
#{o.number} {fmtDate(o.created_at)} {o.customer_name || '—'}
{o.email}
{items(o)} Artikel {l} {formatPrice(o.total_cents)}
Noch keine Bestellungen.