// Order list / history function OrdersListScreen({ pedidos, onOpen, onBack, onNew }) { const T = window.T; const { Icon, ProductTile, StatusPill } = window; const [filter, setFilter] = React.useState('Todos'); const filtered = pedidos.filter(p => { if (filter === 'Todos') return true; if (filter === 'Pendientes') return p.estado === 'pendiente'; if (filter === 'Completados') return p.estado === 'completado'; return true; }); return (
{pedidos.length} pedidos
Mis pedidos
{/* filters */}
{['Todos', 'Pendientes', 'Completados'].map(f => ( ))}
{filtered.length === 0 ? (
Aún nada por aquí
Cuando armes tu primer pedido aparecerá en esta lista.
) : (
{filtered.map(p => { const total = p.productos.reduce((s, x) => s + x.precio * x.cantidad, 0); const items = p.productos.reduce((s, x) => s + x.cantidad, 0); const catalogos = [...new Set(p.productos.map(x => x.catalogo))]; return ( ); })}
)}
); } window.OrdersListScreen = OrdersListScreen;