From 21c3686e05f0282e6d1ffe2ffc67f676b5c77c1d Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 31 Aug 2021 12:07:46 +0300 Subject: [PATCH 1/4] Ambulance request services revamping --- lib/config/config.dart | 5 + .../model/er/AmbulanceRequestOrdersModel.dart | 319 ++++++++++++++++++ lib/core/service/er/am_service.dart | 83 +++-- .../viewModels/er/am_request_view_model.dart | 24 +- .../AmbulanceRequestIndex.dart | 31 +- lib/pages/ErService/OrderLogPage.dart | 41 +-- 6 files changed, 436 insertions(+), 67 deletions(-) create mode 100644 lib/core/model/er/AmbulanceRequestOrdersModel.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 329d4218..9342551a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -134,6 +134,11 @@ const INSERT_ER_INERT_PRES_ORDER = /// ER RRT const GET_ALL_RC_TRANSPORTATION = 'rc/api/Transportation/getalltransportation'; const GET_ALL_TRANSPORTATIONS_RC = 'rc/api/Transportation/getalltransportation'; + +const GET_ALL_TRANSPORTATIONS_ORDERS = 'rc/api/Transportation/get'; + +const CANCEL_AMBULANCE_REQUEST = "rc/api/Transportation/update"; + const GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; const GET_RRT_SERVICE_PRICE = diff --git a/lib/core/model/er/AmbulanceRequestOrdersModel.dart b/lib/core/model/er/AmbulanceRequestOrdersModel.dart new file mode 100644 index 00000000..6bcc02b0 --- /dev/null +++ b/lib/core/model/er/AmbulanceRequestOrdersModel.dart @@ -0,0 +1,319 @@ +class AmbulanceRequestOrdersModel { + String statusText; + int paymentStatus; + dynamic clientRequestid; + dynamic paymentStatusText; + dynamic projectName; + String nearestProjectName; + double paymentAmount; + WFOrder wFOrder; + String serviceText; + bool isSentForApproval; + int exaCartOrderId; + bool isTimer; + int timeSeconds; + int totalPendingSeconds; + int timeMinute; + int timeHour; + int timeTotalSeconds; + int timeTotalMinute; + int timeTotalHour; + dynamic approvalStatus; + bool isActive; + int clickButton; + dynamic orderHistory; + String pickupLocation; + String dropOffLocation; + String clinicName; + String doctorName; + String branch; + String time; + dynamic notes; + int id; + String patientId; + int patientOutSa; + bool isOutPatient; + int projectId; + int nearestProjectId; + dynamic longitude; + dynamic latitude; + dynamic appointmentNo; + dynamic dischargeId; + int statusId; + int serviceId; + int channel; + Orderpayment orderpayment; + dynamic orderselectedservice; + dynamic wforder; + dynamic orderapprovalobj; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + + 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}); + + 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']; + isSentForApproval = json['isSentForApproval']; + exaCartOrderId = json['exaCart_OrderId']; + 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']; + isActive = json['isActive']; + 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']; + wforder = json['wforder']; + orderapprovalobj = json['orderapprovalobj']; + 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; + if (this.wFOrder != null) { + data['wF_order'] = this.wFOrder.toJson(); + } + data['serviceText'] = this.serviceText; + data['isSentForApproval'] = this.isSentForApproval; + data['exaCart_OrderId'] = this.exaCartOrderId; + 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['isActive'] = this.isActive; + 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; + 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; + return data; + } +} + +class WFOrder { + dynamic wfButtonsDTO; + int id; + int orderId; + int previousStep; + int nextStep; + int serviceId; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic 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.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']; + } + + 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; + return data; + } +} + +class Orderpayment { + int id; + int orderId; + dynamic clientRequestId; + double totalAmount; + int paymentStatus; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic 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.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']; + } + + 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; + return data; + } +} diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 22db55a3..aff19df6 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; @@ -11,20 +12,23 @@ import '../base_service.dart'; class AmService extends BaseService { List amModelList = List(); List patientAllPresOrdersList = List(); + + List patientAmbulanceRequestOrdersList = List(); + bool hasPendingOrder = false; int pendingOrderID = 0; String pendingOrderStatus = ""; String pendingOrderStatusAR = ""; PickUpRequestPresOrder pickUpRequestPresOrder; + AmbulanceRequestOrdersModel pendingAmbulanceRequestOrder; + Future getAllTransportationOrders() async { hasError = false; 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(), isExternal: false, onSuccess: (dynamic response, int statusCode) { amModelList.clear(); response['data']['transportationservices'].forEach((item) { amModelList.add(PatientERTransportationMethod.fromJson(item)); @@ -33,24 +37,13 @@ class AmService extends BaseService { hasError = true; super.error = error; }); - // await baseAppClient.post(GET_AMBULANCE_REQUEST, - // onSuccess: (dynamic response, int statusCode) { - // amModelList.clear(); - // response['PatientER_RRT_GetAllTransportationMethodList'].forEach((item) { - // amModelList.add(PatientERTransportationMethod.fromJson(item)); - // }); - // }, onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: body); } Future getPatientAllPresOrdersList() async { hasError = false; hasPendingOrder = false; pickUpRequestPresOrder = null; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { patientAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((item) { if (item['ServiceID'] == OrderService.AMBULANCE.getIdOrderService()) { @@ -70,15 +63,46 @@ class AmService extends BaseService { }, body: Map()); } + Future getPatientAllPresOrdersListRC(dynamic patientID) async { + hasError = false; + hasPendingOrder = false; + pickUpRequestPresOrder = null; + + Map body = Map(); + body['patientId'] = patientID.toString(); + body['PatientID'] = patientID.toString(); + + await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, onSuccess: (dynamic response, int statusCode) { + patientAmbulanceRequestOrdersList.clear(); + print(response['data'].length); + print(response['data'][0]); + response['data'].forEach((item) { + patientAmbulanceRequestOrdersList.add(AmbulanceRequestOrdersModel.fromJson(item)); + if (item['statusId'] == 1) { + hasPendingOrder = true; + pendingOrderID = item['orderpayment']['id']; + pendingOrderStatus = item['statusText']; + pendingOrderStatusAR = item['statusText']; + pendingAmbulanceRequestOrder = AmbulanceRequestOrdersModel.fromJson(item); + } + }); + print(patientAmbulanceRequestOrdersList.length); + print(hasPendingOrder); + print(pendingOrderID); + print(pendingOrderStatus); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getOrderDetails() async { hasError = false; Map body = Map(); body['PresOrderID'] = pendingOrderID; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID, - onSuccess: (dynamic response, int statusCode) { - response['PatientER_RRT_GetPickUpRequestByPresOrderIDList'] - .forEach((item) { + await baseAppClient.post(GET_PICK_UP_REQUEST_BY_PRES_ORDER_ID, onSuccess: (dynamic response, int statusCode) { + response['PatientER_RRT_GetPickUpRequestByPresOrderIDList'].forEach((item) { pickUpRequestPresOrder = PickUpRequestPresOrder.fromJson(item); }); }, onFailure: (String error, int statusCode) { @@ -95,9 +119,20 @@ class AmService extends BaseService { body['RejectionReason'] = ''; body['PresOrderStatus'] = OrderService.AMBULANCE.getIdOrderService(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(UPDATE_PRESS_ORDER, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + 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(CANCEL_AMBULANCE_REQUEST, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -106,9 +141,7 @@ class AmService extends BaseService { Future insertERPressOrder({@required PatientER patientER}) async { hasError = false; - await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: patientER.toJson()); diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 5f6d40d5..d884c4e7 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; @@ -27,12 +28,17 @@ class AmRequestViewModel extends BaseViewModel { List get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; + List get patientAmbulanceRequestOrdersList => + _amService.patientAmbulanceRequestOrdersList; + List get hospitals => _hospitalService.hospitals; bool get hasPendingOrder =>_amService.hasPendingOrder; PickUpRequestPresOrder get pickUpRequestPresOrder =>_amService.pickUpRequestPresOrder; + AmbulanceRequestOrdersModel get pendingAmbulanceRequestOrder =>_amService.pendingAmbulanceRequestOrder; + Future getAppointmentHistory() async { setState(ViewState.BusyLocal); await _medicalService.getAppointmentHistory(isActiveAppointment: true); @@ -60,7 +66,18 @@ class AmRequestViewModel extends BaseViewModel { error = _hospitalService.error; setState(ViewState.Error); } else - getPatientAllPresOrdersList(); + // getPatientAllPresOrdersList(); + getPatientAllPresOrdersListRC(); + } + + Future getPatientAllPresOrdersListRC() async { + setState(ViewState.Busy); + await _amService.getPatientAllPresOrdersListRC(authenticatedUserObject.user.patientID); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); } Future getPatientAllPresOrdersList() async { @@ -87,12 +104,13 @@ class AmRequestViewModel extends BaseViewModel { Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); - await _amService.updatePressOrder(presOrderID: presOrderID); + // await _amService.updatePressOrder(presOrderID: presOrderID); + await _amService.updatePressOrderRC(presOrderID: presOrderID, patientID: authenticatedUserObject.user.patientID.toString()); if (_amService.hasError) { error = _amService.error; setState(ViewState.Error); } else - getPatientAllPresOrdersList(); + getPatientAllPresOrdersListRC(); } Future insertERPressOrder({@required PatientER patientER}) async { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 22098d4f..5da78946 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -46,7 +46,7 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - body: widget.amRequestViewModel.pickUpRequestPresOrder != null + body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null ? SingleChildScrollView( child: Column( children: [ @@ -64,36 +64,32 @@ class _AmbulanceRequestIndexPageState extends State { children: [ OrderLogItem( title: TranslationBase.of(context).reqId, - value: widget.amRequestViewModel.pickUpRequestPresOrder - .presOrderID + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder + .statusId .toString(), ), OrderLogItem( title: TranslationBase.of(context).status, - value: widget.amRequestViewModel.pickUpRequestPresOrder.status ==0?TranslationBase.of(context).pending:'', + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, ), OrderLogItem( title: TranslationBase.of(context).pickupDate, - value: DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(widget - .amRequestViewModel - .pickUpRequestPresOrder - .lastEditDate)), + value: getDate(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created), ), OrderLogItem( title: TranslationBase.of(context).pickupLocation, - value: widget.amRequestViewModel.pickUpRequestPresOrder - .pickupLocationName, + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder + .pickupLocation, ), OrderLogItem( title: TranslationBase.of(context).dropoffLocation, - value: widget.amRequestViewModel.pickUpRequestPresOrder - .dropoffLocationName, + value: widget.amRequestViewModel.pendingAmbulanceRequestOrder + .dropOffLocation, ), OrderLogItem( title: TranslationBase.of(context).transportMethod, value: widget - .amRequestViewModel.pickUpRequestPresOrder.title, + .amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, ), Container( padding: EdgeInsets.all(10), @@ -112,7 +108,7 @@ class _AmbulanceRequestIndexPageState extends State { onTap: () { widget.amRequestViewModel.updatePressOrder( presOrderID: widget.amRequestViewModel - .pickUpRequestPresOrder.presOrderID); + .pendingAmbulanceRequestOrder.id); }, ), ) @@ -167,4 +163,9 @@ class _AmbulanceRequestIndexPageState extends State { ), ); } + + String getDate(String date) { + return date.split("T")[0]; + } + } diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 7d2a4a5b..3d492c83 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -1,9 +1,6 @@ -import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -19,7 +16,7 @@ class OrderLogPage extends StatelessWidget { margin: EdgeInsets.all(10), padding: EdgeInsets.all(8), child: ListView.builder( - itemCount: amRequestViewModel.patientAllPresOrdersList.length, + itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, itemBuilder: (context, index) => Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( @@ -31,49 +28,41 @@ class OrderLogPage extends StatelessWidget { children: [ OrderLogItem( title: TranslationBase.of(context).reqId, - value: amRequestViewModel.patientAllPresOrdersList[index].iD - .toString(), + value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].id.toString(), ), OrderLogItem( title: TranslationBase.of(context).orderStatus, - value: amRequestViewModel - .patientAllPresOrdersList[index].description, + value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusText, ), OrderLogItem( title: TranslationBase.of(context).pickupDate, - value: DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(amRequestViewModel - .patientAllPresOrdersList[index].createdOn)), + value: getDate(amRequestViewModel.patientAmbulanceRequestOrdersList[index].created), ), OrderLogItem( title: TranslationBase.of(context).pickupLocation, - value: amRequestViewModel - .patientAllPresOrdersList[index].pickupLocationName, + value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].pickupLocation, ), OrderLogItem( title: TranslationBase.of(context).dropoffLocation, - value: amRequestViewModel - .patientAllPresOrdersList[index].dropoffLocationName, + value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].dropOffLocation, ), - if(amRequestViewModel.patientAllPresOrdersList[index].status==1) + if (amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusId == 1) Container( padding: EdgeInsets.all(10), width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4,left: 4,right: 4), + margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), decoration: BoxDecoration( borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + bottomRight: Radius.circular(12), + bottomLeft: Radius.circular(12), ), - color: Colors.white - ), + color: Colors.white), child: SecondaryButton( - color: Colors.red[900], + color: Colors.red[900], textColor: Colors.white, label: TranslationBase.of(context).cancel, onTap: () { - amRequestViewModel.updatePressOrder(presOrderID:amRequestViewModel.pickUpRequestPresOrder.presOrderID ); - + amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.id); }, ), ) @@ -83,4 +72,8 @@ class OrderLogPage extends StatelessWidget { ), ); } + + String getDate(String date) { + return date.split("T")[0]; + } } From d1c99d1d821c25322cce4315fcd1b7bd28ed3624 Mon Sep 17 00:00:00 2001 From: Zohaib Iqbal Kambrani <> Date: Tue, 31 Aug 2021 15:29:11 +0300 Subject: [PATCH 2/4] ER Average waiting time label applied --- lib/config/localized_values.dart | 2 + lib/pages/ErService/NearestEr.dart | 9 ++-- .../ErService/widgets/card_position.dart | 42 +++++++++---------- lib/uitl/translations_delegate_base.dart | 2 + 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 875a97d3..0cdbd783 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -355,6 +355,7 @@ const Map localizedValues = { "VitalSign": {"en": "Vital Sign", "ar": "العلامة حيوية"}, "MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"}, "km": {"en": "KMs:", "ar": "كم"}, + "km_": {"en": "KM", "ar": "كم"}, "PatientHealthSummaryReport": {"en": "Patient Health Summary Report", "ar": " ملخص التقارير الشهرية"}, "ToViewTheTermsAndConditions": {"en": "To View The Terms And Conditions Report", "ar": " عرض الشروط والأحكام "}, "ClickHere": {"en": "Click here", "ar": "أنقر هنا"}, @@ -396,6 +397,7 @@ const Map localizedValues = { "Ok": {"en": "Ok", "ar": "حسنا"}, "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, + "averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"}, "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires In", "ar": "تنتهي صلاحية رمز التحقق في"}, "PleaseEnterTheVerificationCode": {"en": "Please enter the verification code send to", "ar": "الرجاء إدخال رمز التحقق المرسل إلى"}, "EyeMeasurements": {"en": "Eye Measurements", "ar": "قياسات النظر"}, diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index cbafacce..0ecb19a7 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -60,16 +60,17 @@ class NearestEr extends StatelessWidget { children: List.generate(7, (index) { return Container( child: CardPosition( + waitingTime: mode + .ProjectAvgERWaitingTimeModeList[index] + .avgTimeInHHMM + .toString(), text: mode .ProjectAvgERWaitingTimeModeList[index] .projectName .toString(), image: 'assets/images/new-design/find_us_icon.png', - subText: mode - .ProjectAvgERWaitingTimeModeList[index] - .distanceInKilometers - .toString(), + subText: '${mode.ProjectAvgERWaitingTimeModeList[index].distanceInKilometers ?? 0.0} ${TranslationBase.of(context).km_}', type: mode .ProjectAvgERWaitingTimeModeList[index].iD .toString(), diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart index 69ccaffe..29fdd5a4 100644 --- a/lib/pages/ErService/widgets/card_position.dart +++ b/lib/pages/ErService/widgets/card_position.dart @@ -1,6 +1,7 @@ //import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -20,6 +21,7 @@ class CardPosition extends StatelessWidget { final longitude; final projectname; final cardSize; + final String waitingTime; const CardPosition( { @@ -32,7 +34,8 @@ class CardPosition extends StatelessWidget { @required this.latitude, @required this.longitude, @required this.projectname , - @required this.cardSize , + @required this.cardSize, + @required this.waitingTime , }); @override @@ -83,31 +86,26 @@ class CardPosition extends StatelessWidget { } Future navigateToSearch(context, type,telephone,networkImage,latitude,longitude,projectname) async { - - - - + var localize = TranslationBase.of(context); showDialog( context: context,builder: (_) => AssetGiffyDialog( - title: Text(projectname, - style: TextStyle( - fontSize: 22.0, fontWeight: FontWeight.w600), - ),image:Image.network(networkImage, fit: BoxFit.cover,), - - buttonOkText:Text("LOCATION"), - buttonOkColor: Colors.grey, - buttonCancelText:Text('CAll') , - buttonCancelColor: Colors.grey, - onOkButtonPressed: () { MapsLauncher.launchCoordinates(double.parse(latitude),double.parse(longitude),projectname);}, - onCancelButtonPressed :() {launch("tel://" +telephone);} - - - - - ) ); + entryAnimation: EntryAnimation.BOTTOM, + image:Image.network(networkImage, fit: BoxFit.cover,), + title: Text(projectname, + style: TextStyle( + fontSize: 22.0, fontWeight: FontWeight.w600), + ), + description: Text("${localize.averageWaitingTime}\n\n$waitingTime ${localize.minute}", textAlign: TextAlign.center,), + buttonOkText:Text("LOCATION", style: TextStyle(color: Colors.white),), + buttonOkColor: Colors.grey, + buttonCancelText:Text('CAll', style: TextStyle(color: Colors.white),) , + buttonCancelColor: Colors.grey, + onOkButtonPressed: () { MapsLauncher.launchCoordinates(double.parse(latitude),double.parse(longitude),projectname);}, + onCancelButtonPressed :() {launch("tel://" +telephone);} + )); } - } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6ebba17b..b8968adb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -461,6 +461,7 @@ class TranslationBase { String get userView => localizedValues['user-view'][locale.languageCode]; String get sentRequest => localizedValues['sent-requests'][locale.languageCode]; String get km => localizedValues['km'][locale.languageCode]; + String get km_ => localizedValues['km_'][locale.languageCode]; String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; String get clickHere => localizedValues['ClickHere'][locale.languageCode]; @@ -500,6 +501,7 @@ class TranslationBase { String get ok => localizedValues['Ok'][locale.languageCode]; String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; + String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode]; String get theVerificationCodeExpiresIn => localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; String get pleaseEnterTheVerificationCode => localizedValues['PleaseEnterTheVerificationCode'][locale.languageCode]; String get eyeMeasurements => localizedValues['EyeMeasurements'][locale.languageCode]; From e9ec2e2faf46a0d655cf60cf8f07272dc63690ee Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 1 Sep 2021 15:21:34 +0300 Subject: [PATCH 3/4] Ambulance request APIs revamped --- lib/core/model/er/PatientER_RC.dart | 200 ++++++++++++++++++ lib/core/service/er/am_service.dart | 8 +- .../viewModels/er/am_request_view_model.dart | 3 +- .../AmbulanceRequestIndex.dart | 10 + .../BillAmount.dart | 78 +++---- .../PickupLocation.dart | 158 ++++++-------- .../SelectTransportationMethod.dart | 121 +++++------ .../AmbulanceRequestIndexPages/Summary.dart | 133 ++++++++---- 8 files changed, 459 insertions(+), 252 deletions(-) create mode 100644 lib/core/model/er/PatientER_RC.dart diff --git a/lib/core/model/er/PatientER_RC.dart b/lib/core/model/er/PatientER_RC.dart new file mode 100644 index 00000000..f5afc1d6 --- /dev/null +++ b/lib/core/model/er/PatientER_RC.dart @@ -0,0 +1,200 @@ +import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; + +class PatientER_RC { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + bool patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + String patientID; + String tokenID; + int patientTypeID; + int patientType; + int orderServiceID; + String patientIdentificationID; + dynamic patientOutSa; + int projectID; + int lineItemNo; + TransportationDetails transportationDetails; + PatientERTransportationMethod patientERTransportationMethod; + + PatientER_RC( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.orderServiceID, + this.patientIdentificationID, + this.patientOutSa, + this.projectID, + this.lineItemNo, + this.transportationDetails}); + + PatientER_RC.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + orderServiceID = json['OrderServiceID']; + patientIdentificationID = json['PatientIdentificationID']; + patientOutSa = json['patientOutSa']; + projectID = json['projectID']; + lineItemNo = json['lineItemNo']; + transportationDetails = json['transportationDetails'] != null + ? new TransportationDetails.fromJson(json['transportationDetails']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + data['OrderServiceID'] = this.orderServiceID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['patientOutSa'] = this.patientOutSa; + data['projectID'] = this.projectID; + data['lineItemNo'] = this.lineItemNo; + if (this.transportationDetails != null) { + data['transportationDetails'] = this.transportationDetails.toJson(); + } + return data; + } +} + +class TransportationDetails { + int direction; + int haveAppointment; + int tripType; + int pickupUrgency; + int pickupSpot; + String pickupDateTime; + String transportationType; + int ambulate; + String notes; + int requesterFileNo; + String requesterMobileNo; + bool requesterIsOutSA; + String pickupLocationName; + String dropoffLocationName; + String pickupLatitude; + String pickupLongitude; + String dropoffLatitude; + String dropoffLongitude; + String appointmentNo; + String appointmentClinicName; + String appointmentDoctorName; + String appointmentBranch; + String appointmentTime; + + TransportationDetails( + {this.direction, + this.haveAppointment, + this.tripType, + this.pickupUrgency, + this.pickupSpot, + this.pickupDateTime, + this.transportationType, + this.ambulate, + this.notes, + this.requesterFileNo, + this.requesterMobileNo, + this.requesterIsOutSA, + this.pickupLocationName, + this.dropoffLocationName, + this.pickupLatitude, + this.pickupLongitude, + this.dropoffLatitude, + this.dropoffLongitude, + this.appointmentNo, + this.appointmentClinicName, + this.appointmentDoctorName, + this.appointmentBranch, + this.appointmentTime}); + + TransportationDetails.fromJson(Map json) { + direction = json['direction']; + haveAppointment = json['haveAppointment']; + tripType = json['tripType']; + pickupUrgency = json['pickupUrgency']; + pickupSpot = json['pickupSpot']; + pickupDateTime = json['pickupDateTime']; + transportationType = json['transportationType']; + ambulate = json['ambulate']; + notes = json['notes']; + requesterFileNo = json['requesterFileNo']; + requesterMobileNo = json['requesterMobileNo']; + requesterIsOutSA = json['requesterIsOutSA']; + pickupLocationName = json['pickupLocationName']; + dropoffLocationName = json['dropoffLocationName']; + pickupLatitude = json['pickup_Latitude']; + pickupLongitude = json['pickup_Longitude']; + dropoffLatitude = json['dropoff_Latitude']; + dropoffLongitude = json['dropoff_Longitude']; + appointmentNo = json['appointmentNo']; + appointmentClinicName = json['appointmentClinicName']; + appointmentDoctorName = json['appointmentDoctorName']; + appointmentBranch = json['appointmentBranch']; + appointmentTime = json['appointmentTime']; + } + + Map toJson() { + final Map data = new Map(); + data['direction'] = this.direction; + data['haveAppointment'] = this.haveAppointment; + data['tripType'] = this.tripType; + data['pickupUrgency'] = this.pickupUrgency; + data['pickupSpot'] = this.pickupSpot; + data['pickupDateTime'] = this.pickupDateTime; + data['transportationType'] = this.transportationType; + data['ambulate'] = this.ambulate; + data['notes'] = this.notes; + data['requesterFileNo'] = this.requesterFileNo; + data['requesterMobileNo'] = this.requesterMobileNo; + data['requesterIsOutSA'] = this.requesterIsOutSA; + data['pickupLocationName'] = this.pickupLocationName; + data['dropoffLocationName'] = this.dropoffLocationName; + data['pickup_Latitude'] = this.pickupLatitude; + data['pickup_Longitude'] = this.pickupLongitude; + data['dropoff_Latitude'] = this.dropoffLatitude; + data['dropoff_Longitude'] = this.dropoffLongitude; + data['appointmentNo'] = this.appointmentNo; + data['appointmentClinicName'] = this.appointmentClinicName; + data['appointmentDoctorName'] = this.appointmentDoctorName; + data['appointmentBranch'] = this.appointmentBranch; + data['appointmentTime'] = this.appointmentTime; + return data; + } +} diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 22db55a3..895fcc0a 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:flutter/cupertino.dart'; @@ -103,14 +104,17 @@ class AmService extends BaseService { }, body: body); } - Future insertERPressOrder({@required PatientER patientER}) async { + Future insertERPressOrder({@required PatientER_RC patientER}) async { hasError = false; + var body = patientER.toJson(); + print(body); + await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: patientER.toJson()); + }, body: body); } } diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 5f6d40d5..6a5bd4b2 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; @@ -95,7 +96,7 @@ class AmRequestViewModel extends BaseViewModel { getPatientAllPresOrdersList(); } - Future insertERPressOrder({@required PatientER patientER}) async { + Future insertERPressOrder({@required PatientER_RC patientER}) async { setState(ViewState.Busy); await _amService.insertERPressOrder(patientER: patientER); if (_amService.hasError) { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 22098d4f..2c3bcf8a 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -1,4 +1,5 @@ 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'; @@ -29,6 +30,10 @@ class _AmbulanceRequestIndexPageState extends State { PageController pageController; PatientER _patientER = PatientER(); + PatientER_RC _patientER_RC = PatientER_RC(); + + TransportationDetails transportationDetails = new TransportationDetails(); + _changeCurrentTab(int tab) { setState(() { currentIndex = tab; @@ -41,6 +46,7 @@ class _AmbulanceRequestIndexPageState extends State { void initState() { super.initState(); pageController = new PageController(); + _patientER_RC.transportationDetails = transportationDetails; } @override @@ -143,21 +149,25 @@ class _AmbulanceRequestIndexPageState extends State { SelectTransportationMethod( changeCurrentTab: _changeCurrentTab, patientER: _patientER, + patientER_RC: _patientER_RC, amRequestViewModel: widget.amRequestViewModel, ), PickupLocation( changeCurrentTab: _changeCurrentTab, patientER: _patientER, + patientER_RC: _patientER_RC, amRequestViewModel: widget.amRequestViewModel, ), BillAmount( changeCurrentTab: _changeCurrentTab, patientER: _patientER, + patientER_RC: _patientER_RC, amRequestViewModel: widget.amRequestViewModel, ), Summary( changeCurrentTab: _changeCurrentTab, patientER: _patientER, + patientER_RC: _patientER_RC, amRequestViewModel: widget.amRequestViewModel, ), ], diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index 3a89a551..67b9d82b 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -1,5 +1,6 @@ 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'; @@ -9,17 +10,13 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - class BillAmount extends StatefulWidget { final Function changeCurrentTab; final PatientER patientER; + final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; - BillAmount( - {Key key, - this.changeCurrentTab, - this.patientER, - this.amRequestViewModel}); + BillAmount({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel}); @override _BillAmountState createState() => _BillAmountState(); @@ -27,23 +24,19 @@ class BillAmount extends StatefulWidget { class _BillAmountState extends State { Ambulate _ambulate = Ambulate.None; - String note =""; - + String note = ""; @override void initState() { - - if(widget.patientER.ambulate!=null) - { - setState(() { - _ambulate = widget.patientER.ambulate; - note = widget.patientER.requesterNote; - }); - } + // if (widget.patientER_RC.transportationDetails.ambulate != null) { + // setState(() { + // _ambulate = widget.patientER.ambulate; + // note = widget.patientER.requesterNote; + // }); + // } super.initState(); } - @override Widget build(BuildContext context) { return AppScaffold( @@ -61,9 +54,7 @@ class _BillAmountState extends State { height: 10, ), Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 1.0, color: Colors.grey[300]), - outside: BorderSide(width: 1.0, color: Colors.grey[300])), + border: TableBorder.symmetric(inside: BorderSide(width: 1.0, color: Colors.grey[300]), outside: BorderSide(width: 1.0, color: Colors.grey[300])), children: [ TableRow( children: [ @@ -96,7 +87,7 @@ class _BillAmountState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.price}', + TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', color: Colors.black, textAlign: TextAlign.start, fontSize: 15, @@ -126,7 +117,7 @@ class _BillAmountState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceVAT}', + TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', color: Colors.black, fontSize: 15, textAlign: TextAlign.start, @@ -167,7 +158,7 @@ class _BillAmountState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceTotal}', + TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', color: Colors.black, fontSize: 15, textAlign: TextAlign.start, @@ -181,8 +172,13 @@ class _BillAmountState extends State { SizedBox( height: 10, ), - Texts(TranslationBase.of(context).selectAmbulate,bold: true,), - SizedBox(height: 5,), + Texts( + TranslationBase.of(context).selectAmbulate, + bold: true, + ), + SizedBox( + height: 5, + ), Row( children: [ Expanded( @@ -196,8 +192,7 @@ class _BillAmountState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -226,8 +221,7 @@ class _BillAmountState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -235,7 +229,6 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.Walker, groupValue: _ambulate, - onChanged: (value) { setState(() { _ambulate = value; @@ -248,7 +241,9 @@ class _BillAmountState extends State { ), ], ), - SizedBox(height: 5,), + SizedBox( + height: 5, + ), Row( children: [ Expanded( @@ -262,8 +257,7 @@ class _BillAmountState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -271,7 +265,6 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.Stretcher, groupValue: _ambulate, - onChanged: (value) { setState(() { _ambulate = value; @@ -293,8 +286,7 @@ class _BillAmountState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -302,7 +294,6 @@ class _BillAmountState extends State { leading: Radio( value: Ambulate.None, groupValue: _ambulate, - onChanged: (value) { setState(() { _ambulate = value; @@ -315,17 +306,18 @@ class _BillAmountState extends State { ), ], ), - SizedBox(height: 12,), + SizedBox( + height: 12, + ), NewTextFields( hintText: TranslationBase.of(context).notes, initialValue: note, - onChanged: (value){ + onChanged: (value) { setState(() { note = value; }); }, ), - SizedBox( height: 100, ), @@ -342,9 +334,9 @@ class _BillAmountState extends State { textColor: Colors.white, onTap: () { setState(() { - widget.patientER.ambulate = _ambulate; - widget.patientER.requesterNote = note; - widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); + widget.patientER_RC.transportationDetails.ambulate = _ambulate.selectAmbulateNumber(); + widget.patientER_RC.transportationDetails.notes = note; + // widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); widget.changeCurrentTab(3); }); }, diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index cde9e248..ce4eb2f7 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +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'; @@ -28,13 +29,10 @@ enum HaveAppointment { YES, NO } class PickupLocation extends StatefulWidget { final Function changeCurrentTab; final PatientER patientER; + final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; - PickupLocation( - {Key key, - this.changeCurrentTab, - this.patientER, - this.amRequestViewModel}); + PickupLocation({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel}); @override _PickupLocationState createState() => _PickupLocationState(); @@ -77,7 +75,7 @@ class _PickupLocationState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (widget.patientER.direction == 1) + if (widget.patientER_RC.transportationDetails.direction == 1) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -112,8 +110,7 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Texts(getSelectFromMapName(context))), + Expanded(child: Texts(getSelectFromMapName(context))), Icon( FontAwesomeIcons.mapMarkerAlt, size: 24, @@ -179,8 +176,7 @@ class _PickupLocationState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -213,8 +209,7 @@ class _PickupLocationState extends State { decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( @@ -254,11 +249,9 @@ class _PickupLocationState extends State { SizedBox( height: 8, ), - InkWell( onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); }, child: Container( padding: EdgeInsets.all(12), @@ -271,8 +264,7 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName( - TranslationBase.of(context).pickupLocation)), + Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), Icon( Icons.arrow_drop_down, size: 24, @@ -284,7 +276,7 @@ class _PickupLocationState extends State { ), ], ), - if (widget.patientER.direction == 0) + if (widget.patientER_RC.transportationDetails.direction == 0) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -294,8 +286,7 @@ class _PickupLocationState extends State { ), InkWell( onTap: () { - confirmSelectHospitalDialog( - widget.amRequestViewModel.hospitals); + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); }, child: Container( padding: EdgeInsets.all(12), @@ -308,8 +299,7 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName( - TranslationBase.of(context).pickupLocation)), + Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), Icon( Icons.arrow_drop_down, size: 24, @@ -354,8 +344,7 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: Texts(getSelectFromMapName(context))), + Expanded(child: Texts(getSelectFromMapName(context))), Icon( FontAwesomeIcons.mapMarkerAlt, size: 24, @@ -387,77 +376,59 @@ class _PickupLocationState extends State { textColor: Colors.white, onTap: () { if (_result == null || _selectedHospital == null) - AppToast.showErrorToast( - message: TranslationBase.of(context).selectAll); + AppToast.showErrorToast(message: TranslationBase.of(context).selectAll); else setState(() { - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; - if (widget.patientER.direction == 0) { - - widget.patientER.dropoffLocationLattitude = - _result.geometry.location.lat.toString(); - widget.patientER.dropoffLocationLongitude = - _result.geometry.location.lng.toString(); - widget.patientER.pickupLocationLattitude = - _selectedHospital.latitude; - widget.patientER.pickupLocationLongitude = - _selectedHospital.longitude; + widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0; + if (widget.patientER_RC.transportationDetails.direction == 0) { + widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString(); + widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString(); + widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude; + widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude; } else { - widget.patientER.pickupLocationLattitude = - _selectedHospital.latitude; - widget.patientER.pickupLocationLongitude = - _selectedHospital.longitude; - widget.patientER.dropoffLocationLattitude = - _result.geometry.location.lat.toString(); - widget.patientER.dropoffLocationLongitude = - _result.geometry.location.lng.toString(); + widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude; + widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude; + widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString(); + widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString(); } - widget.patientER.latitude = - widget.patientER.pickupLocationLattitude; - widget.patientER.longitude = - widget.patientER.pickupLocationLongitude; - widget.patientER.dropoffLocationName = widget.patientER.direction == 0?_result.formattedAddress:_selectedHospital.name; - widget.patientER.createdBy = - widget.amRequestViewModel.user.patientID; - widget.patientER.isOutPatient = - widget.amRequestViewModel.user.outSA; - widget.patientER.patientIdentificationID = - widget.amRequestViewModel.user.patientIdentificationNo; - widget.patientER.pickupDateTime = - DateUtil.convertDateToStringLocation(DateTime.now()); - widget.patientER.pickupLocationName = widget.patientER.direction == 0?_selectedHospital.name:_result.formattedAddress; - widget.patientER.projectID = - widget.amRequestViewModel.user.projectID; - widget.patientER.requesterFileNo = - widget.amRequestViewModel.user.patientID; - widget.patientER.requesterIsOutSA = false; - widget.patientER.lineItemNo = 0; - widget.patientER.requesterMobileNo = - widget.amRequestViewModel.user.mobileNumber; + // widget.patientER.latitude = + // widget.patientER.pickupLocationLattitude; + // widget.patientER.longitude = + // widget.patientER.pickupLocationLongitude; + + widget.patientER_RC.transportationDetails.dropoffLocationName = widget.patientER.direction == 0 ? _result.formattedAddress : _selectedHospital.name; + // widget.patientER_RC.crea = + // widget.amRequestViewModel.user.patientID; + widget.patientER_RC.patientOutSA = widget.amRequestViewModel.user.outSA == 0 ? true : false; + widget.patientER_RC.patientOutSa = widget.amRequestViewModel.user.outSA; + + widget.patientER_RC.patientIdentificationID = widget.amRequestViewModel.user.patientIdentificationNo; + 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.transportationDetails.requesterIsOutSA = false; + // widget.patientER.lineItemNo = 0; + widget.patientER_RC.transportationDetails.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; if (_haveAppointment == HaveAppointment.YES) { - widget.patientER.appointmentNo = - myAppointment.appointmentNo.toString(); - widget.patientER.appointmentClinicName = - myAppointment.clinicName; - widget.patientER.appointmentDoctorName = - myAppointment.doctorNameObj; - widget.patientER.appointmentBranch = - myAppointment.projectName; - widget.patientER.appointmentTime = - myAppointment.appointmentDate; - widget.patientER.haveAppointment = true; + widget.patientER_RC.transportationDetails.appointmentNo = myAppointment.appointmentNo.toString(); + widget.patientER_RC.transportationDetails.appointmentClinicName = myAppointment.clinicName; + widget.patientER_RC.transportationDetails.appointmentDoctorName = myAppointment.doctorNameObj; + widget.patientER_RC.transportationDetails.appointmentBranch = myAppointment.projectName; + widget.patientER_RC.transportationDetails.appointmentTime = myAppointment.appointmentDate; + widget.patientER_RC.transportationDetails.haveAppointment = 1; } else { - widget.patientER.appointmentNo = "0"; - widget.patientER.appointmentClinicName = null; - widget.patientER.appointmentDoctorName = null; - widget.patientER.appointmentBranch = null; - widget.patientER.appointmentTime = null; - widget.patientER.haveAppointment = false; + widget.patientER_RC.transportationDetails.appointmentNo = "0"; + widget.patientER_RC.transportationDetails.appointmentClinicName = ""; + widget.patientER_RC.transportationDetails.appointmentDoctorName = ""; + widget.patientER_RC.transportationDetails.appointmentBranch = ""; + widget.patientER_RC.transportationDetails.appointmentTime = ""; + widget.patientER_RC.transportationDetails.haveAppointment = 0; } - widget.patientER.pickupSpot = _isInsideHome ? 1 : 0; + widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0; widget.changeCurrentTab(2); }); }, @@ -487,27 +458,21 @@ class _PickupLocationState extends State { } String getSelectFromMapName(context) { - return _result != null - ? _result.formattedAddress - : TranslationBase.of(context).selectMap; + return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap; } getAppointment() { GifLoaderDialogUtils.showMyDialog(context); widget.amRequestViewModel.getAppointmentHistory().then((value) { - if (widget.amRequestViewModel.state == ViewState.Error || - widget.amRequestViewModel.state == ViewState.ErrorLocal) { + if (widget.amRequestViewModel.state == ViewState.Error || widget.amRequestViewModel.state == ViewState.ErrorLocal) { AppToast.showErrorToast(message: widget.amRequestViewModel.error); - } else if (widget - .amRequestViewModel.appoitmentAllHistoryResultList.length > - 0) { + } else if (widget.amRequestViewModel.appoitmentAllHistoryResultList.length > 0) { GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, FadePage( page: AvailableAppointmentsPage( - appointmentsAllHistoryList: - widget.amRequestViewModel.appoitmentAllHistoryResultList, + appointmentsAllHistoryList: widget.amRequestViewModel.appoitmentAllHistoryResultList, ), ), ).then((value) { @@ -527,8 +492,7 @@ class _PickupLocationState extends State { setState(() { _haveAppointment = HaveAppointment.NO; }); - AppToast.showErrorToast( - message: TranslationBase.of(context).noAppointment); + AppToast.showErrorToast(message: TranslationBase.of(context).noAppointment); } }).catchError((e) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index 5bfac450..aad8eb3b 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; +import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -17,23 +18,17 @@ enum Way { OneWay, TwoWays } class SelectTransportationMethod extends StatefulWidget { final Function changeCurrentTab; final PatientER patientER; + final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; - SelectTransportationMethod( - {Key key, - this.changeCurrentTab, - this.patientER, - this.amRequestViewModel}); + SelectTransportationMethod({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel}); @override - _SelectTransportationMethodState createState() => - _SelectTransportationMethodState(); + _SelectTransportationMethodState createState() => _SelectTransportationMethodState(); } -class _SelectTransportationMethodState - extends State { - PatientERTransportationMethod _erTransportationMethod = - PatientERTransportationMethod(); +class _SelectTransportationMethodState extends State { + PatientERTransportationMethod _erTransportationMethod = PatientERTransportationMethod(); Direction _direction = Direction.FromHospital; Way _way = Way.OneWay; @@ -42,18 +37,23 @@ class _SelectTransportationMethodState @override void initState() { super.initState(); - if (widget.patientER.direction != null) { - _direction = widget.patientER.direction == 0 - ? Direction.ToHospital - : Direction.FromHospital; - _way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays; - _erTransportationMethod = widget.amRequestViewModel - .amRequestModeList[(widget.patientER.selectedAmbulate - 1)]; + // if (widget.patientER.direction != null) { + // _direction = widget.patientER.direction == 0 ? Direction.ToHospital : Direction.FromHospital; + // _way = widget.patientER.tripType == 1 ? Way.OneWay : Way.TwoWays; + // _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[(widget.patientER.selectedAmbulate - 1)]; + // } else { + // if (widget.amRequestViewModel.amRequestModeList.length != 0) _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[widget.amRequestViewModel.amRequestModeList.length - 1]; + // } + + //RC API Revamp + if (widget.patientER_RC.transportationDetails.direction != null) { + _direction = widget.patientER_RC.transportationDetails.direction == 0 ? Direction.ToHospital : Direction.FromHospital; + _way = widget.patientER_RC.transportationDetails.tripType == 1 ? Way.OneWay : Way.TwoWays; + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[(widget.patientER_RC.transportationDetails.ambulate - 1)]; } else { - if (widget.amRequestViewModel.amRequestModeList.length != 0) - _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[ - widget.amRequestViewModel.amRequestModeList.length - 1]; + if (widget.amRequestViewModel.amRequestModeList.length != 0) _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[widget.amRequestViewModel.amRequestModeList.length - 1]; } + } @override @@ -78,8 +78,7 @@ class _SelectTransportationMethodState (index) => InkWell( onTap: () { setState(() { - _erTransportationMethod = - widget.amRequestViewModel.amRequestModeList[index]; + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index]; }); }, child: Container( @@ -95,14 +94,9 @@ class _SelectTransportationMethodState Expanded( flex: 3, child: ListTile( - title: Texts(projectViewModel.isArabic - ? widget.amRequestViewModel - .amRequestModeList[index].textN - : widget.amRequestViewModel - .amRequestModeList[index].text), + title: Texts(projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text), leading: Radio( - value: widget - .amRequestViewModel.amRequestModeList[index], + value: widget.amRequestViewModel.amRequestModeList[index], groupValue: _erTransportationMethod, onChanged: (value) { setState(() { @@ -114,8 +108,7 @@ class _SelectTransportationMethodState ), Expanded( flex: 1, - child: Texts(TranslationBase.of(context).sar + - ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), + child: Texts(TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), ) ], ), @@ -181,8 +174,7 @@ class _SelectTransportationMethodState color: Colors.white, ), child: ListTile( - title: - Texts(TranslationBase.of(context).fromHospital), + title: Texts(TranslationBase.of(context).fromHospital), leading: Radio( value: Direction.FromHospital, groupValue: _direction, @@ -211,7 +203,7 @@ class _SelectTransportationMethodState height: 5, ), Container( - margin: EdgeInsets.only(bottom:65 ), + margin: EdgeInsets.only(bottom: 65), child: Row( children: [ Expanded( @@ -225,13 +217,11 @@ class _SelectTransportationMethodState decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( - title: - Texts(TranslationBase.of(context).oneDirec), + title: Texts(TranslationBase.of(context).oneDirec), leading: Radio( value: Way.OneWay, groupValue: _way, @@ -256,13 +246,11 @@ class _SelectTransportationMethodState decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), - border: - Border.all(color: Colors.grey, width: 0.5), + border: Border.all(color: Colors.grey, width: 0.5), color: Colors.white, ), child: ListTile( - title: - Texts(TranslationBase.of(context).twoDirec), + title: Texts(TranslationBase.of(context).twoDirec), leading: Radio( value: Way.TwoWays, groupValue: _way, @@ -300,28 +288,33 @@ class _SelectTransportationMethodState textColor: Colors.white, onTap: () { setState(() { - widget.patientER.transportationMethodId = (widget - .amRequestViewModel.amRequestModeList - .indexOf(_erTransportationMethod) + - 1); - widget.patientER.direction = - _direction == Direction.ToHospital ? 1 : 0; - widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; - widget.patientER.selectedAmbulate = (widget - .amRequestViewModel.amRequestModeList - .indexOf(_erTransportationMethod) + - 1); - widget.patientER.patientERTransportationMethod = - _erTransportationMethod; - widget.patientER.orderServiceID = - _orderService.getIdOrderService(); - widget.patientER.pickupUrgency = 1; - widget.patientER.lineItemNo = 1; - widget.patientER.cost = _erTransportationMethod.price.toDouble(); - widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0; - widget.patientER.totalPrice = - _erTransportationMethod.priceTotal.toDouble(); + // widget.patientER.transportationMethodId = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + // widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0; + // widget.patientER.tripType = _way == Way.TwoWays ? 0 : 1; + // widget.patientER.selectedAmbulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + // widget.patientER.patientERTransportationMethod = _erTransportationMethod; + // widget.patientER.orderServiceID = _orderService.getIdOrderService(); + // widget.patientER.pickupUrgency = 1; + // widget.patientER.lineItemNo = 1; + // widget.patientER.cost = _erTransportationMethod.price.toDouble(); + // widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0; + // widget.patientER.totalPrice = _erTransportationMethod.priceTotal.toDouble(); + // widget.changeCurrentTab(1); + + // widget.patientER_RC.transportationDetails.id = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); + 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.patientERTransportationMethod = _erTransportationMethod; + widget.patientER_RC.transportationDetails.pickupUrgency = 1; + // widget.patientER.orderServiceID = _orderService.getIdOrderService(); + // widget.patientER.lineItemNo = 1; + // widget.patientER.cost = _erTransportationMethod.price.toDouble(); + // widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0; + // widget.patientER.totalPrice = _erTransportationMethod.priceTotal.toDouble(); widget.changeCurrentTab(1); + }); }, label: TranslationBase.of(context).next, diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index 867b6583..d595fd6b 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -1,4 +1,6 @@ +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/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -6,14 +8,14 @@ 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'; -import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; class Summary extends StatefulWidget { final Function changeCurrentTab; final PatientER patientER; + final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; - Summary({Key key, this.changeCurrentTab, this.patientER, this.amRequestViewModel}); + Summary({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel}); @override _SummaryState createState() => _SummaryState(); @@ -32,7 +34,9 @@ class _SummaryState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).rrtSummary), - SizedBox(height: 5,), + SizedBox( + height: 5, + ), Container( width: double.infinity, padding: EdgeInsets.all(10), @@ -43,54 +47,95 @@ class _SummaryState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).transportMethod,color: Colors.grey,), - Texts('${widget.patientER.patientERTransportationMethod.text}',bold: true,), - SizedBox(height: 8,), - - Texts(TranslationBase.of(context).directions,color: Colors.grey,), - Texts(widget.patientER.direction ==0? TranslationBase.of(context).toHospital:TranslationBase.of(context).fromHospital,bold: true,), - SizedBox(height: 8,), - - Texts(TranslationBase.of(context).pickupLocation,color: Colors.grey,), - Texts('${widget.patientER.pickupLocationName}',bold: true,), - SizedBox(height: 8,), - - Texts(TranslationBase.of(context).dropoffLocation,color: Colors.grey,), - Texts('${widget.patientER.dropoffLocationName}',bold: true,), - SizedBox(height: 8,), - - Texts(TranslationBase.of(context).selectAmbulate,color: Colors.grey,), - Texts('${widget.patientER.ambulate.getAmbulateTitle(context)}',bold: true,), - SizedBox(height: 8,), - - Texts(TranslationBase.of(context).notes,color: Colors.grey,), - Texts('${widget.patientER.requesterNote?? '---'}',bold: true,), - SizedBox(height: 8,), + Texts( + TranslationBase.of(context).transportMethod, + color: Colors.grey, + ), + Texts( + '${widget.patientER_RC.patientERTransportationMethod.text}', + bold: true, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).directions, + color: Colors.grey, + ), + Texts( + widget.patientER_RC.transportationDetails.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital, + bold: true, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).pickupLocation, + color: Colors.grey, + ), + Texts( + '${widget.patientER_RC.transportationDetails.pickupLocationName}', + bold: true, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).dropoffLocation, + color: Colors.grey, + ), + Texts( + '${widget.patientER_RC.transportationDetails.dropoffLocationName}', + bold: true, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).selectAmbulate, + color: Colors.grey, + ), + Texts( + '${widget.patientER_RC.transportationDetails.ambulate}', + bold: true, + ), + SizedBox( + height: 8, + ), + Texts( + TranslationBase.of(context).notes, + color: Colors.grey, + ), + Texts( + '${widget.patientER_RC.transportationDetails.notes ?? '---'}', + bold: true, + ), + SizedBox( + height: 8, + ), ], ), ), - SizedBox(height: 20,), - Texts(TranslationBase.of(context).billAmount,textAlign: TextAlign.start,), - SizedBox(height: 5,), + SizedBox( + height: 20, + ), + Texts( + TranslationBase.of(context).billAmount, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), Container( - height: 55, padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8) - ), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).patientShareTotal+':'), - Texts(TranslationBase.of(context).sar+' ${widget.patientER.patientERTransportationMethod.priceTotal}') - ], + children: [Texts(TranslationBase.of(context).patientShareTotal + ':'), Texts(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}')], ), ), SizedBox(height: 130), - - ], ), ), @@ -99,15 +144,13 @@ class _SummaryState extends State { padding: EdgeInsets.all(15), width: double.maxFinite, height: 90, - child:SecondaryButton( + child: SecondaryButton( color: Colors.grey[800], textColor: Colors.white, label: TranslationBase.of(context).send, onTap: () async { - await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER); - - } - ), + await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC); + }), ), ); } From 8cb9a5e6195c7ee00404135989d05843a92f806b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 1 Sep 2021 15:33:45 +0300 Subject: [PATCH 4/4] updates --- lib/core/service/er/am_service.dart | 6 ++++-- lib/core/viewModels/er/am_request_view_model.dart | 4 ++-- .../AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 710bc9a7..9c66d373 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -74,8 +74,10 @@ class AmService extends BaseService { await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, onSuccess: (dynamic response, int statusCode) { patientAmbulanceRequestOrdersList.clear(); - print(response['data'].length); - print(response['data'][0]); + hasPendingOrder = false; + pendingOrderID = 0; + pendingAmbulanceRequestOrder = null; + response['data'].forEach((item) { patientAmbulanceRequestOrdersList.add(AmbulanceRequestOrdersModel.fromJson(item)); if (item['statusId'] == 1) { diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 33098ad2..8eb292fe 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -121,7 +121,7 @@ class AmRequestViewModel extends BaseViewModel { error = _amService.error; setState(ViewState.ErrorLocal); } else - getAmRequestOrders(); - + // getAmRequestOrders(); + getPatientAllPresOrdersListRC(); } } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 3283d97f..26c973d7 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -71,7 +71,7 @@ class _AmbulanceRequestIndexPageState extends State { OrderLogItem( title: TranslationBase.of(context).reqId, value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .statusId + .id .toString(), ), OrderLogItem(