From 75bb145241469a407ec31849d32fd8ddd4f5e090 Mon Sep 17 00:00:00 2001 From: davidels1 <87242587+davidels1@users.noreply.github.com> Date: Thu, 25 Sep 2025 23:44:06 +0200 Subject: [PATCH] Refactor PurchaseOrderForm to align item submission structure with PocketBase requirements --- src/components/purchase-orders/PurchaseOrderForm.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/components/purchase-orders/PurchaseOrderForm.tsx b/src/components/purchase-orders/PurchaseOrderForm.tsx index 8bef0a5..af09883 100644 --- a/src/components/purchase-orders/PurchaseOrderForm.tsx +++ b/src/components/purchase-orders/PurchaseOrderForm.tsx @@ -194,15 +194,7 @@ export function PurchaseOrderForm({ setOpen, refreshData }: PurchaseOrderFormPro supplier: selectedSupplier.id, // This will be the relation to the suppliers collection orderDate: values.orderDate.toISOString(), status: "Pending Approval", - // Ensure the structure matches what your PocketBase 'purchase_orders' collection expects for 'items' - // Based on your schema, it seems 'embedded_items' is used for storing item details directly. - embedded_items: values.items.map(item => ({ - stockItemId: item.stockItemId, - itemName: item.itemName, - quantity: item.quantity, - sku: item.sku, - costPrice: item.costPrice, - })), + items: values.items.map(item => item.stockItemId), quantities: values.items.map(item => item.quantity), // Keep quantities array as well if needed elsewhere };