From d7cd6ce4f25d44d0d31af9f132693796468196ea Mon Sep 17 00:00:00 2001 From: efrilm Date: Tue, 5 Aug 2025 22:39:43 +0700 Subject: [PATCH] fix: order --- .../home/models/order_request.dart | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/presentation/home/models/order_request.dart b/lib/presentation/home/models/order_request.dart index 5ffa6b0..45f565a 100644 --- a/lib/presentation/home/models/order_request.dart +++ b/lib/presentation/home/models/order_request.dart @@ -41,18 +41,25 @@ class OrderRequestModel { customerName: json["customer_name"], ); - Map toMap() => { - "outlet_id": outletId, - "customer_id": customerId, - "table_number": tableNumber, - "table_id": tableId, - "order_type": orderType, - "notes": notes, - "order_items": orderItems == null - ? [] - : List.from(orderItems!.map((x) => x.toMap())), - "customer_name": customerName, - }; + Map toMap() { + Map data = { + "outlet_id": outletId, + "table_number": tableNumber, + "table_id": tableId, + "order_type": orderType, + "notes": notes, + "order_items": orderItems == null + ? [] + : List.from(orderItems!.map((x) => x.toMap())), + "customer_name": customerName, + }; + + if (customerId != null || customerId != "") { + data["customer_id"] = customerId; + } + + return data; + } } class OrderItemRequest {