/admin/orders. The page supports two view modes: a paginated list view with status filters, and a Kanban board view for drag-and-drop status management. Both views share the same useAdminOrders hook.
Order Status Values
Orders use English status keys in the database. The domain module provides labels and colors:Valid Status Transitions
Not every status change is valid. The domain layer defines allowed transitions:| From | Can Transition To |
|---|---|
pending | confirmed, cancelled |
confirmed | processing, cancelled |
processing | shipped, cancelled |
shipped | delivered |
delivered | (terminal — no further transitions) |
cancelled | (terminal — no further transitions) |
CRUD Functions
getAllOrders
created_at descending. If statusFilter is provided, only orders with that status are returned. Customer name and phone are resolved from customer_profiles (for registered users) or the shipping address record (for guests).
updateOrderStatus
updated_at. Automation: When transitioning to processing, shipped, or delivered, payment_status is automatically set to 'paid'.
updateOrderPaymentStatus
updateOrderTracking
tracking_notes field.
AdminOrder Type
Filtering by Status
The list view includes anOrdersFilter component with status filter tabs. Selecting a status calls getAllOrders(statusFilter) and replaces the full order list:
Kanban Board
The Kanban view (OrdersKanbanBoard) groups orders by status into columns. Dragging an order card to a different column calls updateOrderStatus. This view is particularly useful for processing orders in real time.
Toggle between views using the viewMode state ('list' | 'board').
Bulk Status Updates
Select multiple orders in list view to show a floating action bar:pending, processing, shipped, delivered.
Order Detail Drawer
OrderDetailDrawer opens as a slide-in panel when clicking an order in either view. It provides:
- Full order summary (items, totals, customer info)
- Status change controls
- Payment status override
- Tracking number input
CSV Export
ID Pedido, Cliente, Telefono, Total, Status, Fecha, Metodo Pago, Metodo Envio. Downloads as vsm_pedidos_YYYY-MM-DD.csv.
Payment Method Values
| Value | Description |
|---|---|
whatsapp | Order placed via WhatsApp, payment to be confirmed manually |
mercadopago | Mercado Pago online payment |
cash | Cash on delivery |
transfer | Bank transfer / CLABE |
Driver Assignment
TheUSER_ROLES.DRIVER constant ('driver') in src/constants/app.ts is reserved for delivery drivers. Orders assigned to a driver can be tracked by the driver role — the system supports a driver role distinct from the admin role.
