diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 62b6ab53..98c81737 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -823,4 +823,7 @@ const Map localizedValues = { "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, + "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, + "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, + }; diff --git a/lib/core/model/prescriptions/request_prescription_report_enh.dart b/lib/core/model/prescriptions/request_prescription_report_enh.dart index 42b89c15..4905fc2a 100644 --- a/lib/core/model/prescriptions/request_prescription_report_enh.dart +++ b/lib/core/model/prescriptions/request_prescription_report_enh.dart @@ -14,6 +14,7 @@ class RequestPrescriptionReportEnh { int patientType; int appointmentNo; String setupID; + int dischargeNo; int episodeID; int clinicID; int projectID; @@ -36,7 +37,7 @@ class RequestPrescriptionReportEnh { this.setupID, this.episodeID, this.clinicID, - this.projectID}); + this.projectID,this.dischargeNo}); RequestPrescriptionReportEnh.fromJson(Map json) { versionID = json['VersionID']; @@ -79,6 +80,7 @@ class RequestPrescriptionReportEnh { data['EpisodeID'] = this.episodeID; data['ClinicID'] = this.clinicID; data['ProjectID'] = this.projectID; + data['DischargeNo'] = this.dischargeNo; return data; } } diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 74107585..9df5b0a6 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -1,5 +1,4 @@ import 'dart:io'; - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; @@ -45,8 +44,7 @@ class FeedbackService extends BaseService { if (appointHistory != null) { body['AppoinmentNo'] = appointHistory.appointmentNo; - body['AppointmentDate'] = - DateUtil.convertDateToString(appointHistory.appointmentDate); + body['AppointmentDate'] = DateUtil.convertDateToString(appointHistory.appointmentDate); body['ClinicID'] = appointHistory.clinicID; body['ClinicName'] = appointHistory.clinicName; body['DoctorID'] = appointHistory.doctorID; diff --git a/lib/core/service/medical/BloodPressureService.dart b/lib/core/service/medical/BloodPressureService.dart index 048c98e9..f2681191 100644 --- a/lib/core/service/medical/BloodPressureService.dart +++ b/lib/core/service/medical/BloodPressureService.dart @@ -3,10 +3,6 @@ import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPr import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/MonthBloodPressureResultAverage.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/WeekBloodPressureResultAverage.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/YearBloodPressureResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/MonthDiabtectResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/YearDiabtecResultAverage.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class BloodPressureService extends BaseService { diff --git a/lib/core/service/medical/WeightPressureService.dart b/lib/core/service/medical/WeightPressureService.dart index 006de821..27048dc8 100644 --- a/lib/core/service/medical/WeightPressureService.dart +++ b/lib/core/service/medical/WeightPressureService.dart @@ -1,12 +1,4 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/MonthBloodPressureResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/WeekBloodPressureResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/YearBloodPressureResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/MonthDiabtectResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/YearDiabtecResultAverage.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/MonthWeightMeasurementResultAverage.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeekWeightMeasurementResultAverage.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 027d755b..36503ac1 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -40,7 +40,7 @@ class LabsService extends BaseService { hasError = false; _requestPatientLabSpecialResult.projectID = projectID; _requestPatientLabSpecialResult.clinicID = clinicID; - _requestPatientLabSpecialResult.invoiceNo = invoiceNo; //'1800296522';//; + _requestPatientLabSpecialResult.invoiceNo = invoiceNo; _requestPatientLabSpecialResult.orderNo = orderNo; await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, diff --git a/lib/core/service/medical/my_doctor_service.dart b/lib/core/service/medical/my_doctor_service.dart index f2ba067a..3d9e14b7 100644 --- a/lib/core/service/medical/my_doctor_service.dart +++ b/lib/core/service/medical/my_doctor_service.dart @@ -22,12 +22,6 @@ class MyDoctorService extends BaseService { channel: 3, deviceTypeID: 2, doctorID: 2477, - iPAdress: '10.20.10.20', - languageID: 2, - patientOutSA: 0, - sessionID: 'CvsUFeJkyLDnFQqw', - versionID: 5.5, - generalid: 'Cs2020@2016\$2958', isDentalAllowedBackend: false); Future getPatientDoctorAppointmentList({int top = 0, int beforeDays = 0,int exludType=4}) async { @@ -52,18 +46,6 @@ class MyDoctorService extends BaseService { RequestDoctorProfile _requestDoctorProfile = RequestDoctorProfile( license: true, isRegistered: true, - projectID: 12, - clinicID: 501, - patientID: 1231755, - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'nstatCtNEmuwxeuVAOUmw', - isDentalAllowedBackend: false, - deviceTypeID: 2, ); Future getDoctorProfileAndRating( @@ -87,7 +69,7 @@ class MyDoctorService extends BaseService { }, body: _requestDoctorProfile.toJson()); ///GET DOCTOR RATING - //_requestDoctorRating.doctorID = doctorId; + _requestDoctorRating.doctorID = doctorId; await baseAppClient.post(GET_DOCTOR_RATING, onSuccess: (dynamic response, int statusCode) { doctorRating = DoctorRating.fromJson(response['AvgDoctorRatingList'][0]); diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 3359e994..34c5bf54 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -11,40 +11,17 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescripti import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions_orders.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/request_send_prescription_email.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:flutter/cupertino.dart'; class PrescriptionsService extends BaseService { List prescriptionsList = List(); - RequestPrescriptions _requestPrescriptions = RequestPrescriptions( - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'KIbLoqkytuKJEWECHQ', - isDentalAllowedBackend: false, - deviceTypeID: 2, - patientID: 1231755, - tokenID: '@dm!n', - patientTypeID: 1, - patientType: 1); List prescriptionsOrderList = List(); - RequestPrescriptionsOrders _requestPrescriptionsOrders = - RequestPrescriptionsOrders( - patientID: 1231755, - patientOutSA: 0, - versionID: 5.5, - channel: 3, - languageID: 1, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - sessionID: 'KIbLoqkytuKJEWECHQ', - isDentalAllowedBackend: false, - deviceTypeID: 2); Future getPrescriptions() async { hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; await baseAppClient.post(PRESCRIPTIONS, onSuccess: (dynamic response, int statusCode) { prescriptionsList.clear(); @@ -54,10 +31,12 @@ class PrescriptionsService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestPrescriptions.toJson()); + }, body: body); } Future getPrescriptionsOrders() async { + Map body = Map(); + body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { prescriptionsOrderList.clear(); @@ -69,33 +48,16 @@ class PrescriptionsService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestPrescriptionsOrders.toJson()); + }, body: body); } RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport( - appointmentNo: 0, - channel: 3, - clinicID: 4, - deviceTypeID: 2, - dischargeNo: 2018003246, - episodeID: 0, - iPAdress: '10.20.10.20', - languageID: 1, - patientID: 1231755, - patientOutSA: 0, - patientType: 1, - patientTypeID: 1, - projectID: 12, - sessionID: 'wgKuHpsPsEuLnlJhAYCQ', - tokenID: '@dm!n', - setupID: "91877", - versionID: 5.5, - generalid: 'Cs2020@2016\$2958', - isDentalAllowedBackend: false); + appointmentNo: 0, isDentalAllowedBackend: false); List prescriptionReportList = List(); - Future getPrescriptionReport({int dischargeNo,int projectId,int clinicID,String setupID}) async { + Future getPrescriptionReport( + {int dischargeNo, int projectId, int clinicID, String setupID}) async { hasError = false; _requestPrescriptionReport.dischargeNo = dischargeNo; _requestPrescriptionReport.projectID = projectId; @@ -116,24 +78,7 @@ class PrescriptionsService extends BaseService { RequestSendPrescriptionEmail _requestSendPrescriptionEmail = RequestSendPrescriptionEmail( - versionID: 5.5, - languageID: 2, - channel: 3, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'twIUmHfOHqFdDfVcyw', - isDentalAllowedBackend: false, - deviceTypeID: 2, - tokenID: '@dm!n', - patientTypeID: 1, - patientType: 1, - to: 'aljammalzmohammad@outlook.com', - dateofBirth: '/Date(536743800000+0300)/', - patientIditificationNum: '2344670985', - patientMobileNumber: '537503378', - patientName: 'TAMER FANASHEH', - setupID: '91877'); + isDentalAllowedBackend: false,); Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int projectID) async { @@ -143,31 +88,25 @@ class PrescriptionsService extends BaseService { _requestSendPrescriptionEmail.clinicName = clinicName; _requestSendPrescriptionEmail.doctorName = doctorName; _requestSendPrescriptionEmail.projectID = projectID; + _requestSendPrescriptionEmail.to = user.emailAddress; + _requestSendPrescriptionEmail.dateofBirth = user.dateofBirth; + _requestSendPrescriptionEmail.patientIditificationNum = user.patientIdentificationNo; + _requestSendPrescriptionEmail.patientMobileNumber = user.mobileNumber; + _requestSendPrescriptionEmail.patientName = user.firstName +" "+ user.lastName; + _requestSendPrescriptionEmail.setupID = user.setupID; hasError = false; - await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, - onSuccess: (response,statusCode){ - - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, + onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: _requestSendPrescriptionEmail.toJson()); } - RequestGetListPharmacyForPrescriptions - requestGetListPharmacyForPrescriptions = - RequestGetListPharmacyForPrescriptions( + RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions( latitude: 0, longitude: 0, - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'HGNerTUSXhpaHXBg', isDentalAllowedBackend: false, - deviceTypeID: 2, + ); List pharmacyPrescriptionsList = List(); @@ -187,44 +126,85 @@ class PrescriptionsService extends BaseService { }, body: requestGetListPharmacyForPrescriptions.toJson()); } + RequestPrescriptionReportEnh _requestPrescriptionReportEnh = + RequestPrescriptionReportEnh(isDentalAllowedBackend: false,); - RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh( - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'bQQdesEKpyYKTFMVNeg', - isDentalAllowedBackend: false, - deviceTypeID: 2, - patientID: 1231755, - tokenID: '@dm!n', - patientTypeID: 1, - patientType: 1, - setupID: '91877', - appointmentNo: 5926390, - episodeID: 140251928, - clinicID: 25, - projectID: 12 + 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") { + if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) { + + _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; + _requestPrescriptionReportEnh.clinicID = element.clinicID; + _requestPrescriptionReportEnh.projectID = element.projectID; + _requestPrescriptionReportEnh.episodeID = element.episodeID; + _requestPrescriptionReportEnh.setupID = element.setupID; + _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; + isInPatient = element.isInOutPatient; + } + } else { + if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) { + _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; + _requestPrescriptionReportEnh.clinicID = element.clinicID; + _requestPrescriptionReportEnh.projectID = element.projectID; + _requestPrescriptionReportEnh.episodeID = element.episodeID; + _requestPrescriptionReportEnh.setupID = element.setupID; + _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; + isInPatient = element.isInOutPatient;///call inpGetPrescriptionReport + } + } + }); - List prescriptionReportEnhList = List(); - Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder})async{ hasError = false; - // _requestPrescriptionReportEnh.appointmentNo = int.parse(prescriptionsOrder.appointmentNo); - // _requestPrescriptionReportEnh.patientID = prescriptionsOrder.projectID; - await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH, + await baseAppClient.post(isInPatient? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) { - prescriptionReportEnhList.clear(); - response['ListPRM'].forEach((prescriptions) { - prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions)); - }); + prescriptionReportEnhList.clear(); + + if(isInPatient){ + response['ListPRM'].forEach((prescriptions) { + prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions)); + }); + }else{ + response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { + + PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions); + reportEnh.itemDescription = prescriptions['ItemDescriptionN']; + prescriptionReportEnhList.add(reportEnh); + + }); + + } + + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPrescriptionReportEnh.toJson()); + + + } + + Future updatePressOrder({@required int presOrderID}) async { + hasError = false; + Map body = Map(); + body['PresOrderID'] = presOrderID; + body['EditedBy'] = user.patientID; + body['RejectionReason'] = ''; + body['PresOrderStatus'] = 4; + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(UPDATE_PRESS_ORDER, + onSuccess: (dynamic response, int statusCode) { + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestPrescriptionReportEnh.toJson()); + }, body: body); } + } diff --git a/lib/core/service/medical/reports_monthly_service.dart b/lib/core/service/medical/reports_monthly_service.dart index 5e643669..479360ac 100644 --- a/lib/core/service/medical/reports_monthly_service.dart +++ b/lib/core/service/medical/reports_monthly_service.dart @@ -12,19 +12,8 @@ class ReportsMonthlyService extends BaseService { isReport: true, encounterType: 1, requestType: 1, - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: "10.20.10.20", - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'KIbLoqkytuKJEWECHQ', isDentalAllowedBackend: false, - deviceTypeID: 2, - patientID: 1231755, - tokenID: '@dm!n', - patientTypeID: 1, - patientType: 1); + ); Future getReports() async { hasError = false; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index 316872ed..19f86e2e 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -12,19 +12,8 @@ class ReportsService extends BaseService { isReport: true, encounterType: 1, requestType: 1, - versionID: 5.5, - channel: 3, - languageID: 2, - iPAdress: "10.20.10.20", - generalid: 'Cs2020@2016\$2958', patientOutSA: 0, - sessionID: 'KIbLoqkytuKJEWECHQ', - isDentalAllowedBackend: false, - deviceTypeID: 2, - patientID: 1231755, - tokenID: '@dm!n', - patientTypeID: 1, - patientType: 1); + ); Future getReports() async { hasError = false; diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 9d74fd88..8f9218c9 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/cupertino.dart'; import '../../../core/enum/filter_type.dart'; import '../../../core/enum/viewstate.dart'; @@ -157,4 +158,16 @@ class PrescriptionsViewModel extends BaseViewModel { } } + + Future updatePressOrder({@required int presOrderID}) async { + setState(ViewState.Busy); + await _prescriptionsService.updatePressOrder(presOrderID: presOrderID); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + await getPrescriptions(); + } + } + } diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 454abb4d..a7d7ba42 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.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/pages/MyAppointments/models/AppointmentType.dart'; @@ -13,6 +14,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class MyAppointments extends StatefulWidget { List appoList = []; diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index 6a2bcdde..5061a8ba 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -1,8 +1,10 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/BottomButton.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'; import 'package:flutter/material.dart'; @@ -10,15 +12,16 @@ import 'package:flutter/material.dart'; class PrescriptionsHistoryDetailsPage extends StatelessWidget { final PrescriptionsOrder prescriptionsOrder; - PrescriptionsHistoryDetailsPage({Key key,this.prescriptionsOrder}); + PrescriptionsHistoryDetailsPage({Key key, this.prescriptionsOrder}); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder), - builder: (_,model,widget) => AppScaffold( + onModelReady: (model) => model.getPrescriptionReportEnh( + prescriptionsOrder: prescriptionsOrder), + builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Order History', + appBarTitle: TranslationBase.of(context).orderDetails, baseViewModel: model, body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -27,82 +30,123 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 5, + ), + Texts(TranslationBase.of(context).orderStatus +' : ${prescriptionsOrder.descriptionN}'), + SizedBox( + height: 5, + ), Table( border: TableBorder.symmetric( inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)), children: [ - TableRow( - children: [ - Container( - height: 50, - color: Colors.white, - child: Center(child: Texts('Order No'),), - ), - Container( - height: 50, - color: Colors.white, - child: Center(child: Texts('Date'),), - ), - ] - ), - TableRow( - children: [ - Container( - height: 50, - color: Colors.white, - child: Center(child: Texts('12655'),), - ), - Container( - height: 50, - color: Colors.white, - child: Center(child: Texts('2020-7-15'),), - ), - ] - ) + TableRow(children: [ + Container( + height: 50, + color: Colors.white, + child: Center( + child: Texts(TranslationBase.of(context).orderNo), + ), + ), + Container( + height: 50, + color: Colors.white, + child: Center( + child: Texts(TranslationBase.of(context).date), + ), + ), + ]), + TableRow(children: [ + Container( + height: 50, + color: Colors.white, + child: Center( + child: Texts('${prescriptionsOrder.iD}'), + ), + ), + Container( + height: 50, + color: Colors.white, + child: Center( + child: Texts('${prescriptionsOrder.createdOn}'), + ), + ), + ]) ], ), - SizedBox(height: 15,), - ...List.generate(model.prescriptionReportEnhList.length, (index) => Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + SizedBox( + height: 15, + ), + ...List.generate( + model.prescriptionReportEnhList.length, + (index) => Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription), - ], + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(model.prescriptionReportEnhList[index] + .itemDescription), + ], + ), ), ), - ), - - ], + ], + ), ), - )) + ) ], ), ), ), bottomSheet: Container( //padding: EdgeInsets.all(8.0), - // margin: EdgeInsets.all(8.0), - child: BottomButton(label: 'Cancel order',color: Colors.red[300],), + // margin: EdgeInsets.all(8.0), + child: BottomButton( + label: TranslationBase.of(context).cancelOrder, + disabled: prescriptionsOrder.status != 1, + textColor: Colors.white, + onTap: (){ + + showCDialog(model,context); + //showAlertDialog(context); + }, + ), ), ), ); } + + showCDialog(PrescriptionsViewModel model,context){ + ConfirmDialog( + context: context, + confirmMessage: "Are you sure ?", + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel, + okFunction: () { + Navigator.of(context).pop(); + model.updatePressOrder(presOrderID: prescriptionsOrder.iD).then((value) { + Navigator.of(context).pop(); + }); + }, + cancelFunction: () => {}).showAlertDialog(context); + // dialog.showAlertDialog(context); + } + } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6029f46d..12704424 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -776,6 +776,10 @@ class TranslationBase { localizedValues['month-report'][locale.languageCode]; String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + + String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; + String get cancelOrder => localizedValues['CancelOrder'][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index e14ec584..af0ccc8f 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -185,7 +185,7 @@ class _SecondaryButtonState extends State height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( shape: BoxShape.circle, - color: widget.color?? Theme.of(context).primaryColor, + color: widget.disabled? Colors.grey: widget.color ?? Theme.of(context).primaryColor, ), ), ), diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index 85116d5f..8f1192a5 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -22,12 +23,11 @@ class ConfirmDialog { showAlertDialog(BuildContext context) { // set up the buttons Widget cancelButton = FlatButton( - child: Text(this.cancelText), + child: Texts(this.cancelText), onPressed: () { Navigator.of(context).pop(); }); - Widget continueButton = - FlatButton(child: Text(this.okText), onPressed: this.okFunction); + Widget continueButton = FlatButton(child: Texts(okText), onPressed: okFunction); // set up the AlertDialog AlertDialog alert = AlertDialog( @@ -41,7 +41,6 @@ class ConfirmDialog { // show the dialog showDialog( - barrierDismissible: false, context: context, builder: (BuildContext context) { return alert;