From 4ab78aa0be3394562d67638616720d39de128558 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 7 Sep 2020 11:28:47 +0300 Subject: [PATCH] deliverd order list --- lib/config/config.dart | 5 +- .../orders/deliverd_order_req_model.dart | 48 +++++++++++++++++++ .../orders/deliverd_order_res_model.dart | 0 .../orders/pending_orders_res_model.dart | 4 +- lib/core/service/orders_service.dart | 21 ++++++++ 5 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 lib/core/model/orders/deliverd_order_req_model.dart create mode 100644 lib/core/model/orders/deliverd_order_res_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index b86765f..ac1818a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -9,6 +9,9 @@ const SCAN_QR = '/Patients.svc/REST/PatientER_Delivery_OrderInsert'; const UPDATE_ORDER_STATUS = '/Patients.svc/REST/PatientER_Delivery_UpdateOrderStatus'; +const GET_ALL_DELIVERD_ORDER = + '/Patients.svc/REST/PatientER_Delivery_GetAllDeliverdOrder'; + /// Body Constant const CHANNEL = 9; @@ -18,5 +21,3 @@ const MAX_SMALL_SCREEN = 660; class AppGlobal { static BuildContext context; } - - diff --git a/lib/core/model/orders/deliverd_order_req_model.dart b/lib/core/model/orders/deliverd_order_req_model.dart new file mode 100644 index 0000000..08cd574 --- /dev/null +++ b/lib/core/model/orders/deliverd_order_req_model.dart @@ -0,0 +1,48 @@ +class DeliverdOrderModel { + int driverID; + String searchKey; + int pageSize; + int pageIndex; + String tokenID; + String userID; + String mobileNo; + String longitude; + String latitude; + + DeliverdOrderModel( + {this.driverID, + this.searchKey, + this.pageSize, + this.pageIndex, + this.tokenID, + this.userID, + this.mobileNo, + this.longitude, + this.latitude}); + + DeliverdOrderModel.fromJson(Map json) { + driverID = json['DriverID']; + searchKey = json['SearchKey']; + pageSize = json['PageSize']; + pageIndex = json['PageIndex']; + tokenID = json['TokenID']; + userID = json['UserID']; + mobileNo = json['MobileNo']; + longitude = json['Longitude']; + latitude = json['Latitude']; + } + + Map toJson() { + final Map data = new Map(); + data['DriverID'] = this.driverID; + data['SearchKey'] = this.searchKey; + data['PageSize'] = this.pageSize; + data['PageIndex'] = this.pageIndex; + data['TokenID'] = this.tokenID; + data['UserID'] = this.userID; + data['MobileNo'] = this.mobileNo; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + return data; + } +} diff --git a/lib/core/model/orders/deliverd_order_res_model.dart b/lib/core/model/orders/deliverd_order_res_model.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/core/model/orders/pending_orders_res_model.dart b/lib/core/model/orders/pending_orders_res_model.dart index 6809612..18c260d 100644 --- a/lib/core/model/orders/pending_orders_res_model.dart +++ b/lib/core/model/orders/pending_orders_res_model.dart @@ -16,9 +16,9 @@ class PendingOrdersRes { String descriptionN; double longitude; double latitude; - Null amount; + dynamic amount; String orderCreatedOn; - Null ePharmacyOrderNo; + dynamic ePharmacyOrderNo; int projectID; String appointmentNo; String dischargeID; diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index 8b9ebee..cba64f0 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -73,4 +73,25 @@ class OrdersService extends BaseService { throw e; } } + + Future getDekiverdOrder() async { + hasError = false; + try { + await baseAppClient.post(GET_ALL_DELIVERD_ORDER, + onSuccess: (dynamic response, int statusCode) { + _orders.clear(); + response['PatientER_Delivery_GetAllDeliverdOrderList'].forEach((order) { + _orders.add(PendingOrdersRes.fromJson(order)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestGetPendingOrders.toJson()); + } catch (e) { + hasError = true; + super.error = error; + + throw e; + } + } }