From 72784f68b971eea13116faab308123dabf0963c4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 2 Nov 2021 17:29:27 +0300 Subject: [PATCH 1/8] Fixes & updates --- lib/config/config.dart | 16 +- .../model/er/AmbulanceRequestOrdersModel.dart | 483 +++++++++--------- lib/core/model/er/PatientER_RC.dart | 2 +- ..._all_transportation_method_list_model.dart | 48 +- .../prescription_info_rc_model.dart | 52 ++ .../AlHabibMedicalService/cmc_service.dart | 8 +- .../home_health_care_service.dart | 8 +- lib/core/service/client/base_app_client.dart | 24 +- lib/core/service/er/am_service.dart | 20 +- .../medical/prescriptions_service.dart | 32 +- .../viewModels/er/am_request_view_model.dart | 2 +- lib/core/viewModels/er/rrt-view-model.dart | 6 +- .../medical/prescriptions_view_model.dart | 21 +- .../orders_log_details_page.dart | 4 +- lib/pages/Blood/blood_donation.dart | 46 +- .../DrawerPages/family/add-family-member.dart | 5 +- .../AmbulanceRequestIndex.dart | 35 +- .../PickupLocation.dart | 2 +- .../SelectTransportationMethod.dart | 2 +- lib/pages/ErService/OrderLogPage.dart | 4 +- .../rapid-response-team/rrt-logs-page.dart | 28 +- .../prescriptions_history_details_page.dart | 38 +- .../prescriptions_history_page.dart | 24 +- 23 files changed, 537 insertions(+), 373 deletions(-) create mode 100644 lib/core/model/prescriptions/prescription_info_rc_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 49b33063..f3444d3a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,16 +15,19 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs - const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; - const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // // Pharmacy Production URLs -// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; + +// RC API URLs +const RC_BASE_URL = 'https://livecare.hmg.com/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; @@ -462,6 +465,7 @@ const UPDATE_RRT_ORDER_RC = 'rc/api/rrt/update'; // PRESCRIPTION RC SERVICES const ADD_PRESCRIPTION_ORDER_RC = "rc/api/prescription/add"; const GET_ALL_PRESCRIPTION_ORDERS_RC = "rc/api/prescription/list"; +const GET_ALL_PRESCRIPTION_INFO_RC = "rc/api/Prescription/info"; const UPDATE_PRESCRIPTION_ORDER_RC = 'rc/api/prescription/update'; diff --git a/lib/core/model/er/AmbulanceRequestOrdersModel.dart b/lib/core/model/er/AmbulanceRequestOrdersModel.dart index 6bcc02b0..72a3fd5f 100644 --- a/lib/core/model/er/AmbulanceRequestOrdersModel.dart +++ b/lib/core/model/er/AmbulanceRequestOrdersModel.dart @@ -1,26 +1,27 @@ class AmbulanceRequestOrdersModel { String statusText; - int paymentStatus; + num paymentStatus; dynamic clientRequestid; dynamic paymentStatusText; dynamic projectName; String nearestProjectName; - double paymentAmount; + num paymentAmount; WFOrder wFOrder; String serviceText; bool isSentForApproval; - int exaCartOrderId; + num exaCartOrderId; + String exaCartGUID; bool isTimer; - int timeSeconds; - int totalPendingSeconds; - int timeMinute; - int timeHour; - int timeTotalSeconds; - int timeTotalMinute; - int timeTotalHour; + num timeSeconds; + num totalPendingSeconds; + num timeMinute; + num timeHour; + num timeTotalSeconds; + num timeTotalMinute; + num timeTotalHour; dynamic approvalStatus; bool isActive; - int clickButton; + num clickButton; dynamic orderHistory; String pickupLocation; String dropOffLocation; @@ -28,22 +29,21 @@ class AmbulanceRequestOrdersModel { String doctorName; String branch; String time; - dynamic notes; - int id; - String patientId; - int patientOutSa; + String notes; + num iD; + num patientId; + num patientOutSa; bool isOutPatient; - int projectId; - int nearestProjectId; + num projectId; + num nearestProjectId; dynamic longitude; dynamic latitude; dynamic appointmentNo; dynamic dischargeId; - int statusId; - int serviceId; - int channel; + num statusId; + num serviceId; + num channel; Orderpayment orderpayment; - dynamic orderselectedservice; dynamic wforder; dynamic orderapprovalobj; String created; @@ -54,266 +54,293 @@ class AmbulanceRequestOrdersModel { AmbulanceRequestOrdersModel( {this.statusText, - this.paymentStatus, - this.clientRequestid, - this.paymentStatusText, - this.projectName, - this.nearestProjectName, - this.paymentAmount, - this.wFOrder, - this.serviceText, - this.isSentForApproval, - this.exaCartOrderId, - this.isTimer, - this.timeSeconds, - this.totalPendingSeconds, - this.timeMinute, - this.timeHour, - this.timeTotalSeconds, - this.timeTotalMinute, - this.timeTotalHour, - this.approvalStatus, - this.isActive, - this.clickButton, - this.orderHistory, - this.pickupLocation, - this.dropOffLocation, - this.clinicName, - this.doctorName, - this.branch, - this.time, - this.notes, - this.id, - this.patientId, - this.patientOutSa, - this.isOutPatient, - this.projectId, - this.nearestProjectId, - this.longitude, - this.latitude, - this.appointmentNo, - this.dischargeId, - this.statusId, - this.serviceId, - this.channel, - this.orderpayment, - this.orderselectedservice, - this.wforder, - this.orderapprovalobj, - this.created, - this.createdBy, - this.modified, - this.modifiedBy, - this.isDeleted}); + this.paymentStatus, + this.clientRequestid, + this.paymentStatusText, + this.projectName, + this.nearestProjectName, + this.paymentAmount, + this.wFOrder, + this.serviceText, + this.isSentForApproval, + this.exaCartOrderId, + this.exaCartGUID, + this.isTimer, + this.timeSeconds, + this.totalPendingSeconds, + this.timeMinute, + this.timeHour, + this.timeTotalSeconds, + this.timeTotalMinute, + this.timeTotalHour, + this.approvalStatus, + this.isActive, + this.clickButton, + this.orderHistory, + this.pickupLocation, + this.dropOffLocation, + this.clinicName, + this.doctorName, + this.branch, + this.time, + this.notes, + this.iD, + this.patientId, + this.patientOutSa, + this.isOutPatient, + this.projectId, + this.nearestProjectId, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeId, + this.statusId, + this.serviceId, + this.channel, + this.orderpayment, + this.wforder, + this.orderapprovalobj, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); AmbulanceRequestOrdersModel.fromJson(Map json) { - statusText = json['statusText']; - paymentStatus = json['paymentStatus']; - clientRequestid = json['clientRequestid']; - paymentStatusText = json['paymentStatusText']; - projectName = json['projectName']; - nearestProjectName = json['nearestProjectName']; - paymentAmount = json['paymentAmount']; - wFOrder = json['wF_order'] != null ? new WFOrder.fromJson(json['wF_order']) : null; - serviceText = json['serviceText']; + statusText = json['StatusText']; + paymentStatus = json['PaymentStatus']; + clientRequestid = json['ClientRequestid']; + paymentStatusText = json['PaymentStatusText']; + projectName = json['ProjectName']; + nearestProjectName = json['NearestProjectName']; + paymentAmount = json['PaymentAmount']; + wFOrder = json['WF_order'] != null + ? new WFOrder.fromJson(json['WF_order']) + : null; + serviceText = json['ServiceText']; isSentForApproval = json['isSentForApproval']; - exaCartOrderId = json['exaCart_OrderId']; + exaCartOrderId = json['ExaCart_OrderId']; + exaCartGUID = json['ExaCart_GUID']; isTimer = json['isTimer']; - timeSeconds = json['timeSeconds']; - totalPendingSeconds = json['totalPendingSeconds']; - timeMinute = json['timeMinute']; - timeHour = json['timeHour']; - timeTotalSeconds = json['timeTotalSeconds']; - timeTotalMinute = json['timeTotalMinute']; - timeTotalHour = json['timeTotalHour']; - approvalStatus = json['approvalStatus']; + timeSeconds = json['TimeSeconds']; + totalPendingSeconds = json['TotalPendingSeconds']; + timeMinute = json['TimeMinute']; + timeHour = json['TimeHour']; + timeTotalSeconds = json['TimeTotalSeconds']; + timeTotalMinute = json['TimeTotalMinute']; + timeTotalHour = json['TimeTotalHour']; + approvalStatus = json['ApprovalStatus']; isActive = json['isActive']; - clickButton = json['clickButton']; - orderHistory = json['orderHistory']; - pickupLocation = json['pickupLocation']; - dropOffLocation = json['dropOffLocation']; + clickButton = json['ClickButton']; + orderHistory = json['OrderHistory']; + pickupLocation = json['PickupLocation']; + dropOffLocation = json['DropOffLocation']; clinicName = json['clinicName']; - doctorName = json['doctorName']; - branch = json['branch']; - time = json['time']; - notes = json['notes']; - id = json['id']; - patientId = json['patientId']; - patientOutSa = json['patientOutSa']; - isOutPatient = json['isOutPatient']; - projectId = json['projectId']; - nearestProjectId = json['nearestProjectId']; - longitude = json['longitude']; - latitude = json['latitude']; - appointmentNo = json['appointmentNo']; - dischargeId = json['dischargeId']; - statusId = json['statusId']; - serviceId = json['serviceId']; - channel = json['channel']; - orderpayment = json['orderpayment'] != null ? new Orderpayment.fromJson(json['orderpayment']) : null; - orderselectedservice = json['orderselectedservice']; + doctorName = json['DoctorName']; + branch = json['Branch']; + time = json['Time']; + notes = json['Notes']; + iD = json['ID']; + patientId = json['PatientId']; + patientOutSa = json['PatientOutSa']; + isOutPatient = json['IsOutPatient']; + projectId = json['ProjectId']; + nearestProjectId = json['NearestProjectId']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeId = json['DischargeId']; + statusId = json['StatusId']; + serviceId = json['ServiceId']; + channel = json['Channel']; + orderpayment = json['orderpayment'] != null + ? new Orderpayment.fromJson(json['orderpayment']) + : null; wforder = json['wforder']; orderapprovalobj = json['orderapprovalobj']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); - data['statusText'] = this.statusText; - data['paymentStatus'] = this.paymentStatus; - data['clientRequestid'] = this.clientRequestid; - data['paymentStatusText'] = this.paymentStatusText; - data['projectName'] = this.projectName; - data['nearestProjectName'] = this.nearestProjectName; - data['paymentAmount'] = this.paymentAmount; + data['StatusText'] = this.statusText; + data['PaymentStatus'] = this.paymentStatus; + data['ClientRequestid'] = this.clientRequestid; + data['PaymentStatusText'] = this.paymentStatusText; + data['ProjectName'] = this.projectName; + data['NearestProjectName'] = this.nearestProjectName; + data['PaymentAmount'] = this.paymentAmount; if (this.wFOrder != null) { - data['wF_order'] = this.wFOrder.toJson(); + data['WF_order'] = this.wFOrder.toJson(); } - data['serviceText'] = this.serviceText; + data['ServiceText'] = this.serviceText; data['isSentForApproval'] = this.isSentForApproval; - data['exaCart_OrderId'] = this.exaCartOrderId; + data['ExaCart_OrderId'] = this.exaCartOrderId; + data['ExaCart_GUID'] = this.exaCartGUID; data['isTimer'] = this.isTimer; - data['timeSeconds'] = this.timeSeconds; - data['totalPendingSeconds'] = this.totalPendingSeconds; - data['timeMinute'] = this.timeMinute; - data['timeHour'] = this.timeHour; - data['timeTotalSeconds'] = this.timeTotalSeconds; - data['timeTotalMinute'] = this.timeTotalMinute; - data['timeTotalHour'] = this.timeTotalHour; - data['approvalStatus'] = this.approvalStatus; + data['TimeSeconds'] = this.timeSeconds; + data['TotalPendingSeconds'] = this.totalPendingSeconds; + data['TimeMinute'] = this.timeMinute; + data['TimeHour'] = this.timeHour; + data['TimeTotalSeconds'] = this.timeTotalSeconds; + data['TimeTotalMinute'] = this.timeTotalMinute; + data['TimeTotalHour'] = this.timeTotalHour; + data['ApprovalStatus'] = this.approvalStatus; data['isActive'] = this.isActive; - data['clickButton'] = this.clickButton; - data['orderHistory'] = this.orderHistory; - data['pickupLocation'] = this.pickupLocation; - data['dropOffLocation'] = this.dropOffLocation; + data['ClickButton'] = this.clickButton; + data['OrderHistory'] = this.orderHistory; + data['PickupLocation'] = this.pickupLocation; + data['DropOffLocation'] = this.dropOffLocation; data['clinicName'] = this.clinicName; - data['doctorName'] = this.doctorName; - data['branch'] = this.branch; - data['time'] = this.time; - data['notes'] = this.notes; - data['id'] = this.id; - data['patientId'] = this.patientId; - data['patientOutSa'] = this.patientOutSa; - data['isOutPatient'] = this.isOutPatient; - data['projectId'] = this.projectId; - data['nearestProjectId'] = this.nearestProjectId; - data['longitude'] = this.longitude; - data['latitude'] = this.latitude; - data['appointmentNo'] = this.appointmentNo; - data['dischargeId'] = this.dischargeId; - data['statusId'] = this.statusId; - data['serviceId'] = this.serviceId; - data['channel'] = this.channel; + data['DoctorName'] = this.doctorName; + data['Branch'] = this.branch; + data['Time'] = this.time; + data['Notes'] = this.notes; + data['ID'] = this.iD; + data['PatientId'] = this.patientId; + data['PatientOutSa'] = this.patientOutSa; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectId'] = this.projectId; + data['NearestProjectId'] = this.nearestProjectId; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeId'] = this.dischargeId; + data['StatusId'] = this.statusId; + data['ServiceId'] = this.serviceId; + data['Channel'] = this.channel; if (this.orderpayment != null) { data['orderpayment'] = this.orderpayment.toJson(); } - data['orderselectedservice'] = this.orderselectedservice; data['wforder'] = this.wforder; data['orderapprovalobj'] = this.orderapprovalobj; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } class WFOrder { - dynamic wfButtonsDTO; - int id; - int orderId; - int previousStep; - int nextStep; - int serviceId; - dynamic order; + Null wfButtonsDTO; + num iD; + num orderId; + num previousStep; + num nextStep; + num serviceId; + Null order; String created; - dynamic createdBy; - dynamic modified; - dynamic modifiedBy; + Null createdBy; + Null modified; + Null modifiedBy; bool isDeleted; - WFOrder({this.wfButtonsDTO, this.id, this.orderId, this.previousStep, this.nextStep, this.serviceId, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted}); + WFOrder( + {this.wfButtonsDTO, + this.iD, + this.orderId, + this.previousStep, + this.nextStep, + this.serviceId, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); WFOrder.fromJson(Map json) { wfButtonsDTO = json['wf_ButtonsDTO']; - id = json['id']; - orderId = json['orderId']; - previousStep = json['previousStep']; - nextStep = json['nextStep']; - serviceId = json['serviceId']; - order = json['order']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + iD = json['ID']; + orderId = json['OrderId']; + previousStep = json['PreviousStep']; + nextStep = json['NextStep']; + serviceId = json['ServiceId']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); data['wf_ButtonsDTO'] = this.wfButtonsDTO; - data['id'] = this.id; - data['orderId'] = this.orderId; - data['previousStep'] = this.previousStep; - data['nextStep'] = this.nextStep; - data['serviceId'] = this.serviceId; - data['order'] = this.order; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['PreviousStep'] = this.previousStep; + data['NextStep'] = this.nextStep; + data['ServiceId'] = this.serviceId; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } class Orderpayment { - int id; - int orderId; - dynamic clientRequestId; - double totalAmount; - int paymentStatus; - dynamic order; + num iD; + num orderId; + Null clientRequestId; + num totalAmount; + num paymentStatus; + Null order; String created; - dynamic createdBy; - dynamic modified; - dynamic modifiedBy; + Null createdBy; + Null modified; + Null modifiedBy; bool isDeleted; - Orderpayment({this.id, this.orderId, this.clientRequestId, this.totalAmount, this.paymentStatus, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted}); + Orderpayment( + {this.iD, + this.orderId, + this.clientRequestId, + this.totalAmount, + this.paymentStatus, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); Orderpayment.fromJson(Map json) { - id = json['id']; - orderId = json['orderId']; - clientRequestId = json['clientRequestId']; - totalAmount = json['totalAmount']; - paymentStatus = json['paymentStatus']; - order = json['order']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + iD = json['ID']; + orderId = json['OrderId']; + clientRequestId = json['ClientRequestId']; + totalAmount = json['TotalAmount']; + paymentStatus = json['PaymentStatus']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); - data['id'] = this.id; - data['orderId'] = this.orderId; - data['clientRequestId'] = this.clientRequestId; - data['totalAmount'] = this.totalAmount; - data['paymentStatus'] = this.paymentStatus; - data['order'] = this.order; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['ClientRequestId'] = this.clientRequestId; + data['TotalAmount'] = this.totalAmount; + data['PaymentStatus'] = this.paymentStatus; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } diff --git a/lib/core/model/er/PatientER_RC.dart b/lib/core/model/er/PatientER_RC.dart index ec564128..6abec2d6 100644 --- a/lib/core/model/er/PatientER_RC.dart +++ b/lib/core/model/er/PatientER_RC.dart @@ -10,7 +10,7 @@ class PatientER_RC { String sessionID; bool isDentalAllowedBackend; int deviceTypeID; - String patientID; + int patientID; String tokenID; int patientTypeID; int patientType; diff --git a/lib/core/model/er/get_all_transportation_method_list_model.dart b/lib/core/model/er/get_all_transportation_method_list_model.dart index 1f0a91c3..530b4f25 100644 --- a/lib/core/model/er/get_all_transportation_method_list_model.dart +++ b/lib/core/model/er/get_all_transportation_method_list_model.dart @@ -1,5 +1,5 @@ class PatientERTransportationMethod { - int id; + int iD; String serviceID; int orderServiceID; String text; @@ -12,7 +12,7 @@ class PatientERTransportationMethod { int quantity; PatientERTransportationMethod( - {this.id, + {this.iD, this.serviceID, this.orderServiceID, this.text, @@ -25,32 +25,32 @@ class PatientERTransportationMethod { this.quantity}); PatientERTransportationMethod.fromJson(Map json) { - id = json['id']; - serviceID = json['serviceID']; - orderServiceID = json['orderServiceID']; - text = json['text']; - textN = json['textN']; - price = json['price']; - priceVAT = json['priceVAT']; - priceTotal = json['priceTotal']; - isEnabled = json['isEnabled']; - orderId = json['orderId']; - quantity = json['quantity']; + iD = json['ID']; + serviceID = json['ServiceID']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); - data['id'] = this.id; - data['serviceID'] = this.serviceID; - data['orderServiceID'] = this.orderServiceID; - data['text'] = this.text; - data['textN'] = this.textN; - data['price'] = this.price; - data['priceVAT'] = this.priceVAT; - data['priceTotal'] = this.priceTotal; - data['isEnabled'] = this.isEnabled; - data['orderId'] = this.orderId; - data['quantity'] = this.quantity; + data['ID'] = this.iD; + data['ServiceID'] = this.serviceID; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/prescriptions/prescription_info_rc_model.dart b/lib/core/model/prescriptions/prescription_info_rc_model.dart new file mode 100644 index 00000000..23c4ad55 --- /dev/null +++ b/lib/core/model/prescriptions/prescription_info_rc_model.dart @@ -0,0 +1,52 @@ +class PrescriptionInfoRCModel { + String itemDescription; + String image; + String sKU; + dynamic productId; + dynamic productName; + int quantity; + int orderId; + int totalPrice; + int dispenseQuantity; + dynamic itemhand; + + PrescriptionInfoRCModel( + {this.itemDescription, + this.image, + this.sKU, + this.productId, + this.productName, + this.quantity, + this.orderId, + this.totalPrice, + this.dispenseQuantity, + this.itemhand}); + + PrescriptionInfoRCModel.fromJson(Map json) { + itemDescription = json['ItemDescription']; + image = json['image']; + sKU = json['SKU']; + productId = json['ProductId']; + productName = json['ProductName']; + quantity = json['Quantity']; + orderId = json['OrderId']; + totalPrice = json['TotalPrice']; + dispenseQuantity = json['DispenseQuantity']; + itemhand = json['itemhand']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemDescription'] = this.itemDescription; + data['image'] = this.image; + data['SKU'] = this.sKU; + data['ProductId'] = this.productId; + data['ProductName'] = this.productName; + data['Quantity'] = this.quantity; + data['OrderId'] = this.orderId; + data['TotalPrice'] = this.totalPrice; + data['DispenseQuantity'] = this.dispenseQuantity; + data['itemhand'] = this.itemhand; + return data; + } +} diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 7fc23cc9..c6c2d82f 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -28,7 +28,7 @@ class CMCService extends BaseService { hasError = false; // RC IMPLEMENTATION - await baseAppClient.post(GET_ALL_CMC_SERVICES_RC + "?patientID=" + user.patientID.toString(), isAllowAny: true, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_CMC_SERVICES_RC + "?patientID=" + user.patientID.toString(), isRCService: true, isAllowAny: true, onSuccess: (dynamic response, int statusCode) { cmcAllServicesList.clear(); response['response'].forEach((data) { cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); @@ -67,7 +67,7 @@ class CMCService extends BaseService { Future getCmcAllPresOrdersRC() async { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_ALL_CMC_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_CMC_ORDERS_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { cmcAllPresOrdersList.clear(); cmcAllOrderDetail.clear(); @@ -122,7 +122,7 @@ class CMCService extends BaseService { Future updateCmcPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; - await baseAppClient.post(UPDATE_CMC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_CMC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { hasError = true; @@ -133,7 +133,7 @@ class CMCService extends BaseService { Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { hasError = false; String reqId = ""; - await baseAppClient.post(ADD_CMC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(ADD_CMC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; reqId = response['response'].toString(); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index cd90dae5..99220b07 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -38,7 +38,7 @@ class HomeHealthCareService extends BaseService { Future getHHCAllServicesRC(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; - await baseAppClient.post(HHC_GET_ALL_SERVICES_RC + "?PatientID=" + user.patientID.toString(), onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(HHC_GET_ALL_SERVICES_RC + "?PatientID=" + user.patientID.toString(), isRCService: true, onSuccess: (dynamic response, int statusCode) { hhcAllServicesList.clear(); response['response'].forEach((data) { hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); @@ -52,7 +52,7 @@ class HomeHealthCareService extends BaseService { Future getHHCAllPresOrdersRC() async { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_ALL_HHC_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_HHC_ORDERS_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); hhcAllOrderDetail.clear(); response['response'].forEach((data) { @@ -106,7 +106,7 @@ class HomeHealthCareService extends BaseService { Future updateHHCPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; - await baseAppClient.post(UPDATE_HHC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_HHC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { hasError = true; @@ -127,7 +127,7 @@ class HomeHealthCareService extends BaseService { Future insertHHCOrderRC({PatientERInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(ADD_HHC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(ADD_HHC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { hhcResponse = response; requestNo = response["response"]; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 19c8eac2..696cda28 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -35,12 +35,20 @@ VitalSignService _vitalSignService = locator(); class BaseAppClient { post(String endPoint, - {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, bool isAllowAny = false, bool isExternal = false}) async { + {Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + bool isAllowAny = false, + bool isExternal = false, + bool isRCService = false}) async { String url; if (isExternal) { url = endPoint; } else { - url = BASE_URL + endPoint; + if (isRCService) + url = RC_BASE_URL + endPoint; + else + url = BASE_URL + endPoint; } try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -376,12 +384,20 @@ class BaseAppClient { Navigator.pushReplacement(context, FadePage(page: AppUpdatePage(appUpdateText: text))); } - get(String endPoint, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, bool isExternal = false}) async { + get(String endPoint, + {Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + Map queryParams, + bool isExternal = false, + bool isRCService = false}) async { String url; if (isExternal) { url = endPoint; } else { - url = BASE_URL + endPoint; + if (isRCService) + url = RC_BASE_URL + endPoint; + else + url = BASE_URL + endPoint; } if (queryParams != null) { String queryString = Uri(queryParameters: queryParams).query; diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 9c66d373..a76ae73a 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -28,9 +28,9 @@ class AmService extends BaseService { Map body = Map(); body['isDentalAllowedBackend'] = false; body['IdentificationNo'] = user.patientIdentificationNo; - await baseAppClient.get(GET_ALL_TRANSPORTATIONS_RC + "?patientID=" + user.patientID.toString(), isExternal: false, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.get(GET_ALL_TRANSPORTATIONS_RC + "?patientID=" + user.patientID.toString(), isRCService: true, isExternal: false, onSuccess: (dynamic response, int statusCode) { amModelList.clear(); - response['data']['transportationservices'].forEach((item) { + response['response']['transportationservices'].forEach((item) { amModelList.add(PatientERTransportationMethod.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -69,18 +69,18 @@ class AmService extends BaseService { pickUpRequestPresOrder = null; Map body = Map(); - body['patientId'] = patientID.toString(); - body['PatientID'] = patientID.toString(); + body['patientId'] = patientID; + body['PatientID'] = patientID; - await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, isRCService: true, onSuccess: (dynamic response, int statusCode) { patientAmbulanceRequestOrdersList.clear(); hasPendingOrder = false; pendingOrderID = 0; pendingAmbulanceRequestOrder = null; - response['data'].forEach((item) { + response['response'].forEach((item) { patientAmbulanceRequestOrdersList.add(AmbulanceRequestOrdersModel.fromJson(item)); - if (item['statusId'] == 1) { + if (item['StatusId'] == 1) { hasPendingOrder = true; pendingOrderID = item['orderpayment']['id']; pendingOrderStatus = item['statusText']; @@ -127,14 +127,14 @@ class AmService extends BaseService { }, body: body); } - Future updatePressOrderRC({@required int presOrderID, @required String patientID}) async { + Future updatePressOrderRC({@required int presOrderID, @required int patientID}) async { hasError = false; Map body = Map(); body['Id'] = presOrderID; body['StatusId'] = 6; body['ClickButton'] = 14; body['PatientID'] = patientID; - await baseAppClient.post(CANCEL_AMBULANCE_REQUEST, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + await baseAppClient.post(CANCEL_AMBULANCE_REQUEST, isRCService: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -146,7 +146,7 @@ class AmService extends BaseService { var body = patientER.toJson(); print(body); - await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 48c4f1bf..4349f218 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_info_rc_model.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; @@ -18,6 +19,7 @@ class PrescriptionsService extends BaseService { List prescriptionsList = List(); List prescriptionReportListINP = List(); List prescriptionsOrderList = List(); + List prescriptionsOrderListRC = List(); var isMedDeliveryAllowed; Future getPrescriptions() async { @@ -49,6 +51,20 @@ class PrescriptionsService extends BaseService { }, body: body); } + Future getPrescriptionsInfoRC(int orderID, dynamic patientID) async { + prescriptionsOrderListRC.clear(); + Map body = Map(); + body['ID'] = orderID; + await baseAppClient.post(GET_ALL_PRESCRIPTION_INFO_RC + "?PatientId=" + patientID.toString(), onSuccess: (dynamic response, int statusCode) { + response['response']['report'].forEach((prescriptionsOrder) { + prescriptionsOrderListRC.add(PrescriptionInfoRCModel.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getPrescriptionsOrdersRC() async { prescriptionsOrderList.clear(); Map body = Map(); @@ -162,7 +178,6 @@ class PrescriptionsService extends BaseService { List prescriptionReportEnhList = List(); Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async { - ///This logic copy from the old app from class [order-history.component.ts] in line 45 bool isInPatient = false; prescriptionsList.forEach((element) { if (prescriptionsOrder.appointmentNo == "0") { @@ -184,8 +199,6 @@ class PrescriptionsService extends BaseService { _requestPrescriptionReportEnh.setupID = element.setupID; _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; isInPatient = element.isInOutPatient; - - ///call inpGetPrescriptionReport } } }); @@ -212,6 +225,19 @@ class PrescriptionsService extends BaseService { }, body: _requestPrescriptionReportEnh.toJson()); } + Future updatePressOrderRC({@required int presOrderID, @required String patientID}) async { + hasError = false; + Map body = Map(); + body['Id'] = presOrderID; + body['StatusId'] = 6; + body['ClickButton'] = 14; + body['PatientID'] = patientID; + await baseAppClient.post(UPDATE_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future updatePressOrder({@required int presOrderID}) async { hasError = false; Map body = Map(); diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index ac1b934e..aff532d7 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -106,7 +106,7 @@ class AmRequestViewModel extends BaseViewModel { Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); // await _amService.updatePressOrder(presOrderID: presOrderID); - await _amService.updatePressOrderRC(presOrderID: presOrderID, patientID: authenticatedUserObject.user.patientID.toString()); + await _amService.updatePressOrderRC(presOrderID: presOrderID, patientID: authenticatedUserObject.user.patientID); if (_amService.hasError) { error = _amService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index 60411fab..093c29b6 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -62,7 +62,7 @@ class RRTViewModel extends BaseViewModel { // body['OrderServiceID'] = 5; var localRes; int requestNo; - await _service.baseAppClient.post(ADD_RRT_ORDER_RC, body: body, onSuccess: (response, statusCode) { + await _service.baseAppClient.post(ADD_RRT_ORDER_RC, isRCService: true, body: body, onSuccess: (response, statusCode) { requestNo = response['response']; }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); @@ -94,7 +94,7 @@ class RRTViewModel extends BaseViewModel { } Future<_RRTServiceData> getAllOrdersRC() async { - await _service.baseAppClient.post(GET_ALL_RRT_ORDERS_RC, body: {}, onSuccess: (response, statusCode) { + await _service.baseAppClient.post(GET_ALL_RRT_ORDERS_RC, isRCService: true, body: {}, onSuccess: (response, statusCode) { var data = response["response"]; rrtServiceData.completedOrders.clear(); rrtServiceData.pendingOrders.clear(); @@ -161,7 +161,7 @@ class RRTViewModel extends BaseViewModel { Future cancelOrderRC(GetCMCAllOrdersResponseModel order, {String reason = ""}) async { Map body = {"Id": order.iD, "ClickButton": 16}; var success = false; - await _service.baseAppClient.post(UPDATE_RRT_ORDER_RC, body: body, onSuccess: (response, statusCode) { + await _service.baseAppClient.post(UPDATE_RRT_ORDER_RC, isRCService: true, body: body, onSuccess: (response, statusCode) { success = true; rrtServiceData.pendingOrders.remove(order); }, onFailure: (error, statusCode) { diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index be6153bd..f480fb56 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_info_rc_model.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; @@ -31,6 +32,10 @@ class PrescriptionsViewModel extends BaseViewModel { List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; + List get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList; + + List get prescriptionsOrderListRC => _prescriptionsService.prescriptionsOrderListRC; + List get prescriptionsOrderList => filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; List prescriptionsOrderListByValue(filterValue) { @@ -131,8 +136,6 @@ class PrescriptionsViewModel extends BaseViewModel { } } - List get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList; - getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async { setState(ViewState.Busy); await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder); @@ -144,9 +147,21 @@ class PrescriptionsViewModel extends BaseViewModel { } } + getPrescriptionReportDetailsRC() async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptionsInfoRC(4, 2001273); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); - await _prescriptionsService.updatePressOrder(presOrderID: presOrderID); + // await _prescriptionsService.updatePressOrder(presOrderID: presOrderID); + await _prescriptionsService.updatePressOrderRC(presOrderID: presOrderID); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.Error); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index d3c7f970..48b904aa 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -56,7 +56,7 @@ class OrdersLogDetailsPage extends StatelessWidget { return AppScaffold( isShowAppBar: false, baseViewModel: model, - body: ListView.separated( + body: model.cmcAllPresOrders.length > 0 ? ListView.separated( padding: EdgeInsets.all(21), physics: BouncingScrollPhysics(), itemBuilder: (context, index) { @@ -178,7 +178,7 @@ class OrdersLogDetailsPage extends StatelessWidget { ); }, separatorBuilder: (context, index) => SizedBox(height: 12), - itemCount: model.cmcAllPresOrders.length), + itemCount: model.cmcAllPresOrders.length) : getNoDataWidget(context), ); } } diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index db96a5a1..d9dbcf4b 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -34,8 +33,6 @@ class BloodDonationPage extends StatefulWidget { } class _BloodDonationPageState extends State { - TextEditingController _fileTextController = TextEditingController(); - TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; CitiesModel _selectedHospital; @@ -43,10 +40,10 @@ class _BloodDonationPageState extends State { int _selectedHospitalIndex = 0; int _selectedGenderIndex = 1; int _selectedBloodTypeIndex = 0; + String _selectedBloodType = "O+"; String amount = ""; String email; - PatientInfo _selectedPatientInfo; AuthenticatedUser authenticatedUser; GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); @@ -71,7 +68,6 @@ class _BloodDonationPageState extends State { int getSelectedCityID(MyBalanceViewModel model) { int cityID = 1; - model.CitiesModelList.forEach((element) { if (element.description == model.bloodModelList[0].city) { cityID = element.iD; @@ -96,6 +92,8 @@ class _BloodDonationPageState extends State { citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; _selectedHospital = citiesModel; + _selectedBloodType = model.bloodModelList[0].bloodGroup; + _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); } else { _selectedHospital = model.CitiesModelList[0]; } @@ -168,7 +166,7 @@ class _BloodDonationPageState extends State { ); }).withBorderedContainer, SizedBox(height: 12), - CommonDropDownView(TranslationBase.of(context).bloodType, model.bloodModelList.isNotEmpty ? model.bloodModelList[0].bloodGroup : getBlood(_selectedBloodTypeIndex), () { + CommonDropDownView(TranslationBase.of(context).bloodType, _selectedBloodType, () { List list = [ RadioSelectionDialogModel("O+", 0), RadioSelectionDialogModel("O-", 1), @@ -188,6 +186,7 @@ class _BloodDonationPageState extends State { isScrollable: true, onValueSelected: (index) { _selectedBloodTypeIndex = index; + _selectedBloodType = getBlood(index); setState(() {}); }, ), @@ -321,6 +320,41 @@ class _BloodDonationPageState extends State { } } + int getBloodIndex(String type) { + switch (type) { + case "O+": + return 0; + break; + case "O-": + return 1; + break; + case "AB+": + return 2; + break; + case "AB-": + return 3; + break; + case "A+": + return 4; + break; + case "A-": + return 5; + break; + case "B-": + return 6; + break; + case "B-": + return 7; + break; + case "B+": + return 8; + break; + + default: + return 0; + } + } + String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { if (_selectedHospital != null) return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 320ca8d1..9fb20630 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -168,7 +168,10 @@ class _AddMember extends State { request.regionID = 1; } loading(true); - familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)); + familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err){ + loading(false); + AppToast.showErrorToast(message: err); + }); } sendActivationCode(result) { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index bf8cc676..bbae70a5 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; @@ -20,8 +21,7 @@ class AmbulanceRequestIndexPage extends StatefulWidget { AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); @override - _AmbulanceRequestIndexPageState createState() => - _AmbulanceRequestIndexPageState(); + _AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); } class _AmbulanceRequestIndexPageState extends State { @@ -37,8 +37,7 @@ class _AmbulanceRequestIndexPageState extends State { setState(() { currentIndex = tab; }); - pageController.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + pageController.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override @@ -53,7 +52,7 @@ class _AmbulanceRequestIndexPageState extends State { return AppScaffold( body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null ? SingleChildScrollView( - child: Column( + child: Column( children: [ SizedBox( height: 10, @@ -69,9 +68,7 @@ class _AmbulanceRequestIndexPageState extends State { children: [ OrderLogItem( title: TranslationBase.of(context).reqId, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .id - .toString(), + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), ), OrderLogItem( title: TranslationBase.of(context).status, @@ -79,22 +76,19 @@ class _AmbulanceRequestIndexPageState extends State { ), OrderLogItem( title: TranslationBase.of(context).pickupDate, - value: getDate(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created), + value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), ), OrderLogItem( title: TranslationBase.of(context).pickupLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .pickupLocation, + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, ), OrderLogItem( title: TranslationBase.of(context).dropoffLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .dropOffLocation, + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, ), OrderLogItem( title: TranslationBase.of(context).transportMethod, - value: widget - .amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, ), Container( padding: EdgeInsets.all(10), @@ -111,9 +105,7 @@ class _AmbulanceRequestIndexPageState extends State { textColor: Colors.white, label: TranslationBase.of(context).cancel, onTap: () { - widget.amRequestViewModel.updatePressOrder( - presOrderID: widget.amRequestViewModel - .pendingAmbulanceRequestOrder.id); + widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); }, ), ) @@ -122,7 +114,7 @@ class _AmbulanceRequestIndexPageState extends State { ), ], ), - ) + ) : Column( children: [ SizedBox( @@ -172,9 +164,4 @@ class _AmbulanceRequestIndexPageState extends State { ), ); } - - String getDate(String date) { - return date.split("T")[0]; - } - } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index d05fae2f..850d308a 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -411,7 +411,7 @@ class _PickupLocationState extends State { widget.patientER_RC.transportationDetails.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); widget.patientER_RC.transportationDetails.pickupLocationName = widget.patientER.direction == 0 ? _selectedHospital.name : _result.formattedAddress; widget.patientER_RC.projectID = widget.amRequestViewModel.user.projectID; - widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID.toString(); + widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID; widget.patientER_RC.transportationDetails.requesterIsOutSA = false; // widget.patientER.lineItemNo = 0; widget.patientER_RC.transportationDetails.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index d2a74505..0a187918 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -302,7 +302,7 @@ class _SelectTransportationMethodState extends State widget.patientER_RC.transportationDetails.direction = _direction == Direction.ToHospital ? 1 : 0; widget.patientER_RC.transportationDetails.tripType = _way == Way.TwoWays ? 0 : 1; widget.patientER_RC.transportationDetails.ambulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER_RC.transportationDetails.transportationType = _erTransportationMethod.id.toString(); + widget.patientER_RC.transportationDetails.transportationType = _erTransportationMethod.iD.toString(); widget.patientER_RC.patientERTransportationMethod = _erTransportationMethod; widget.patientER_RC.transportationDetails.pickupUrgency = 1; // widget.patientER.orderServiceID = _orderService.getIdOrderService(); diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 3d492c83..4ecde680 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -28,7 +28,7 @@ class OrderLogPage extends StatelessWidget { children: [ OrderLogItem( title: TranslationBase.of(context).reqId, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].id.toString(), + value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].iD.toString(), ), OrderLogItem( title: TranslationBase.of(context).orderStatus, @@ -62,7 +62,7 @@ class OrderLogPage extends StatelessWidget { textColor: Colors.white, label: TranslationBase.of(context).cancel, onTap: () { - amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.id); + amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.iD); }, ), ) diff --git a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart index 2a1dd3c9..5f0506f3 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; class RRTLogPage extends StatefulWidget { final List orders; @@ -36,13 +36,15 @@ class RRTLogPageState extends State { viewModel = vm, }, builder: (ctx, vm, widgetState) { - return ListView.builder( - itemCount: widget.orders.length, - padding: EdgeInsets.all(21), - itemBuilder: (ctx, idx) { - var order = widget.orders[idx]; - return RRTLogListItem(order, onCancel: deleteOrder); - }); + return widget.orders.length > 0 + ? ListView.builder( + itemCount: widget.orders.length, + padding: EdgeInsets.all(21), + itemBuilder: (ctx, idx) { + var order = widget.orders[idx]; + return RRTLogListItem(order, onCancel: deleteOrder); + }) + : getNoDataWidget(context); }); } @@ -58,4 +60,4 @@ class RRTLogPageState extends State { Navigator.push(context, FadePage(page: RRTMainScreen())); } } -} +} \ No newline at end of file diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index c024b575..e9b1dfb6 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -1,12 +1,11 @@ -import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -14,7 +13,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class PrescriptionsHistoryDetailsPage extends StatelessWidget { - final PrescriptionsOrder prescriptionsOrder; + final GetCMCAllOrdersResponseModel prescriptionsOrder; PrescriptionsHistoryDetailsPage({Key key, this.prescriptionsOrder}); @@ -22,10 +21,10 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder), + onModelReady: (model) => model.getPrescriptionReportDetailsRC(), builder: (_, model, widget) { - int status = prescriptionsOrder.status; - String _statusDisp = projectViewModel.isArabic ? prescriptionsOrder.descriptionN : prescriptionsOrder.description; + int status = prescriptionsOrder.statusId; + String _statusDisp = prescriptionsOrder.statusText; Color _color; if (status == 1) { //pending @@ -36,7 +35,7 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { } else if (status == 3) { //completed _color = Color(0xff359846); - } else if (status == 4) { + } else if (status == 4 || status == 6 || status == 7) { //cancel // Rejected _color = Color(0xffD02127); } @@ -109,13 +108,9 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(prescriptionsOrder.createdOn), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsOrder.created)), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), - Text( - DateUtil.formatDateToTimeLang(prescriptionsOrder.createdOn, false), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), - ), ], ) ], @@ -134,7 +129,7 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(30)), child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, + model.prescriptionsOrderListRC[index].image, fit: BoxFit.cover, width: 48, height: 48, @@ -144,9 +139,9 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { SizedBox(width: 14), Expanded( child: Text( - (model.prescriptionReportEnhList[index].itemDescription.isNotEmpty - ? model.prescriptionReportEnhList[index].itemDescription - : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') + (model.prescriptionsOrderListRC[index].itemDescription.isNotEmpty + ? model.prescriptionsOrderListRC[index].itemDescription + : model.prescriptionsOrderListRC[index].itemDescription ?? '') .toLowerCase() .capitalizeFirstofEach, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), @@ -155,7 +150,7 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { ], ), separatorBuilder: (context, index) => SizedBox(height: 12), - itemCount: model.prescriptionReportEnhList.length) + itemCount: model.prescriptionsOrderListRC.length) ], ), ), @@ -168,9 +163,10 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( TranslationBase.of(context).cancelOrder, - prescriptionsOrder.status != 1 - ? null - : () { + // prescriptionsOrder.statusId != 1 + // ? null + // : + () { showCDialog(model, context); }, disabledColor: Color(0xff575757), diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index adce13bb..1de0ae1d 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -2,10 +2,12 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -52,17 +54,17 @@ class PrescriptionsHistoryPage extends StatelessWidget { return InkWell( onTap: () async { - // final result = await Navigator.push( - // context, - // FadePage( - // page: PrescriptionsHistoryDetailsPage( - // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], - // ), - // ), - // ); - // if (result != null) { - // showOrderLog(); - // } + final result = await Navigator.push( + context, + FadePage( + page: PrescriptionsHistoryDetailsPage( + prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + ), + ), + ); + if (result != null) { + showOrderLog(); + } }, child: Container( height: 65, From e1e31de8182571431ddfdedbc7ad044b21870543 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 2 Nov 2021 17:55:53 +0300 Subject: [PATCH 2/8] Lakum fixes --- lib/config/config.dart | 6 +++--- lib/pages/pharmacies/screens/lakum-main-page.dart | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f3444d3a..53588ac1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -26,7 +26,7 @@ const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// RC API URLs +// RC API URL const RC_BASE_URL = 'https://livecare.hmg.com/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 1547b929..c4415852 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -26,11 +26,21 @@ class LakumMainPage extends StatelessWidget { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLacumData(), + onModelReady: (model) async { + await model.getLacumData(); + if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) { + navigateToLakumRegister(context); + } else { + if (model.lacumInformation.status == "Hold") { + Navigator.pushReplacement(context, FadePage(page: LakumActivationVidaPage())); + } + } + }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).lakum, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, isShowDecPage: false, backgroundColor: Colors.white, baseViewModel: model, From 6f632502527373572f8aac83079be21fafdeac73 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 3 Nov 2021 11:44:28 +0300 Subject: [PATCH 3/8] fix issues --- .../viewModels/pharmacyModule/brand_view_model.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/core/viewModels/pharmacyModule/brand_view_model.dart b/lib/core/viewModels/pharmacyModule/brand_view_model.dart index 158d9cdb..71e68a0a 100644 --- a/lib/core/viewModels/pharmacyModule/brand_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -1,8 +1,11 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/brands_service.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import '../../../locator.dart'; @@ -22,18 +25,28 @@ class BrandsViewModel extends BaseViewModel{ Future getBrandsData() async { hasError = false; setState(ViewState.Busy); +// GifLoaderDialogUtils.showMyDialog( +// AppGlobal.context); await _brandsService.getBrands(); +// GifLoaderDialogUtils.hideDialog( +// AppGlobal.context); if (_brandsService.hasError) { error = _brandsService.error; setState(ViewState.ErrorLocal); } else +// GifLoaderDialogUtils.hideDialog( +// locator().navigatorKey.currentContext); setState(ViewState.Idle); } Future getTopBrandsData() async { hasError = false; setState(ViewState.Busy); + GifLoaderDialogUtils.showMyDialog( + AppGlobal.context); await _topBrandsService.getTopBrands(); + GifLoaderDialogUtils.hideDialog( + AppGlobal.context); if (_topBrandsService.hasError) { error = _topBrandsService.error; setState(ViewState.ErrorLocal); From 894cc0e3367611c5499eecd619f15fe0326422db Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 3 Nov 2021 18:11:36 +0300 Subject: [PATCH 4/8] Updates & fixes --- lib/config/config.dart | 11 +- lib/config/localized_values.dart | 6 +- lib/core/service/client/base_app_client.dart | 2 +- lib/core/service/hospital_service.dart | 5 +- .../NewCMC/new_cmc_step_tow_page.dart | 1 - .../new_home_health_care_page.dart | 22 +- lib/pages/Blood/blood_donation.dart | 14 +- .../covid-drivethru-location.dart | 1 - .../covid-payment-details.dart | 68 --- lib/pages/ErService/AmbulanceReq.dart | 2 +- .../BillAmount.dart | 442 ++++++++------- .../PickupLocation.dart | 437 +++++++++------ .../SelectTransportationMethod.dart | 245 +++++---- .../AmbulanceRequestIndexPages/Summary.dart | 101 ++-- lib/pages/ErService/ErOptions.dart | 15 +- lib/pages/ErService/OrderLogPage.dart | 5 +- .../rrt-order-list-item.dart | 30 +- .../rrt-pickup-address-page.dart | 7 +- .../rapid-response-team/rrt-place-order.dart | 2 +- .../rapid-response-team/rrt-request-page.dart | 4 +- lib/pages/ErService/widgets/StepsWidget.dart | 507 +++++++++++------- lib/pages/ToDoList/payment_method_select.dart | 88 +-- .../medical/balance/advance_payment_page.dart | 8 +- lib/uitl/translations_delegate_base.dart | 8 + lib/widgets/drawer/app_drawer_widget.dart | 37 +- .../pickupLocation/PickupLocationFromMap.dart | 31 +- 26 files changed, 1150 insertions(+), 949 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 53588ac1..694cb602 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -85,8 +85,11 @@ const SEND_RAD_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendRadReportEmai ///Feedback const SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList'; const GET_STATUS_FOR_COCO = 'Services/COCWS.svc/REST/GetStatusforCOC'; +// const GET_PATIENT_AppointmentHistory = 'Services' +// '/Doctors.svc/REST/PateintHasAppoimentHistory'; + const GET_PATIENT_AppointmentHistory = 'Services' - '/Doctors.svc/REST/PateintHasAppoimentHistory'; + '/Doctors.svc/REST/PateintHasAppoimentHistory_Async'; ///VITAL SIGN const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; @@ -166,7 +169,8 @@ const INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertReque const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate -const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; +// const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; +const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async'; const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; const NEW_RATE_APPOINTMENT_URL = "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate"; const NEW_RATE_DOCTOR_URL = "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate"; @@ -207,7 +211,8 @@ const SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescr const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; //URL to get patient appointment curfew history -const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; +// const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; +const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async"; //URL to confirm appointment const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 207a65d7..8a80f0ea 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -625,7 +625,7 @@ const Map localizedValues = { "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, - "select": {"en": "Select", "ar": "يختار"}, + "select": {"en": "Select", "ar": "اختر"}, "i-am": {"en": "I am", "ar": "أنا"}, "years-old": {"en": "years old", "ar": "سنة"}, "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, @@ -1626,4 +1626,8 @@ const Map localizedValues = { "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, "laserClinic": {"en": "Laser Clinic", "ar": "عيادة الليزر"}, "noImage": {"en": "No Image", "ar": "لا توجد صورة"}, + "signoutMessage": {"en": "Are you sure you want to logout?", "ar": "هل أنت متأكد أنك تريد تسجيل الخروج؟"}, + "RRTTitle": {"en": "RRT", "ar": "خدمة فريق"}, + "RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"}, + "transportation": {"en": "Transportation", "ar": "النقل"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 696cda28..322ec08b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -124,7 +124,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1009199553; // body['MobileNo'] = "966545156035"; - // body['PatientID'] = 1018977; + // body['PatientID'] = 1018977; //3844083 // body['TokenID'] = "@dm!n"; body.removeWhere((key, value) => key == null || value == null); diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index b9e970e1..46bc95f9 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:geolocator/geolocator.dart'; @@ -25,8 +26,8 @@ class HospitalService extends BaseService { if(isResBasedOnLoc) await _getCurrentLocation(); Map body = Map(); - body['Latitude'] = isResBasedOnLoc?_latitude:0; - body['Longitude'] = isResBasedOnLoc?_longitude:0; + body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); + body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); body['IsOnlineCheckIn'] = isResBasedOnLoc; body['PatientOutSA'] = 0; diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 0d859690..89d58317 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -170,7 +170,6 @@ class _NewCMCStepTowPageState extends State { child: Container( padding: EdgeInsets.all(8), width: double.infinity, - // height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 75c68127..82f91cff 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -149,23 +149,15 @@ class _NewHomeHealthCarePageState extends State with Tick crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).serviceName + ": ", + TranslationBase.of(context).hospital + ": ", style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), - Column( - children: [ - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - child: Texts( - projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), - fontSize: 13, - bold: false, - ), - ), - ) - ], - ) + Expanded( + child: Text( + widget.model.pendingOrder.nearestProjectName.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), ], ) ], diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index d9dbcf4b..3a702d32 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -2,11 +2,8 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -44,12 +41,9 @@ class _BloodDonationPageState extends State { String amount = ""; String email; - AuthenticatedUser authenticatedUser; - GetAllSharedRecordsByStatusList selectedPatientFamily; - AdvanceModel advanceModel = AdvanceModel(); + List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; var checkedValue = false; List imagesInfo = List(); @@ -60,9 +54,7 @@ class _BloodDonationPageState extends State { imagesInfo.add( ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), ); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (projectProvider.isLogin) authUser = projectProvider.user; - }); + WidgetsBinding.instance.addPostFrameCallback((_) {}); super.initState(); } @@ -82,7 +74,7 @@ class _BloodDonationPageState extends State { return BaseView( onModelReady: (model) { - if (projectProvider.isLogin) { + if (projectProvider.isLogin && projectProvider.user != null) { model.getCities().then((value) { model.getBlood().then((value) { if (model.bloodModelList.length > 0) { diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index 0d169ef8..a0842a73 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -58,7 +58,6 @@ class _CovidDrivethruLocationState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png')); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index e567dbe7..2301de51 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -55,51 +55,6 @@ class _CovidPaymentDetailsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // Container( - // height: 150.0, - // decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage( - // "assets/images/new-design/covid-19-big-banner-bg.png"), - // fit: BoxFit.fill, - // ), - // color: Colors.white.withOpacity(0.3), - // borderRadius: BorderRadius.all(Radius.circular(10))), - // child: Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // margin: - // EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), - // child: SvgPicture.asset( - // 'assets/images/new-design/covid-19-car.svg', - // width: 90.0, - // height: 90.0), - // ), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // margin: EdgeInsets.only( - // left: 20.0, right: 20.0, top: 20.0), - // child: Text(TranslationBase.of(context).covidTest, - // style: TextStyle( - // color: Colors.white, - // fontWeight: FontWeight.bold, - // fontSize: 24.0)), - // ), - // Container( - // margin: EdgeInsets.only( - // left: 20.0, right: 20.0, top: 10.0), - // child: Text(TranslationBase.of(context).driveThru, - // style: TextStyle( - // color: Colors.white, fontSize: 24.0)), - // ), - // ], - // ), - // ], - // ), - // ), Text(TranslationBase.of(context).covidSelectProcedure, style: TextStyle(color: Colors.black, fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold)), ...List.generate( widget.proceduresList.length, @@ -144,29 +99,6 @@ class _CovidPaymentDetailsState extends State { fontWeight: FontWeight.w600, ), ), - // ListTile( - // title: Text( - // projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName, - // style: TextStyle( - // fontSize: 12.0, - // letterSpacing: -0.48, - // fontWeight: FontWeight.w600, - // ), - // ), - // leading: Radio( - // value: widget.proceduresList[index], - // groupValue: widget.selectedProcedure, - // activeColor: Colors.red[800], - // toggleable: true, - // onChanged: (value) { - // setState(() { - // widget.selectedProcedure = value; - // print(widget.selectedProcedure.procedureName); - // getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); - // }); - // }, - // ), - // ), ], ), ), diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 939c138c..3803bcd4 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -78,7 +78,7 @@ class _AmbulanceReqState extends State with SingleTickerProviderSt ), Expanded( child: TabBarView( - physics: BouncingScrollPhysics(), + physics: NeverScrollableScrollPhysics(), controller: _tabController, children: [ AmbulanceRequestIndexPage( diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index 11950cef..e571e4e8 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -2,10 +2,9 @@ import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; -import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -45,269 +44,229 @@ class _BillAmountState extends State { body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).billAmount), + Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 10, ), - Table( - border: TableBorder.symmetric(inside: BorderSide(width: 1.0, color: Colors.grey[300]), outside: BorderSide(width: 1.0, color: Colors.grey[300])), - children: [ - TableRow( + Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + // Text(TranslationBase.of(context).testFee, + // style: TextStyle( + // color: Colors.black, + // fontSize: 16.0, + // fontWeight: FontWeight.w600, + // letterSpacing: -0.64, + // )), Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareB, - textAlign: TextAlign.start, - color: Colors.black, - fontSize: 15, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', isBold: true), + ) + ], ), ), + mDivider(Colors.grey[200]), Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientTaxToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', isBold: true), + ) + ], ), ), - ], - ), - TableRow( - children: [ + mDivider(Colors.grey[200]), Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.09, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTax, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', isBold: true, isTotal: true), + ) + ], ), ), ], ), - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTotal, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - bold: true, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - ], - ), - ], + ), ), SizedBox( height: 10, ), - Texts( - TranslationBase.of(context).selectAmbulate, - bold: false, - ), + Text(TranslationBase.of(context).selectAmbulate, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Row( children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Wheelchair; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).wheelchair, style: TextStyle( - fontSize: 14.0 - )), - leading: Radio( - value: Ambulate.Wheelchair, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Wheelchair; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).wheelchair, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Walker; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).walker, style: TextStyle( - fontSize: 14.0 - )), - leading: Radio( - value: Ambulate.Walker, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + ], + ), + Row( + children: [ + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Walker; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).walker, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), ], ), - SizedBox( - height: 5, - ), Row( children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Stretcher; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).stretcher, style: TextStyle( - fontSize: 14.0 - )), - leading: Radio( - value: Ambulate.Stretcher, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Stretcher; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).stretcher, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.None; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).none, style: TextStyle( - fontSize: 14.0 - )), - leading: Radio( - value: Ambulate.None, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + ], + ), + Row( + children: [ + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.None; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.None, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).none, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -317,14 +276,21 @@ class _BillAmountState extends State { SizedBox( height: 12, ), - NewTextFields( - hintText: TranslationBase.of(context).notes, - initialValue: note, - onChanged: (value) { - setState(() { - note = value; - }); - }, + Container( + decoration: cardRadius(10), + child: Padding( + padding: EdgeInsets.all(8.0), + child: TextField( + maxLines: 5, + decoration: InputDecoration.collapsed( + hintText: TranslationBase.of(context).notes, hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16)), + onChanged: (value) { + setState(() { + note = value; + }); + }, + ), + ), ), SizedBox( height: 100, @@ -352,4 +318,20 @@ class _BillAmountState extends State { ), ); } + + _getNormalText(text, {bool isBold = false, bool isTotal = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold + ? isTotal + ? 16 + : 12 + : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index 850d308a..0e63bf76 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/Blood/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -13,12 +12,12 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; @@ -51,9 +50,7 @@ class _PickupLocationState extends State { void initState() { super.initState(); _getCurrentLocation(); - setState(() { - - }); + setState(() {}); } _getCurrentLocation() async { @@ -64,7 +61,6 @@ class _PickupLocationState extends State { _longitude = 0; _latitude = 0; }); - } @override @@ -75,7 +71,7 @@ class _PickupLocationState extends State { body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -83,43 +79,66 @@ class _PickupLocationState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).pickupLocation), + Text(TranslationBase.of(context).pickupLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 15, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: _latitude??0, - longitude: _longitude??0, - onPick: (value) { - setState(() { - _result = value; - }); - }, - )), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: _latitude ?? 0, + longitude: _longitude ?? 0, + onPick: (value) { + setState(() { + _result = value; + }); + }, + )), + ); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectMap, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getSelectFromMapName(context), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -127,7 +146,7 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).pickupSpot), + Text(TranslationBase.of(context).pickupSpot, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -138,21 +157,27 @@ class _PickupLocationState extends State { }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).insideHome), - leading: Checkbox( - value: _isInsideHome, - onChanged: (value) { - setState(() { - _isInsideHome = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Checkbox( + value: _isInsideHome, + onChanged: (value) { + setState(() { + _isInsideHome = value; + }); + }, + ), + Text( + TranslationBase.of(context).insideHome, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -160,7 +185,7 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).haveAppo), + Text(TranslationBase.of(context).haveAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -177,25 +202,31 @@ class _PickupLocationState extends State { } }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).yes), - leading: Radio( - value: HaveAppointment.YES, - groupValue: _haveAppointment, - onChanged: (value) { - if (myAppointment == null) { - getAppointment(); - setState(() { - _haveAppointment = value; - }); - } - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + Text( + TranslationBase.of(context).yes, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -210,23 +241,29 @@ class _PickupLocationState extends State { }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).no), - leading: Radio( - value: HaveAppointment.NO, - groupValue: _haveAppointment, - onChanged: (value) { - setState(() { - _haveAppointment = value; - myAppointment = null; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + onChanged: (value) { + setState(() { + _haveAppointment = value; + myAppointment = null; + }); + }, + ), + Text( + TranslationBase.of(context).no, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -249,31 +286,54 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).dropoffLocation), + Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 8, ), - InkWell( - onTap: () { - confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName(TranslationBase.of(context).selectHospital)), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getHospitalName(""), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -284,26 +344,54 @@ class _PickupLocationState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).pickupLocation), + Text(TranslationBase.of(context).pickupLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 15, ), - InkWell( - onTap: () { - confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); + }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getHospitalName(""), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), Icon( Icons.arrow_drop_down, size: 24, @@ -316,44 +404,67 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).dropoffLocation), + Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 8, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, - ), - ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), + ), + ); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectMap, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getSelectFromMapName(context), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -442,16 +553,22 @@ class _PickupLocationState extends State { ); } + int _selectedHospitalIndex = -1; + void confirmSelectHospitalDialog(List hospitals) { + List list = [ + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; showDialog( context: context, - child: SelectHospitalDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = hospitals[index]; + setState(() {}); }, ), ); @@ -462,7 +579,7 @@ class _PickupLocationState extends State { } String getSelectFromMapName(context) { - return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap; + return _result != null ? _result.formattedAddress : ""; } getAppointment() { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 0a187918..e3c8ccf2 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -5,8 +5,8 @@ import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -71,56 +71,77 @@ class _SelectTransportationMethodState extends State SizedBox( height: 12, ), - Texts(TranslationBase.of(context).transportHeading), - ...List.generate( - widget.amRequestViewModel.amRequestModeList.length, - (index) => InkWell( - onTap: () { - setState(() { - _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index]; - }); - }, - child: Container( - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - children: [ - Expanded( - flex: 3, - child: ListTile( - title: Texts(projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text), - leading: Radio( - value: widget.amRequestViewModel.amRequestModeList[index], - groupValue: _erTransportationMethod, - onChanged: (value) { - setState(() { - _erTransportationMethod = value; - }); - }, - ), + Text(TranslationBase.of(context).transportHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), + Container( + margin: EdgeInsets.only(top: 12), + decoration: cardRadius(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + widget.amRequestViewModel.amRequestModeList.length, + (index) => InkWell( + onTap: () { + setState(() { + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index]; + }); + }, + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 4, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: widget.amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), + Flexible( + child: Text( + projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + ), + Expanded( + flex: 1, + child: Text( + TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}', + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ) + ], ), ), - Expanded( - flex: 1, - child: Texts(TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), - ) - ], + ), ), - ), + ], ), ), SizedBox( height: 12, ), - Texts(TranslationBase.of(context).directionHeading), - SizedBox( - height: 5, - ), + Text(TranslationBase.of(context).directionHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), Container( width: double.maxFinite, child: Row( @@ -136,22 +157,26 @@ class _SelectTransportationMethodState extends State }, child: Container( width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).toHospital), - leading: Radio( - value: Direction.ToHospital, - groupValue: _direction, - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Direction.ToHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + Text(TranslationBase.of(context).toHospital, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -166,22 +191,26 @@ class _SelectTransportationMethodState extends State }, child: Container( width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).fromHospital), - leading: Radio( - value: Direction.FromHospital, - groupValue: _direction, - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Direction.FromHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + Text(TranslationBase.of(context).fromHospital, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -197,7 +226,7 @@ class _SelectTransportationMethodState extends State SizedBox( height: 8, ), - Texts(TranslationBase.of(context).wayHeading), + Text(TranslationBase.of(context).wayHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -213,22 +242,26 @@ class _SelectTransportationMethodState extends State }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).oneDirec), - leading: Radio( - value: Way.OneWay, - groupValue: _way, - onChanged: (value) { - setState(() { - _way = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Way.OneWay, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + Text(TranslationBase.of(context).oneDirec, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -242,22 +275,26 @@ class _SelectTransportationMethodState extends State }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).twoDirec), - leading: Radio( - value: Way.TwoWays, - groupValue: _way, - onChanged: (value) { - setState(() { - _way = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Way.TwoWays, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + Text(TranslationBase.of(context).twoDirec, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 21bb5e89..4b59a8fa 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -3,8 +3,8 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -31,91 +31,73 @@ class _SummaryState extends State { isShowAppBar: false, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).RRTSummary), + Text(TranslationBase.of(context).RRTSummary, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Container( width: double.infinity, padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), + // margin: EdgeInsets.only(top: 12), + decoration: cardRadius(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).transportMethod, - color: Colors.grey, - ), + _getNormalText(TranslationBase.of(context).transportMethod), projectViewModel.isArabic - ? Texts( + ? _getNormalText( '${widget.patientER_RC.patientERTransportationMethod.textN}', - bold: true, + isBold: true, ) - : Texts( + : _getNormalText( '${widget.patientER_RC.patientERTransportationMethod.text}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).directions, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).directions), + _getNormalText( widget.patientER_RC.transportationDetails.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital, - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( + _getNormalText( TranslationBase.of(context).pickupLocation, - color: Colors.grey, ), - Texts( + _getNormalText( '${widget.patientER_RC.transportationDetails.pickupLocationName}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).dropoffLocation, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).dropoffLocation), + _getNormalText( '${widget.patientER_RC.transportationDetails.dropoffLocationName}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).selectAmbulate, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).selectAmbulate), + _getNormalText( '${widget.patientER_RC.transportationDetails.ambulateTitle}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).notes, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).notes), + _getNormalText( '${widget.patientER_RC.transportationDetails.notes ?? '---'}', - bold: true, + isBold: true, ), SizedBox( height: 8, @@ -126,23 +108,26 @@ class _SummaryState extends State { SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).billAmount, - textAlign: TextAlign.start, - ), + Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Container( height: 55, padding: EdgeInsets.all(10), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), + decoration: cardRadius(12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).patientShareTotal + ':'), Texts(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}')], + children: [ + _getNormalText(TranslationBase.of(context).patientShareTotal + ':'), + Container( + padding: EdgeInsets.only(left: 20.0, right: 20.0), + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', isBold: true, isTotal: true) + ), + ], ), ), - SizedBox(height: 130), + SizedBox(height: 50), ], ), ), @@ -156,4 +141,20 @@ class _SummaryState extends State { ), ); } + + _getNormalText(text, {bool isBold = false, bool isTotal = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold + ? isTotal + ? 16 + : 12 + : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } } diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 095ad884..88b21b11 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -9,7 +9,6 @@ import 'package:provider/provider.dart'; import '../../uitl/translations_delegate_base.dart'; import 'AmbulanceReq.dart'; -import 'EdOnline/DdServicesPage.dart'; import 'NearestEr.dart'; class ErOptions extends StatefulWidget { @@ -75,26 +74,26 @@ class _ErOptionsState extends State { ), InkWell( onTap: () { - // Navigator.push(context, FadePage(page: DdServicesPage())); + if (rrtLocked) Navigator.push(context, FadePage(page: RRTMainScreen())); }, child: MedicalProfileItem( - title: "ED", + title: TranslationBase.of(context).RRTTitle, imagePath: 'assets/images/new-design/AM.PNG', - subTitle: TranslationBase.of(context).service, + subTitle: TranslationBase.of(context).RRTSubTitle, isPngImage: true, - isEnable: false, + isEnable: rrtLocked, ), ), InkWell( onTap: () { - if(rrtLocked) Navigator.push(context, FadePage(page: RRTMainScreen())); + // Navigator.push(context, FadePage(page: DdServicesPage())); }, child: MedicalProfileItem( - title: TranslationBase.of(context).rrtService, + title: "ED", imagePath: 'assets/images/new-design/AM.PNG', subTitle: TranslationBase.of(context).service, isPngImage: true, - isEnable: rrtLocked, + isEnable: false, ), ), ], diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 4ecde680..9bb56b9c 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; import 'package:flutter/cupertino.dart'; @@ -15,7 +16,7 @@ class OrderLogPage extends StatelessWidget { return Container( margin: EdgeInsets.all(10), padding: EdgeInsets.all(8), - child: ListView.builder( + child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 ? ListView.builder( itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, itemBuilder: (context, index) => Container( margin: EdgeInsets.all(8), @@ -69,7 +70,7 @@ class OrderLogPage extends StatelessWidget { ], ), ), - ), + ) : getNoDataWidget(context), ); } diff --git a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart index 8a4f1e18..dfb7cdaa 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart @@ -103,21 +103,21 @@ class RRTLogListItemState extends State { '${TranslationBase.of(context).requestID}: ${widget.order.iD}', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).locationa + ": ", - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), - ), - Expanded( - child: Text( - widget.order.projectName.toString(), - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), - ), - ), - ], - ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // TranslationBase.of(context).locationa + ": ", + // style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + // ), + // Expanded( + // child: Text( + // widget.order.projectName.toString(), + // style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + // ), + // ), + // ], + // ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index 0a25ca7a..9d9ca428 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -43,7 +43,7 @@ class RRTRequestPickupAddressPageState extends State { child: Text(TranslationBase.of(context).youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)), - paymentOptions(), + Container(margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), child: getPaymentMethods()) ], ), ), diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart index 56b3de6b..219cfd60 100644 --- a/lib/pages/ErService/widgets/StepsWidget.dart +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -12,216 +14,331 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return projectViewModel.isArabic? - Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, + return Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12, bottom: 12), + child: Row( + children: [ + Expanded( + child: showProgress( + title: TranslationBase.of(context).transportation, + status: index == 0 + ? TranslationBase.of(context).inPrgress + : index > 0 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 0 ? CustomColors.orange : CustomColors.green, ), ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).locationa, + status: index == 1 + ? TranslationBase.of(context).inPrgress + : index > 1 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 1 + ? CustomColors.orange + : index > 1 + ? CustomColors.green + : CustomColors.grey2, ), ), - ), - Positioned( - top: 10, - right: MediaQuery.of(context).size.width * 0.3, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).otherInfo, + status: index == 2 + ? TranslationBase.of(context).inPrgress + : index > 2 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 2 + ? CustomColors.orange + : index > 2 + ? CustomColors.green + : CustomColors.grey2, ), ), - ), - Positioned( - top: 10, - right: MediaQuery.of(context).size.width * 0.6, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), - ), + showProgress( + title: TranslationBase.of(context).RRTSummary, + status: index == 3 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked, + color: index == 3 + ? CustomColors.orange + : index > 4 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3):null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: Border.all(color: Colors.black,width: 0.75), + ], + ), + ); - shape: BoxShape.circle, - color: index == 3 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '4', - color: index == 3 ? Colors.white : Colors.grey[800], - ), - ), - ), - ), - ), - ], - ): - Stack( + // return projectViewModel.isArabic? + // Stack( + // children: [ + // Container( + // height: 50, + // width: MediaQuery.of(context).size.width, + // color: Colors.transparent, + // child: Center( + // child: Divider( + // color: Colors.grey, + // height: 0.75, + // thickness: 0.75, + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: 0, + // child: InkWell( + // onTap: () => changeCurrentTab(0), + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '1', + // color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: MediaQuery.of(context).size.width * 0.3, + // child: InkWell( + // onTap: () => index >= 2 ? changeCurrentTab(1) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '2', + // color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: MediaQuery.of(context).size.width * 0.6, + // child: InkWell( + // onTap: () => index >= 3 ? changeCurrentTab(2) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + // color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '3', + // color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: 0, + // child: InkWell( + // onTap: () => index == 2 ?changeCurrentTab(3):null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.black,width: 0.75), + // + // shape: BoxShape.circle, + // color: index == 3 ? Colors.grey[800] : Colors.white, + // ), + // child: Center( + // child: Texts( + // '4', + // color: index == 3 ? Colors.white : Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // ], + // ): + // Stack( + // children: [ + // Container( + // height: 50, + // width: MediaQuery.of(context).size.width, + // color: Colors.transparent, + // child: Center( + // child: Divider( + // color: Colors.grey, + // height: 0.75, + // thickness: 0.75, + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: 0, + // child: InkWell( + // onTap: () => changeCurrentTab(0), + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '1', + // color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: MediaQuery.of(context).size.width * 0.3, + // child: InkWell( + // onTap: () => index >= 2 ? changeCurrentTab(1) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '2', + // color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: MediaQuery.of(context).size.width * 0.6, + // child: InkWell( + // onTap: () => index >= 3 ? changeCurrentTab(2) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + // color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '3', + // color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: 0, + // child: InkWell( + // onTap: () => index == 2 ?changeCurrentTab(3):null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.black,width: 0.75), + // + // shape: BoxShape.circle, + // color: index == 3 ? Colors.grey[800] : Colors.white, + // ), + // child: Center( + // child: Texts( + // '4', + // color: index == 3 ? Colors.white : Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // ], + // ); + } + + Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.3, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 26, + height: 26, + decoration: containerRadius(color, 200), + child: Icon( + Icons.done, + color: Colors.white, + size: 16, + ), ), - ), + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: mDivider(Colors.grey), + )), + ], ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.6, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), + mHeight(8), + Text( + title, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.44, ), ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3):null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: Border.all(color: Colors.black,width: 0.75), - - shape: BoxShape.circle, - color: index == 3 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '4', - color: index == 3 ? Colors.white : Colors.grey[800], + mHeight(2), + Container( + padding: EdgeInsets.all(5), + decoration: containerRadius(color.withOpacity(0.2), 4), + child: Text( + status, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, ), ), ), - ), - ), + ], + ) ], ); } diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 1cccf517..21b08fc3 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -8,8 +8,9 @@ import 'package:flutter/material.dart'; class PaymentMethod extends StatefulWidget { Function onSelectedMethod; + bool isShowInstallments; - PaymentMethod({this.onSelectedMethod}); + PaymentMethod({this.onSelectedMethod, this.isShowInstallments = false}); @override _PaymentMethodState createState() => _PaymentMethodState(); @@ -185,55 +186,56 @@ class _PaymentMethodState extends State { ), ), ), - Container( - width: double.infinity, - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("Installment"); - }, - child: Card( - elevation: 0.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "Installment" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), - ), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - children: [ - Container( - width: 24, - height: 24, - decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "Installment" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), - ), - mWidth(12), - Container( - height: 60.0, - padding: EdgeInsets.all(7.0), - width: 60, - child: Image.asset("assets/images/new/payment/installments.png"), - ), - mFlex(1), - if (selectedPaymentMethod == "Installment") + if (widget.isShowInstallments) + Container( + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("Installment"); + }, + child: Card( + elevation: 0.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "Installment" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ Container( - decoration: containerRadius(CustomColors.green, 200), - padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), - child: Text( - TranslationBase.of(context).paymentSelected, - style: TextStyle( - color: Colors.white, - fontSize: 11, + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "Installment" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/installments.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "Installment") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), ), ), - ), - ], + ], + ), ), ), ), ), - ), Platform.isIOS ? Container( width: double.infinity, diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 6ade52bd..a7f308af 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -313,9 +313,11 @@ class _AdvancePaymentPageState extends State { Navigator.push( context, FadePage( - page: PaymentMethod(onSelectedMethod: (String metohd) { - setState(() {}); - }), + page: PaymentMethod( + onSelectedMethod: (String metohd) { + setState(() {}); + }, + isShowInstallments: num.tryParse(amount) >= 1000 ? true : false), ), ).then( (value) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0bdfb6f7..b15f7adb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2610,6 +2610,14 @@ class TranslationBase { String get laserClinic => localizedValues["laserClinic"][locale.languageCode]; String get noImage => localizedValues["noImage"][locale.languageCode]; + + String get signoutMessage => localizedValues["signoutMessage"][locale.languageCode]; + + String get RRTTitle => localizedValues["RRTTitle"][locale.languageCode]; + + String get RRTSubTitle => localizedValues["RRTSubTitle"][locale.languageCode]; + + String get transportation => localizedValues["transportation"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index affcb02a..9e5a88d4 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -28,6 +28,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -475,20 +476,28 @@ class _AppDrawerState extends State { } logout() async { - authenticatedUserObject.logout(); - projectProvider.isLogin = false; - await authenticatedUserObject.getUser(); - _vitalSignService.heightCm = ""; - _vitalSignService.weightKg = ""; - await _privilegeService.getPrivilege(); - projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); - var appLanguage = await sharedPref.getString(APP_LANGUAGE); - await sharedPref.clear(); - await sharedPref.setString(APP_LANGUAGE, appLanguage); - await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); - this.user = null; - Navigator.of(context).pushNamed(HOME); - // projectProvider.platformBridge().unRegisterHmgGeofences(); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).signoutMessage, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + authenticatedUserObject.logout(); + projectProvider.isLogin = false; + await authenticatedUserObject.getUser(); + _vitalSignService.heightCm = ""; + _vitalSignService.weightKg = ""; + await _privilegeService.getPrivilege(); + projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); + var appLanguage = await sharedPref.getString(APP_LANGUAGE); + await sharedPref.clear(); + await sharedPref.setString(APP_LANGUAGE, appLanguage); + await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + this.user = null; + Navigator.of(context).pushNamed(HOME); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); } login() async { diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index d1efeef6..b0a67980 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -30,19 +31,23 @@ class PickupLocationFromMap extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( - appBar: isWithAppBar - ? AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text('Location'), - leading: CloseBack(), - centerTitle: true, - ) - : null, + return AppScaffold( + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).selectLocation, + // appBar: isWithAppBar + // ? AppBar( + // elevation: 0, + // textTheme: TextTheme( + // headline6: + // TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + // ), + // title: Text('Location'), + // leading: CloseBack(), + // centerTitle: true, + // ) + // : null, body: PlacePicker( apiKey: GOOGLE_API_KEY, enableMyLocationButton: true, From 23acdfd494aeeef991314f2d61f04c395f7c6305 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 4 Nov 2021 09:53:11 +0300 Subject: [PATCH 5/8] fix loader issue and design --- lib/config/localized_values.dart | 2 +- .../pharmacyModule/brand_view_model.dart | 14 +- lib/pages/pharmacies/product-brands.dart | 209 +++++++++--------- .../screens/cart-page/cart-order-page.dart | 2 +- lib/pages/pharmacy/profile/profile.dart | 3 + lib/widgets/pharmacy/product_tile.dart | 7 +- 6 files changed, 118 insertions(+), 119 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 207a65d7..dd0de321 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -494,7 +494,7 @@ const Map localizedValues = { "lakumPoint": {"en": "Point", "ar": "نقطه"}, "wishlist": {"en": "Wishlist", "ar": "المفضلة"}, "products": {"en": "Products", "ar": "المنتجات"}, - "reviews": {"en": "Reviews", "ar": "التقيمات"}, + "reviews": {"en": "Reviews", "ar": "التقييمات"}, "brands": {"en": "Brands", "ar": "العلامات التجارية"}, "productDetails": {"en": "Product Details", "ar": "تفاصيل المنتج"}, "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, diff --git a/lib/core/viewModels/pharmacyModule/brand_view_model.dart b/lib/core/viewModels/pharmacyModule/brand_view_model.dart index 71e68a0a..6c2a00fc 100644 --- a/lib/core/viewModels/pharmacyModule/brand_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -4,8 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/topBrandsModel.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/brands_service.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; + import '../../../locator.dart'; @@ -25,28 +24,19 @@ class BrandsViewModel extends BaseViewModel{ Future getBrandsData() async { hasError = false; setState(ViewState.Busy); -// GifLoaderDialogUtils.showMyDialog( -// AppGlobal.context); + await _brandsService.getBrands(); -// GifLoaderDialogUtils.hideDialog( -// AppGlobal.context); if (_brandsService.hasError) { error = _brandsService.error; setState(ViewState.ErrorLocal); } else -// GifLoaderDialogUtils.hideDialog( -// locator().navigatorKey.currentContext); setState(ViewState.Idle); } Future getTopBrandsData() async { hasError = false; setState(ViewState.Busy); - GifLoaderDialogUtils.showMyDialog( - AppGlobal.context); await _topBrandsService.getTopBrands(); - GifLoaderDialogUtils.hideDialog( - AppGlobal.context); if (_topBrandsService.hasError) { error = _topBrandsService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index 7b6c6fd6..15960b30 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -34,117 +35,121 @@ class _ProductBrandsPageState extends State { isPharmacy: true, isShowDecPage: false, body: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Container( - color: Colors.white, - alignment: languageID == 'ar' - ? Alignment.topRight - : Alignment.topLeft, - padding: languageID == 'ar' - ? EdgeInsets.only(right: 10.0, top: 10.0) - : EdgeInsets.only(left: 10.0, top: 10.0), - child: Text( - TranslationBase.of(context).topBrands, - style: TextStyle( - fontWeight: FontWeight.bold, + child: NetworkBaseView( + baseViewModel: model, + isLocalLoader:true, + child: Container( + child: Column( + children: [ + Container( + color: Colors.white, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10.0, top: 10.0) + : EdgeInsets.only(left: 10.0, top: 10.0), + child: Text( + TranslationBase.of(context).topBrands, + style: TextStyle( + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - height: 220, - width: double.infinity, - color: Colors.white, - child: topBrand(context), - ), - SizedBox( - height: 10, - ), - Container( - height: MediaQuery.of(context).size.height * 0.076, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), + Container( + height: 220, + width: double.infinity, color: Colors.white, + child: topBrand(context), ), - child: topBrand(context), - ), - SizedBox( - height: 10, - ), - Container( - height: MediaQuery.of(context).size.height * 0.056, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - color: Colors.white, + SizedBox( + height: 10, ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), + Container( + height: MediaQuery.of(context).size.height * 0.076, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, ), - onTap: () { - Navigator.push( - context, - FadePage(page: SearchBrandsPage()), - ); - }, + child: topBrand(context), ), - ), - SizedBox( - height: 10, - ), - Container( - height: 250, - width: double.infinity, - color: Colors.white, - child: ListView.builder( - itemCount: model.brandsListList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Container( - margin: EdgeInsets.only(top: 50, left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - languageID == 'ar' - ? Text(model.brandsListList[index].namen) - : Text(model.brandsListList[index].name), - SizedBox( - height: 3, - ), - Divider(height: 1, color: Colors.grey) - ], + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.066, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => FinalProductsPage( - id: model.brandsListList[index].id - .toString(), - )), - ); - }, + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + FadePage(page: SearchBrandsPage()), ); - }), - ), - ], + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 250, + width: double.infinity, + color: Colors.white, + child: ListView.builder( + itemCount: model.brandsListList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Container( + margin: EdgeInsets.only(top: 50, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + languageID == 'ar' + ? Text(model.brandsListList[index].namen) + : Text(model.brandsListList[index].name), + SizedBox( + height: 3, + ), + Divider(height: 1, color: Colors.grey) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage( + id: model.brandsListList[index].id + .toString(), + )), + ); + }, + ); + }), + ), + ], + ), ), ), ), diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 69aaa04e..9c6fa42e 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -347,7 +347,7 @@ class _OrderBottomWidgetState extends State { child: Icon( Icons.info, size: 25, - color: Color(0xff005aff), + color: Color(0xFF4CAF50), // color: Color(0xff005aff), ), ), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index f4534a01..8362b2c8 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -18,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -90,7 +91,9 @@ class _ProfilePageState extends State { return BaseView( onModelReady: (model) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + GifLoaderDialogUtils.showMyDialog(context); model.getOrder(customerId, page_id); + GifLoaderDialogUtils.hideDialog(context); }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 3b89c49c..c63410ba 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -129,7 +129,7 @@ class productTile extends StatelessWidget { ), ), Text( - '$approvedTotalReviews', + '${approvedTotalReviews} ${TranslationBase.of(context).reviews}', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ], @@ -159,7 +159,7 @@ class productTile extends StatelessWidget { icon: Icon( Icons.shopping_cart, size: 18, - color: Colors.blue, + color: Colors.green, ), onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); @@ -253,7 +253,8 @@ class productTile extends StatelessWidget { // alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: '($productReviews reviews)', + text: '${productReviews} ${TranslationBase.of(context).reviews}', +// text: '($productReviews reviews)', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), From f995a9fa8e9e84d63f8e72b095d8ad7a99b42173 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 13:19:14 +0300 Subject: [PATCH 6/8] Ambulance request UI revamped --- .../notification_details_page.dart | 110 +++--- .../notifications/notifications_page.dart | 2 + .../AmbulanceRequestIndex.dart | 331 +++++++++++++++--- lib/pages/ErService/OrderLogPage.dart | 283 ++++++++++++--- lib/widgets/drawer/app_drawer_widget.dart | 2 +- .../pickupLocation/PickupLocationFromMap.dart | 35 +- 6 files changed, 573 insertions(+), 190 deletions(-) diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 7633ab9c..6a24a52f 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -34,70 +34,68 @@ class NotificationsDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - appBarTitle: TranslationBase.of(context).notificationDetails, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 25, - ), - Container( - width: double.infinity, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), - style: TextStyle( + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).notificationDetails, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 25, + ), + Container( + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), + style: TextStyle( fontSize: 18.0, color: Colors.black, fontWeight: FontWeight.w600 - ), ), ), ), - SizedBox( - height: 15, - ), - if (notification.messageTypeData.length != 0) - FractionallySizedBox( - widthFactor: 0.9, - child: Image.network(notification.messageTypeData, - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: SizedBox( - width: 40.0, - height: 40.0, - child: AppCircularProgressIndicator(), - ), - ); - }, - fit: BoxFit - .fill) //Image.network(notification.messageTypeData), - ), - SizedBox( - height: 15, + ), + SizedBox( + height: 15, + ), + if (notification.messageTypeData.length != 0) + FractionallySizedBox( + widthFactor: 0.9, + child: Image.network(notification.messageTypeData, + loadingBuilder: (BuildContext context, Widget child, + ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator(), + ), + ); + }, + fit: BoxFit + .fill) //Image.network(notification.messageTypeData), ), - Row( - children: [ - Expanded( - child: Center( - child: Text(notification.message), - ), + SizedBox( + height: 15, + ), + Row( + children: [ + Expanded( + child: Center( + child: Text(notification.message), ), - ], - ), - ], - ), + ), + ], + ), + ], ), ), ), diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 6ae318c3..498afde8 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -21,6 +22,7 @@ class NotificationsPage extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + AppGlobal.context = context; return BaseView( onModelReady: (model) { GetNotificationsRequestModel getNotificationsRequestModel = diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index bbae70a5..806c0738 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -1,14 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'BillAmount.dart'; import 'PickupLocation.dart'; @@ -33,6 +41,10 @@ class _AmbulanceRequestIndexPageState extends State { TransportationDetails transportationDetails = new TransportationDetails(); + int status; + String _statusDisp; + Color _color; + _changeCurrentTab(int tab) { setState(() { currentIndex = tab; @@ -49,8 +61,31 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + AmbulanceRequestOrdersModel order = widget.amRequestViewModel.pendingAmbulanceRequestOrder; + + if(widget.amRequestViewModel.pendingAmbulanceRequestOrder != null) { + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + } + return AppScaffold( - body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null + body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null && order != null ? SingleChildScrollView( child: Column( children: [ @@ -58,60 +93,234 @@ class _AmbulanceRequestIndexPageState extends State { height: 10, ), Container( - margin: EdgeInsets.only(left: 18, right: 18), + margin: EdgeInsets.all(21), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).status, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), - OrderLogItem( - title: TranslationBase.of(context).transportMethod, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + ], + ), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); - }, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.amRequestViewModel, order.iD); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], ), - ) - ], + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), ), + + // Container( + // margin: EdgeInsets.only(left: 18, right: 18), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(2), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // OrderLogItem( + // title: TranslationBase.of(context).reqId, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).status, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupDate, + // value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).dropoffLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).transportMethod, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + // ), + // Container( + // padding: EdgeInsets.all(10), + // width: double.maxFinite, + // margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only( + // bottomRight: Radius.circular(12), + // bottomLeft: Radius.circular(12), + // ), + // color: Colors.white), + // child: SecondaryButton( + // color: Colors.red[900], + // textColor: Colors.white, + // label: TranslationBase.of(context).cancel, + // onTap: () { + // widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); + // }, + // ), + // ) + // ], + // ), + // ), ], ), ) @@ -164,4 +373,26 @@ class _AmbulanceRequestIndexPageState extends State { ), ); } + + void showConfirmMessage(AmRequestViewModel model, int presOrderID) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; + } } diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 9bb56b9c..644f3164 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -1,10 +1,18 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class OrderLogPage extends StatelessWidget { final AmRequestViewModel amRequestViewModel; @@ -13,64 +21,231 @@ class OrderLogPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + void showConfirmMessage(AmRequestViewModel model, int presOrderID) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; + } + return Container( - margin: EdgeInsets.all(10), + // margin: EdgeInsets.all(10), padding: EdgeInsets.all(8), - child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 ? ListView.builder( - itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, - itemBuilder: (context, index) => Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].iD.toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).orderStatus, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: getDate(amRequestViewModel.patientAmbulanceRequestOrdersList[index].created), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].dropOffLocation, - ), - if (amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusId == 1) - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 + ? ListView.builder( + padding: EdgeInsets.all(21), + itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, + itemBuilder: (context, index) { + AmbulanceRequestOrdersModel order = amRequestViewModel.patientAmbulanceRequestOrdersList[index]; + + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return Container( decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.iD); - }, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(amRequestViewModel, order.iD); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), - ) - ], - ), - ), - ) : getNoDataWidget(context), + ); + }) + : getNoDataWidget(context), ); } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 9e5a88d4..8b3819f1 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -361,7 +361,7 @@ class _AppDrawerState extends State { onTap: () { //NotificationsPage // Navigator.of(context).pop(); - if (!projectProvider.isLoginChild) Navigator.push(AppGlobal.context, FadePage(page: NotificationsPage())); + if (!projectProvider.isLoginChild) Navigator.push(context, FadePage(page: NotificationsPage())); }, ), if (projectProvider.havePrivilege(3)) diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index b0a67980..73edbe08 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/close_back.dart'; import 'package:flutter/cupertino.dart'; @@ -18,15 +19,7 @@ class PickupLocationFromMap extends StatelessWidget { final String buttonLabel; final Color buttonColor; - const PickupLocationFromMap( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.isWithAppBar = true, - this.buttonLabel, - this.buttonColor}) - : super(key: key); + const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude, this.isWithAppBar = true, this.buttonLabel, this.buttonColor}) : super(key: key); @override Widget build(BuildContext context) { @@ -60,8 +53,7 @@ class PickupLocationFromMap extends StatelessWidget { onPick(result); Navigator.of(context).pop(); }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { print("state: $state, isSearchBarFocused: $isSearchBarFocused"); return isSearchBarFocused ? Container() @@ -75,28 +67,13 @@ class PickupLocationFromMap extends StatelessWidget { ? Center(child: CircularProgressIndicator()) : Container( margin: EdgeInsets.all(12), - child: BorderedButton( - buttonLabel != null ? buttonLabel : TranslationBase.of(context).next, - textColor: Colors.white, - fontWeight: FontWeight.bold, - backgroundColor: buttonColor != null ? buttonColor : Colors.grey[800], - fontSize: 14, - vPadding: 12, - radius: 10, - handler: () { + child: DefaultButton( + TranslationBase.of(context).next, + () { onPick(selectedPlace); Navigator.of(context).pop(); }, ), - /* SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - onPick(selectedPlace); - Navigator.of(context).pop(); - }, - label: TranslationBase.of(context).next, - ),*/ ), ); }, From c253ec311023910142a44d3ac69e99aacbfdd619 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 17:07:12 +0300 Subject: [PATCH 7/8] LiveCare UI revamped --- lib/models/Appointments/DoctorProfile.dart | 48 +- lib/pages/BookAppointment/BookConfirm.dart | 11 +- .../components/DocAvailableAppointments.dart | 8 +- lib/pages/ToDoList/ToDo.dart | 600 ++++++++++++------ lib/pages/ToDoList/widgets/paymentDialog.dart | 2 +- lib/pages/ToDoList/widgets/upcomingCard.dart | 420 ++++-------- lib/pages/livecare/widgets/clinic_list.dart | 2 +- lib/widgets/my_rich_text.dart | 4 +- 8 files changed, 539 insertions(+), 556 deletions(-) diff --git a/lib/models/Appointments/DoctorProfile.dart b/lib/models/Appointments/DoctorProfile.dart index df6031a7..f96eb4d6 100644 --- a/lib/models/Appointments/DoctorProfile.dart +++ b/lib/models/Appointments/DoctorProfile.dart @@ -1,47 +1,47 @@ class DoctorProfileList { - int doctorID; + num doctorID; String doctorName; - Null doctorNameN; - int clinicID; + dynamic doctorNameN; + num clinicID; String clinicDescription; - Null clinicDescriptionN; - Null licenseExpiry; - int employmentType; - Null setupID; - int projectID; + dynamic clinicDescriptionN; + dynamic licenseExpiry; + num employmentType; + dynamic setupID; + num projectID; String projectName; String nationalityID; String nationalityName; - Null nationalityNameN; - int gender; + dynamic nationalityNameN; + num gender; String genderDescription; - Null genderDescriptionN; - Null doctorTitle; - Null projectNameN; + dynamic genderDescriptionN; + dynamic doctorTitle; + dynamic projectNameN; bool isAllowWaitList; String titleDescription; - Null titleDescriptionN; - Null isRegistered; - Null isDoctorDummy; + dynamic titleDescriptionN; + dynamic isRegistered; + dynamic isDoctorDummy; bool isActive; bool isDoctorHasPrePostImages; - Null isDoctorAppointmentDisplayed; + dynamic isDoctorAppointmentDisplayed; bool doctorClinicActive; - Null isbookingAllowed; + dynamic isbookingAllowed; String doctorCases; - Null doctorPicture; + dynamic doctorPicture; String doctorProfileInfo; List specialty; - int actualDoctorRate; + num actualDoctorRate; String doctorImageURL; - int doctorRate; - double decimalDoctorRate; + num doctorRate; + num decimalDoctorRate; String doctorTitleForProfile; bool isAppointmentAllowed; String nationalityFlagURL; - int noOfPatientsRate; + num noOfPatientsRate; String qR; - int serviceID; + num serviceID; DoctorProfileList( {this.doctorID, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 323567b7..585e862d 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -47,6 +47,8 @@ class BookConfirm extends StatefulWidget { class _BookConfirmState extends State { ToDoCountProviderModel toDoProvider; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override void initState() { widget.authUser = new AuthenticatedUser(); @@ -195,8 +197,8 @@ class _BookConfirmState extends State { elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (!widget.isLiveCareAppointment) { + onPressed: () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -244,8 +246,8 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - if (!widget.isLiveCareAppointment) { + Future.delayed(new Duration(milliseconds: 1500), () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -441,6 +443,7 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); + this.sharedPref.remove(IS_LIVECARE_APPOINTMENT); Navigator.push( context, FadePage( diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 959816af..8e576c99 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -12,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; - import 'package:syncfusion_flutter_calendar/calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -79,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (widget.isLiveCareAppointment) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); @@ -351,22 +350,27 @@ class MeetingDataSource extends CalendarDataSource { DateTime getStartTime(int index) { return _getMeetingData(index).from; } + @override DateTime getEndTime(int index) { return _getMeetingData(index).to; } + @override String getSubject(int index) { return _getMeetingData(index).eventName; } + @override Color getColor(int index) { return _getMeetingData(index).background; } + @override bool isAllDay(int index) { return _getMeetingData(index).isAllDay; } + Meeting _getMeetingData(int index) { final dynamic meeting = appointments[index]; Meeting meetingData; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 1a0ec103..b46e1958 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -20,7 +18,10 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -40,7 +41,7 @@ class ToDo extends StatefulWidget { bool isShowAppBar = true; Function onBackClick; - ToDo({@required this.isShowAppBar,this.onBackClick}); + ToDo({@required this.isShowAppBar, this.onBackClick}); @override _ToDoState createState() => _ToDoState(); @@ -49,11 +50,7 @@ class ToDo extends StatefulWidget { class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; - AuthenticatedUserObject authenticatedUserObject = locator(); - List imagesInfo = List(); - ToDoCountProviderModel toDoProvider; CountdownTimerController controller; @@ -63,7 +60,7 @@ class _ToDoState extends State { void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authenticatedUserObject.isLogin) getPatientData(); + getPatientAppointmentHistory(); }); super.initState(); imagesInfo @@ -85,7 +82,7 @@ class _ToDoState extends State { showNewAppBarTitle: true, icon: "assets/images/new/bottom_nav/todo.svg", description: TranslationBase.of(context).infoTodo, - onTap:widget.onBackClick, + onTap: widget.onBackClick, backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( child: Column( @@ -98,207 +95,353 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { - print("ttt " + getNextActionImage(widget.appoList[index].nextAction)); - print("ttt " + widget.appoList[index].nextAction.toString()); return Container( - margin: EdgeInsets.all(10.0), + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: widget.appoList[index].clinicID == 265 + ? Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/drive-thru.svg"), + ) + : widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset("assets/images/new/virtual.svg") + : SvgPicture.asset("assets/images/new/hospital-visit.svg"), + + // SvgPicture.asset("assets/images/new/virtual.svg"), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + widget.appoList[index].clinicID == 265 + ? TranslationBase.of(context).drivethruAppo + : widget.appoList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCareAppo + : TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: CountdownTimer( + controller: new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) + : Container(); + }, + ), + ), + ], + ), + ], + ), + Container( + child: InkWell( + onTap: () { + performNextAction(widget.appoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: getNextActionButtonColor(widget.appoList[index].nextAction), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + getNextActionText(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + url: widget.appoList[index].doctorImageURL, + width: 52, + height: 52, ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), + SizedBox(width: 11), + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, children: [ - Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), - Container( - width: MediaQuery.of(context).size.width * 0.4, - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + - " " + - widget.appoList[index].startTime.substring(0, 5), - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 10.0)), - ), - !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), - Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: widget.appoList[index].isLiveCareAppointment - ? Container() - : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", - overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + RatingBar.readOnly( + initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), ], ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), - if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), - style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - Container( - child: CountdownTimer( - controller: - new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), - widgetBuilder: (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + - TranslationBase.of(context).upcomingTimeLeft, - style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) - : Container(); - }, - ), - ), - ], - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction(widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ), - ) - ], - ), - Divider( - color: Colors.grey[500], - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), - ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), - ), - ), - ) - ], - ), ], ), ), - ), + ], ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), - color: Color(0xff20bc44), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + getNextActionDescription(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), - height: 30.0, - padding: EdgeInsets.only(right: 10, left: 10), - margin: EdgeInsets.symmetric(horizontal: 20), - transform: Matrix4.translationValues(0.0, -8.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - widget.appoList[index].clinicID == 265 - ? Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: SvgPicture.asset( - "assets/images/new/car_icon.svg", - height: 15, - width: 15, - ), - ) - : widget.appoList[index].isLiveCareAppointment - ? Image.asset("assets/images/new-design/video.png") - : Image.asset("assets/images/new-design/walkin.png"), - widget.appoList[index].clinicID == 265 - ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : widget.appoList[index].isLiveCareAppointment - ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - ], + ), + InkWell( + onTap: () { + navigateToAppointmentDetails(context, widget.appoList[index]); + }, + child: Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), ), ), ], ), ); + // return Container( + // margin: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // child: Card( + // margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + // color: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // child: Container( + // width: MediaQuery.of(context).size.width, + // padding: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Row( + // children: [ + // Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), + // Container( + // width: MediaQuery.of(context).size.width * 0.4, + // margin: EdgeInsets.only(left: 10.0, right: 10.0), + // child: Text( + // DateUtil.getWeekDayMonthDayYearDateFormatted( + // DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + + // " " + + // widget.appoList[index].startTime.substring(0, 5), + // overflow: TextOverflow.clip, + // style: TextStyle(fontSize: 10.0)), + // ), + // !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), + // Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: widget.appoList[index].isLiveCareAppointment + // ? Container() + // : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + // overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + // ), + // ], + // ), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Divider( + // color: Colors.grey[500], + // ), + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 1, + // child: Container( + // height: MediaQuery.of(context).size.height * 0.1, + // margin: EdgeInsets.only(top: 5.0), + // child: ClipRRect( + // borderRadius: BorderRadius.circular(100.0), + // child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), + // ), + // ), + // ), + // Expanded( + // flex: 3, + // child: Container( + // margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + // style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), + // if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") + // Container( + // margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + // child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), + // style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisSize: MainAxisSize.max, + // children: [ + // RatingBar.readOnly( + // initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + // size: 20.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + // ], + // ), + // Container( + // child: CountdownTimer( + // controller: + // new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + // widgetBuilder: (_, CurrentRemainingTime time) { + // return time != null + // ? Text( + // '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + // TranslationBase.of(context).upcomingTimeLeft, + // style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) + // : Container(); + // }, + // ), + // ), + // ], + // ), + // ), + // ), + // Expanded( + // flex: 1, + // child: InkWell( + // onTap: () => performNextAction(widget.appoList[index]), + // child: Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Column( + // children: [ + // Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + // ) + // ], + // ), + // ), + // ), + // ) + // ], + // ), + // Divider( + // color: Colors.grey[500], + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 2, + // child: Container( + // child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), + // ), + // ), + // Expanded( + // flex: 1, + // child: GestureDetector( + // onTap: () { + // navigateToAppointmentDetails(context, widget.appoList[index]); + // }, + // child: Container( + // child: Text(TranslationBase.of(context).upcomingDetails, + // textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), + // ), + // ), + // ) + // ], + // ), + // ], + // ), + // ), + // ), + // ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), + // color: Color(0xff20bc44), + // ), + // height: 30.0, + // padding: EdgeInsets.only(right: 10, left: 10), + // margin: EdgeInsets.symmetric(horizontal: 20), + // transform: Matrix4.translationValues(0.0, -8.0, 0.0), + // child: Row( + // mainAxisSize: MainAxisSize.min, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // widget.appoList[index].clinicID == 265 + // ? Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: SvgPicture.asset( + // "assets/images/new/car_icon.svg", + // height: 15, + // width: 15, + // ), + // ) + // : widget.appoList[index].isLiveCareAppointment + // ? Image.asset("assets/images/new-design/video.png") + // : Image.asset("assets/images/new-design/walkin.png"), + // widget.appoList[index].clinicID == 265 + // ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : widget.appoList[index].isLiveCareAppointment + // ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // ], + // ), + // ), + // ], + // ), + // ); }, ), ), @@ -375,6 +518,48 @@ class _ToDoState extends State { } } + Color getNextActionButtonColor(nextAction) { + switch (nextAction) { + case 0: + return CustomColors.accentColor; + break; + case 10: + return CustomColors.green; + break; + + case 15: + return CustomColors.grey2; + break; + + case 20: + return CustomColors.green; + break; + + case 30: + return CustomColors.accentColor; + break; + + case 40: + return CustomColors.green; + break; + + case 50: + return CustomColors.green; + break; + + case 60: + return CustomColors.orange; + break; + + case 90: + return CustomColors.accentColor; + break; + + default: + return CustomColors.green; + } + } + String getNextActionText(nextAction) { switch (nextAction) { case 0: @@ -732,35 +917,34 @@ class _ToDoState extends State { }); } - getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - setState(() { - print(data); - authUser = data; - }); - getPatientAppointmentHistory(); - } - } + // getPatientData() async { + // AppSharedPreferences sharedPref = AppSharedPreferences(); + // if (await sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + // setState(() { + // print(data); + // authUser = data; + // }); + // getPatientAppointmentHistory(); + // } + // } Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - - Navigator.push(context, FadePage(page: PaymentMethod( - onSelectedMethod: (String metohd) { + // if (await this.sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + // setState(() { + // authUser = data; + // }); + // } + + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { setState(() {}); }))).then((value) { print(value); getPatientAppointmentHistory(); if (value != null) { - openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index eedbb874..7a0bdc2e 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -89,7 +89,7 @@ class _PaymentDialogState extends State { children: [ Expanded( child: DefaultButton( - TranslationBase.of(context).cancel, + TranslationBase.of(context).cancel_nocaps, () { Navigator.pop(context, null); }, diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 6610ed33..863947ea 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -1,20 +1,17 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { - AppoitmentAllHistoryResultList appo; - var languageID; - final VoidCallback onListUpdated; - - TodoListCard({@required this.appo, this.onListUpdated}); + TodoListCard(); @override _TodoListCardState createState() => _TodoListCardState(); @@ -25,333 +22,128 @@ class _TodoListCardState extends State { @override void initState() { -// widget.onListUpdated(); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( + width: double.infinity, margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Row( - children: [ - Image.asset("assets/images/new-design/time_icon.png", - width: 20.0, height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 30.0), - child: Text(getDate(widget.appo.appointmentDate), - style: TextStyle(fontSize: 12.0)), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: SvgPicture.asset("assets/images/new/virtual.svg"), ), - widget.appo.isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: widget.appo.isLiveCareAppointment - ? Text(TranslationBase.of(context).upcomingLivecare, - style: TextStyle(fontSize: 12.0)) - : Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text(TranslationBase.of(context).videoAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text("01:23:22 " + TranslationBase.of(context).upcomingTimeLeft, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)), + ), + ], ), ], ), Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appo.doctorImageURL, - fit: BoxFit.fill), - ), + child: InkWell( + onTap: () { + // showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: CustomColors.green, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), ), - ), - Expanded( - flex: 3, - child: Container( - margin: - EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - widget.appo.doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: 4.0, - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - ], - ), + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget.appo.nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget.appo.nextAction), - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ) - ], + ), ), - Divider( - color: Colors.grey[500], + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + "Raed Mubarak Bin Ghanem", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: "Raed Mubarak Bin Ghanem", + url: "https://hmgwebservices.com/Images/MobileImages/TAKHSUSI/158210.png", + width: 52, + height: 52, ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription(widget.appo.nextAction), - style: TextStyle( - fontSize: 12.0, color: Colors.grey[700])), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", "Cardiology", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", "11/04/2021 15:30", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, "Olaya Hospital", projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: 4.5, + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: new Color(0xFF40ACC9), - decoration: TextDecoration.underline)), - ), - ), - ) - ], + ], + ), ), ], ), - ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + "Please confirm the appointment to avoid cancellation", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + "More Details", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), + ), + ], ), ); } - - String getNextActionImage(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return "assets/images/new-design/confirm_button.png"; - break; - - case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; - break; - - case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; - break; - - case 30: - return "assets/images/new-design/qr_code_button.png"; - break; - - case 40: - return "assets/images/new-design/video_call_instruction.png"; - break; - - case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; - break; - - default: - return ""; - } - } - - String getNextActionText(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).confirm; - break; - - case 15: - return TranslationBase.of(context).pendingPayment; - break; - - case 20: - return TranslationBase.of(context).payNow; - break; - - case 30: - return TranslationBase.of(context).viewQR; - break; - - case 40: - return TranslationBase.of(context).instruction; - break; - - case 50: - return TranslationBase.of(context).livecare; - break; - - default: - return ""; - } - } - - String getNextActionDescription(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).upcomingConfirm; - break; - - case 15: - return TranslationBase.of(context).upcomingPaymentPending; - break; - - case 20: - return TranslationBase.of(context).upcomingPaymentNow; - break; - - case 30: - return TranslationBase.of(context).upcomingQR; - break; - - case 40: - return TranslationBase.of(context).upcomingVirtual; - break; - - case 50: - return TranslationBase.of(context).upcomingLivecare; - break; - - default: - return ""; - } - } - - getLanguageID() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - widget.languageID = languageID; - }); - } - - String getDate(String date) { - DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString() + - " " + - dateObj.hour.toString() + - ":" + - getMinute(dateObj); - } - - String getMinute(DateTime dateObj) { - if (dateObj.minute == 0) { - return dateObj.minute.toString() + "0"; - } else { - return dateObj.minute.toString(); - } - } - - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - - Future navigateToAppointmentDetails(context) async { - Navigator.push( - context, FadePage(page: AppointmentDetails())); - } } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 988d102c..bf4d33c7 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -626,7 +626,7 @@ class _clinic_listState extends State { } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: true, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { diff --git a/lib/widgets/my_rich_text.dart b/lib/widgets/my_rich_text.dart index 92100f48..c3d108c5 100644 --- a/lib/widgets/my_rich_text.dart +++ b/lib/widgets/my_rich_text.dart @@ -12,11 +12,11 @@ class MyRichText extends StatelessWidget { maxLines: 1, text: TextSpan( text: title, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), children: [ TextSpan( text: " $value", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ) ]), ); From 30e67bbe3e11db3f2970ddd1cc265f9269695670 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Nov 2021 17:26:32 +0300 Subject: [PATCH 8/8] updates --- .../service/blood/blood_donation_service.dart | 47 ++++++++-------- .../medical/my_balance_view_model.dart | 16 +++--- lib/pages/Blood/blood_donation.dart | 56 ++++++++++++------- 3 files changed, 67 insertions(+), 52 deletions(-) diff --git a/lib/core/service/blood/blood_donation_service.dart b/lib/core/service/blood/blood_donation_service.dart index 0128d0d1..a59a2169 100644 --- a/lib/core/service/blood/blood_donation_service.dart +++ b/lib/core/service/blood/blood_donation_service.dart @@ -10,13 +10,13 @@ class BloodDonationService extends BaseService { List CitiesModelList = List(); Map body = Map(); + Future getAllCitiesOrders() async { hasError = false; body['ListCities'] = false; - await baseAppClient.post(GET_CITIES_REQUEST, - onSuccess: (dynamic response, int statusCode) { + body["IsPublicRequest"] = true; + await baseAppClient.post(GET_CITIES_REQUEST, onSuccess: (dynamic response, int statusCode) { CitiesModelList.clear(); - response['ListCities'].forEach((vital) { CitiesModelList.add(CitiesModel.fromJson(vital)); }); @@ -25,16 +25,16 @@ class BloodDonationService extends BaseService { super.error = error; }, body: body); } + Future bloodDonationSave(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_REQUEST, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_REQUEST, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; @@ -44,30 +44,27 @@ class BloodDonationService extends BaseService { Future getAgreement() async { var localRes; try { - await baseAppClient.post(GET_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: {}); + await baseAppClient.post(GET_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: {}); return Future.value(localRes); } catch (error) { throw error; } } - Future saveAgreement(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index a92b6e16..e12e2b07 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -81,13 +81,15 @@ class MyBalanceViewModel extends BaseViewModel { } Future getCities() async { - setState(ViewState.Busy); - await _bloodDonationService.getAllCitiesOrders(); - if (_bloodDonationService.hasError) { - error = _bloodDonationService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + if(isLogin) { + setState(ViewState.Busy); + await _bloodDonationService.getAllCitiesOrders(); + if (_bloodDonationService.hasError) { + error = _bloodDonationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } Future getBlood() async { diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 3a702d32..c5e0f714 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -73,26 +73,42 @@ class _BloodDonationPageState extends State { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) { - if (projectProvider.isLogin && projectProvider.user != null) { - model.getCities().then((value) { - model.getBlood().then((value) { - if (model.bloodModelList.length > 0) { - CitiesModel citiesModel = new CitiesModel(); - citiesModel.iD = getSelectedCityID(model); - _selectedHospitalIndex = (citiesModel.iD - 1); - citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; - citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; - _selectedHospital = citiesModel; - _selectedBloodType = model.bloodModelList[0].bloodGroup; - _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); - } else { - _selectedHospital = model.CitiesModelList[0]; - } - }); - }); - } - }, + onModelReady: (model) => model.getCities().then((value) { + model.getBlood().then((value) { + if (model.bloodModelList.length > 0) { + CitiesModel citiesModel = new CitiesModel(); + citiesModel.iD = getSelectedCityID(model); + _selectedHospitalIndex = (citiesModel.iD - 1); + citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + _selectedHospital = citiesModel; + _selectedBloodType = model.bloodModelList[0].bloodGroup; + _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + } else { + _selectedHospital = model.CitiesModelList[0]; + } + }); + }), + // { + // if (projectProvider.isLogin && projectProvider.user != null) { + // model.getCities().then((value) { + // model.getBlood().then((value) { + // if (model.bloodModelList.length > 0) { + // CitiesModel citiesModel = new CitiesModel(); + // citiesModel.iD = getSelectedCityID(model); + // _selectedHospitalIndex = (citiesModel.iD - 1); + // citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + // citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + // _selectedHospital = citiesModel; + // _selectedBloodType = model.bloodModelList[0].bloodGroup; + // _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + // } else { + // _selectedHospital = model.CitiesModelList[0]; + // } + // }); + // }); + // } + // }, builder: (_, model, w) => AppScaffold( isShowAppBar: true, showNewAppBar: true,