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 {