diff --git a/src/pages/OrdersPage.tsx b/src/pages/OrdersPage.tsx index 01423f3..0427105 100644 --- a/src/pages/OrdersPage.tsx +++ b/src/pages/OrdersPage.tsx @@ -67,12 +67,17 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void const initialMap: Record = {} matrix.clients.forEach(c => { const clientName = c.google_data.name - initialMap[clientName] = c.db_order || { - client_name: clientName, - items: [], - manager_comment: '', - decade: null, delivery: null, payment_form: null, conditions: null, - status: 'draft' + + if (c.db_order) { + c.db_order.items = c.db_order.items || []; + initialMap[clientName] = c.db_order; + } else { + initialMap[clientName] = { + client_name: clientName, + items: [], + manager_comment: '', + decade: null, delivery: null, payment_form: null, conditions: null, + } } })