From c44c8dac15f4013208e648b4748ca67a322d0c1f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 1 Oct 2025 17:29:10 +0300 Subject: [PATCH] updates --- lib/config/config.dart | 6 +- lib/config/localized_values.dart | 1 + lib/core/model/hospitals/hospitals_model.dart | 15 +- lib/core/model/labs/lab_result.dart | 9 + lib/core/service/client/base_app_client.dart | 2 +- .../medical/prescriptions_service.dart | 22 + .../viewModels/medical/labs_view_model.dart | 8 +- .../fragments/home_page_fragment2.dart | 38 +- lib/pages/landing/fragments/offer_banner.dart | 6 +- .../landing/fragments/offer_details_page.dart | 383 +++++++++--------- lib/pages/livecare/widgets/clinic_list.dart | 4 +- .../prescription_items_page.dart | 76 +++- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 8 +- .../LabResult/laboratory_result_widget.dart | 17 +- .../medical/LabResult/newUI/labWidgets.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- pubspec.yaml | 10 +- 18 files changed, 347 insertions(+), 265 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 95bce89d..4b6da0f0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -703,6 +703,8 @@ var IS_DOCTOR_AVAILABLE_BY_CALENDAR_SCHEDULE = 'Services/OUTPs.svc/REST/HIS_IsDo var GET_OFFER_DETAILS = 'Services/Authentication.svc/REST/GetNDOfferData'; +var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatbot_SendMedicationInstructionByWhatsApp'; + //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 13250d9d..857d7ffb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2845,4 +2845,5 @@ const Map localizedValues = { "thisResult": {"en": "This Result", "ar": "هذه النتيجة"}, "seeAllGraphValues": {"en": "View all results", "ar": "عرض جميع النتائج"}, "verify-with-biometric": {"en": "Biometric", "ar": "الحيوية"}, + "medicationInstructions": {"en": "Medication Instructions", "ar": "تعليمات الدواء"}, }; diff --git a/lib/core/model/hospitals/hospitals_model.dart b/lib/core/model/hospitals/hospitals_model.dart index cc13ed81..921fbb17 100644 --- a/lib/core/model/hospitals/hospitals_model.dart +++ b/lib/core/model/hospitals/hospitals_model.dart @@ -20,6 +20,7 @@ class HospitalsModel { String? regionArabic; String? regionEnglish; String? regionID; + num? amountWithTax; HospitalsModel( {this.desciption, @@ -37,13 +38,13 @@ class HospitalsModel { this.longitude, this.mainProjectID, this.projectOutSA, - this.usingInDoctorApp, - this.isHMC, - this.region, - this.regionArabic, - this.regionEnglish, - this.regionID, - }); + this.usingInDoctorApp, + this.isHMC, + this.region, + this.regionArabic, + this.regionEnglish, + this.regionID, + this.amountWithTax}); HospitalsModel.fromJson(Map json) { desciption = json['Desciption']; diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart index 51e49fc3..de6a10db 100644 --- a/lib/core/model/labs/lab_result.dart +++ b/lib/core/model/labs/lab_result.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app/widgets/data_display/medical/LabResult/newUI/labWidgets.dart'; class LabResultList { @@ -219,6 +220,14 @@ class LabResult { bool shouldShowResultBarAndGraph() { if (resultTypeID == null) return false; if (resultTypeID == 6) return false; + if (referanceRange == null || referanceRange == "" || referanceRange == "\n") return false; + + try { + num.parse(resultValue ?? ""); + } catch (e) { + debugPrint("Exception in parsing result value: $e"); + return false; + } return true; } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a9444703..6081599d 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -187,7 +187,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 4767477; //4609100 + // body['PatientID'] = 4771637; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 3844517b..c90e053b 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -24,6 +24,8 @@ class PrescriptionsService extends BaseService { String prescriptionReportPDF = ""; + String prescriptionInstructionsPDFLink = ""; + Future getPrescriptions() async { hasError = false; Map body = Map(); @@ -259,4 +261,24 @@ class PrescriptionsService extends BaseService { super.error = error; }, body: body); } + + Future getMedicationsInstructionsPDF({required String setupID, required int projectID, required String appointmentNo}) async { + hasError = false; + Map body = Map(); + body['SetupID'] = setupID; + body['ProjectID'] = projectID; + body['AppointmentNo'] = appointmentNo; + // body['AppointmentNo'] = "2016072489"; + body['LocationID'] = "0"; + body['SalesInvoiceNo'] = "0"; + body['IsTest'] = false; + body['ChannelID'] = "3"; + await baseAppClient.post(GET_PRESCRIPTION_INSTRUCTIONS_PDF, onSuccess: (dynamic response, int statusCode) { + // print(response["InvoiceUrl"]); + prescriptionInstructionsPDFLink = response["InvoiceUrl"]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 74ab7c32..3bd78682 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -213,8 +213,8 @@ class LabsViewModel extends BaseViewModel { } catch (e) {} }); - threePointGraphValue.last.label = "thisResult"; - threePointGraphValue.last.isStringResource = true; + // threePointGraphValue.last.label = "thisResult"; + // threePointGraphValue.last.isStringResource = true; setState(ViewState.Idle); } } @@ -240,8 +240,8 @@ class LabsViewModel extends BaseViewModel { } ++counter; }); - completeeGraphValues.last.label = "thisResult"; - completeeGraphValues.last.isStringResource = true; + // completeeGraphValues.last.label = "thisResult"; + // completeeGraphValues.last.isStringResource = true; setState(ViewState.Idle); onComplete(); } diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index b5e152d0..717396a1 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -150,19 +150,33 @@ class _HomePageFragment2State extends State { ), ), (projectViewModel.havePrivilege(111) && projectViewModel.hisProjectOffers.isNotEmpty) - ? InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OfferDetailsPage( - title: projectViewModel.isArabic ? projectViewModel.hisProjectOffers.first.titleArabic! : projectViewModel.hisProjectOffers.first.titleName!, - onLoginClick: widget.onLoginClick!, + ? Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OfferDetailsPage( + title: projectViewModel.isArabic + ? projectViewModel.hisProjectOffers.first.titleArabic!.split("\$")[0].trim() + : projectViewModel.hisProjectOffers.first.titleName!.split("\$")[0].trim(), + onLoginClick: widget.onLoginClick!, + ), ), - ), - ); - }, - child: DiscountCardWidget(), + ); + }, + child: SvgPicture.network( + "https://marathoon.com/service/hmgvideo/Banner_English.svg", + // "https://marathoon.com/service/hmgvideo/Banner_Arabic.svg", + // projectViewModel.isArabic ? projectViewModel.hisProjectOffers.first.titleArabic!.split("\$")[1].trim() : projectViewModel.hisProjectOffers.first.titleName!.split("\$")[1].trim(), + // height: 300, + width: MediaQuery.of(context).size.width, + fit: BoxFit.contain, + // color: color, + ), + // DiscountCardWidget(), + ), ) : SizedBox.shrink(), projectViewModel.isLogin diff --git a/lib/pages/landing/fragments/offer_banner.dart b/lib/pages/landing/fragments/offer_banner.dart index e41f797c..62101dcb 100644 --- a/lib/pages/landing/fragments/offer_banner.dart +++ b/lib/pages/landing/fragments/offer_banner.dart @@ -48,7 +48,7 @@ class _DiscountCardWidgetState extends State { Text( projectViewModel.hisProjectOffers.first.titleArabic!, style: TextStyle( - fontSize: 20, + fontSize: 18, fontFamily: 'Cairo', fontWeight: FontWeight.bold, color: Colors.white, @@ -105,7 +105,7 @@ class _DiscountCardWidgetState extends State { 'This Offer is valid till ${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(projectViewModel.hisProjectOffers.first.validTo))}', style: TextStyle( fontFamily: 'Poppins', - fontSize: 11, + fontSize: 10, color: Colors.white, ), ), @@ -113,7 +113,7 @@ class _DiscountCardWidgetState extends State { "يسري العرض حتى ${DateUtil.getMonthDayYearDateFormattedAr(DateUtil.convertStringToDate(projectViewModel.hisProjectOffers.first.validTo))}", style: TextStyle( fontFamily: 'Cairo', - fontSize: 11, + fontSize: 10, fontWeight: FontWeight.w300, color: Colors.white, ), diff --git a/lib/pages/landing/fragments/offer_details_page.dart b/lib/pages/landing/fragments/offer_details_page.dart index 0e08b813..1b8a8de9 100644 --- a/lib/pages/landing/fragments/offer_details_page.dart +++ b/lib/pages/landing/fragments/offer_details_page.dart @@ -57,207 +57,207 @@ class _OfferDetailsPageState extends State { late String tamaraOrderID; late MyInAppBrowser browser; + num paymentAmount = 295.0; + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - return Directionality( - // lock the whole page to LTR - textDirection: TextDirection.ltr, - child: AppScaffold( - isShowDecPage: false, - isShowAppBar: false, - showNewAppBar: true, - isHelp: true, - showNewAppBarTitle: true, - appBarTitle: widget.title, - body: Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - /// Banner - SvgPicture.asset( - "assets/images/svg/details_page_banner.svg", - height: 120, - fit: BoxFit.fill, - ), - - /// Arabic Offer Section - Padding( - padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 32.0), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only(top: 32), - child: Directionality( - textDirection: TextDirection.rtl, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - projectViewModel.hisProjectOffers.first.titleArabic!, - style: TextStyle( - fontFamily: 'Cairo', - fontSize: 22, - fontWeight: FontWeight.bold, - color: Color(0xff008b4c), - ), - ), - Text( - projectViewModel.hisProjectOffers.first.descriptionArabic!, - style: TextStyle( - fontFamily: 'Cairo', - fontWeight: FontWeight.w300, - fontSize: 16, - ), - ), - SizedBox(height: 12), - Text( - projectViewModel.hisProjectOffers.first.detailsArabic!, - style: TextStyle( - fontFamily: 'Cairo', - fontWeight: FontWeight.w300, - fontSize: 14, - ), - ), - ], - ), - ), - ), + return AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + showNewAppBar: true, + isHelp: true, + showNewAppBarTitle: true, + appBarTitle: widget.title, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + /// Banner + SvgPicture.asset( + "assets/images/svg/details_page_banner.svg", + height: 120, + fit: BoxFit.fill, + ), - const SizedBox(height: 20), - const Divider(thickness: 1, color: Color(0xff008b4c)), - const SizedBox(height: 20), - - /// English Offer Section - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - projectViewModel.hisProjectOffers.first.titleName!, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - color: Color(0xff008b4c), - ), + /// Arabic Offer Section + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 32.0), + child: Column( + children: [ + // Padding( + // padding: const EdgeInsets.only(top: 32), + // child: Directionality( + // textDirection: TextDirection.rtl, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // projectViewModel.hisProjectOffers.first.titleArabic!, + // style: TextStyle( + // fontFamily: 'Cairo', + // fontSize: 22, + // fontWeight: FontWeight.bold, + // color: Color(0xff008b4c), + // ), + // ), + // Text( + // projectViewModel.hisProjectOffers.first.descriptionArabic!, + // style: TextStyle( + // fontFamily: 'Cairo', + // fontWeight: FontWeight.w300, + // fontSize: 16, + // ), + // ), + // SizedBox(height: 12), + // Text( + // projectViewModel.hisProjectOffers.first.detailsArabic!, + // style: TextStyle( + // fontFamily: 'Cairo', + // fontWeight: FontWeight.w300, + // fontSize: 14, + // ), + // ), + // ], + // ), + // ), + // ), + + // const SizedBox(height: 20), + // const Divider(thickness: 1, color: Color(0xff008b4c)), + const SizedBox(height: 20), + + /// English Offer Section + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + projectViewModel.isArabic + ? projectViewModel.hisProjectOffers.first.titleArabic!.split("\$")[0].trim() + : projectViewModel.hisProjectOffers.first.titleName!.split("\$")[0].trim(), + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + color: Color(0xff008b4c), ), - Text( - projectViewModel.hisProjectOffers.first.descriptionEnglish!, - style: TextStyle( - fontFamily: 'Poppins', - fontSize: 16, - fontWeight: FontWeight.bold, - ), + ), + Text( + projectViewModel.isArabic ? projectViewModel.hisProjectOffers.first.descriptionArabic! : projectViewModel.hisProjectOffers.first.descriptionEnglish!, + style: TextStyle( + // fontFamily: 'Poppins', + fontSize: 16, + fontWeight: FontWeight.bold, ), - SizedBox(height: 12), - Text( - projectViewModel.hisProjectOffers.first.detailsEnglish!, - style: TextStyle( - fontSize: 14, - fontFamily: 'Poppins', - ), + ), + SizedBox(height: 12), + Text( + projectViewModel.isArabic ? projectViewModel.hisProjectOffers.first.detailsArabic! : projectViewModel.hisProjectOffers.first.detailsEnglish!, + style: TextStyle( + fontSize: 14, + // fontFamily: 'Poppins', ), - ], - ), - ), - - const SizedBox(height: 24), - - /// Hospital Dropdown (mock UI) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), - decoration: BoxDecoration( - color: Colors.grey.shade300, - borderRadius: BorderRadius.circular(12), ), - child: InkWell( - onTap: () { - openHospitalSelection(context); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - children: [ - Directionality( - textDirection: TextDirection.rtl, - child: Text( - selectedHospital?.nameN ?? TranslationBase.of(context).selectHospital, - style: TextStyle( - fontWeight: FontWeight.bold, - fontFamily: 'Cairo', - ), - ), - ), - Text( - selectedHospital?.name ?? TranslationBase.of(context).selectHospital, + ], + ), + ), + + const SizedBox(height: 24), + + /// Hospital Dropdown (mock UI) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + decoration: BoxDecoration( + color: Colors.grey.shade300, + borderRadius: BorderRadius.circular(12), + ), + child: InkWell( + onTap: () { + openHospitalSelection(context); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + children: [ + Directionality( + textDirection: TextDirection.rtl, + child: Text( + selectedHospital?.nameN ?? TranslationBase.of(context).selectHospital, style: TextStyle( fontWeight: FontWeight.bold, - fontFamily: 'Poppins', + fontFamily: 'Cairo', ), ), - ], - ), + ), + Text( + selectedHospital?.name ?? TranslationBase.of(context).selectHospital, + style: TextStyle( + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + ), + ), + ], ), - Icon(Icons.arrow_drop_down), - ], - ), + ), + Icon(Icons.arrow_drop_down), + ], ), ), ), + ), - const SizedBox(height: 24), + const SizedBox(height: 24), - /// Buttons - ], - ), + /// Buttons + ], ), + ), - const SizedBox(height: 30), - ], - ), + const SizedBox(height: 30), + ], ), ), - Padding( - padding: const EdgeInsets.only(left: 12.0, right: 12.0, bottom: 8), - child: Row( - children: [ - SizedBox( - width: MediaQuery.of(context).size.width - 24, - height: 50, - child: DefaultButton("Pay Now ادفع الآن", () { - if (projectViewModel.isLogin) { - if (selectedHospital != null) { - startPaymentProcess(context); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).selectHospital); - } + ), + Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0, bottom: 8), + child: Row( + children: [ + SizedBox( + width: MediaQuery.of(context).size.width - 24, + height: 50, + child: DefaultButton("Pay Now ادفع الآن", () { + if (projectViewModel.isLogin) { + if (selectedHospital != null) { + startPaymentProcess(context); } else { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).loginToUseService, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () { - Navigator.of(context).pop(); - widget.onLoginClick!(); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + AppToast.showErrorToast(message: TranslationBase.of(context).selectHospital); } - }), - ), - ], - ), + } else { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).loginToUseService, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () { + Navigator.of(context).pop(); + widget.onLoginClick!(); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }), + ), + ], ), - ], - ), + ), + ], ), ); } @@ -270,19 +270,19 @@ class _OfferDetailsPageState extends State { onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) { selectedPaymentMethod = metohd; }, - patientShare: projectViewModel.hisProjectOffers.first.amountWithTax, + patientShare: paymentAmount, isShowInstallments: false, - isFromAdvancePayment: false), + isFromAdvancePayment: true), ), ).then((value) { if (selectedPaymentMethod == "ApplePay") { if (projectViewModel.havePrivilege(103)) { startApplePay(context); } else { - openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, projectViewModel.hisProjectOffers.first.amountWithTax!, AppoitmentAllHistoryResultList()); + openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, paymentAmount, AppoitmentAllHistoryResultList()); } } else { - openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, projectViewModel.hisProjectOffers.first.amountWithTax!, AppoitmentAllHistoryResultList()); + openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, paymentAmount, AppoitmentAllHistoryResultList()); } }); } @@ -322,7 +322,7 @@ class _OfferDetailsPageState extends State { applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; - applePayInsertRequest.amount = projectViewModel.hisProjectOffers.first.amountWithTax.toString(); + applePayInsertRequest.amount = paymentAmount.toString(); applePayInsertRequest.isSchedule = "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; @@ -349,7 +349,7 @@ class _OfferDetailsPageState extends State { // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Advance Payment", - orderAmount: projectViewModel.hisProjectOffers.first.amountWithTax, + orderAmount: paymentAmount, merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", @@ -442,14 +442,7 @@ class _OfferDetailsPageState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called"); if (selectedPaymentMethod == "TAMARA" && tamaraPaymentStatus != null && tamaraPaymentStatus == "approved") { - var res = { - "Amount": projectViewModel.hisProjectOffers.first.amountWithTax!, - "ErrorMessage": null, - "Fort_id": tamaraOrderID, - "Merchant_Reference": "5058637919318707883366", - "PaymentMethod": "TAMARA", - "Response_Message": "Success" - }; + var res = {"Amount": paymentAmount, "ErrorMessage": null, "Fort_id": tamaraOrderID, "Merchant_Reference": "5058637919318707883366", "PaymentMethod": "TAMARA", "Response_Message": "Success"}; purchaseOfferAPICall(res); } else { checkPaymentStatus(appo); @@ -473,7 +466,7 @@ class _OfferDetailsPageState extends State { } else { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: res['Response_Message']); - amount = projectViewModel.hisProjectOffers.first.amountWithTax!.toString(); + amount = paymentAmount.toString(); payment_method = selectedPaymentMethod; } }).catchError((err) { @@ -518,11 +511,7 @@ class _OfferDetailsPageState extends State { List projectsListLocal = []; projectViewModel.hisProjectOffers.forEach((project) { - projectsListLocal.add(new HospitalsModel( - iD: project.projectId, - name: project.projectEnglish, - nameN: project.projectArabic, - )); + projectsListLocal.add(new HospitalsModel(iD: project.projectId, name: project.projectEnglish, nameN: project.projectArabic, amountWithTax: project.amountWithTax)); }); showDialog( @@ -536,6 +525,8 @@ class _OfferDetailsPageState extends State { _selectedHospitalIndex = index; setState(() { selectedHospital = projectsListLocal[index]; + paymentAmount = projectsListLocal[index].amountWithTax ?? 295.0; + print(paymentAmount); }); }, ), diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index d54855e3..599b7df9 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -722,7 +722,7 @@ class _clinic_listState extends State { setState(() { liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse.fromJson(res as Map); selectedClinicID = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![0].serviceID!; - selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![0].clinicDesc!; + selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![0].clinicDesc ?? "LiveCare Clinic"; isDataLoaded = true; }); } else { @@ -979,7 +979,7 @@ class _clinic_listState extends State { updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) { setState(() { selectedClinicID = patientERGetClinicsList.serviceID!; - selectedClinicName = patientERGetClinicsList.clinicDesc!; + selectedClinicName = patientERGetClinicsList.clinicDesc ?? "LiveCare Clinic"; }); } } diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 84990b6b..471cad04 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -1,14 +1,17 @@ import 'package:hmg_patient_app/core/enum/viewstate.dart'; import 'package:hmg_patient_app/core/model/prescriptions/Prescriptions.dart'; import 'package:hmg_patient_app/core/model/prescriptions/prescription_report.dart'; +import 'package:hmg_patient_app/core/service/medical/prescriptions_service.dart'; import 'package:hmg_patient_app/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; import 'package:hmg_patient_app/extensions/string_extensions.dart'; +import 'package:hmg_patient_app/locator.dart'; import 'package:hmg_patient_app/main.dart'; import 'package:hmg_patient_app/models/header_model.dart'; import 'package:hmg_patient_app/pages/base/base_view.dart'; import 'package:hmg_patient_app/pages/medical/prescriptions/prescription_details_inp.dart'; import 'package:hmg_patient_app/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:hmg_patient_app/theme/colors.dart'; import 'package:hmg_patient_app/uitl/app_toast.dart'; import 'package:hmg_patient_app/uitl/date_uitl.dart'; import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart'; @@ -23,6 +26,7 @@ import 'package:hmg_patient_app/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; import 'PrescriptionIDeliveryAddressPage.dart'; @@ -33,6 +37,8 @@ class PrescriptionItemsPage extends StatelessWidget { PrescriptionItemsPage({Key? key, required this.prescriptions}); + PrescriptionsService _prescriptionsService = locator(); + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -409,26 +415,56 @@ class PrescriptionItemsPage extends StatelessWidget { Container( color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).resendOrder, - () { - if (model.isMedDeliveryAllowed == false) { - AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError); - } else { - Navigator.push( - context, - FadePage( - page: PrescriptionDeliveryAddressPage( - prescriptions: prescriptions, - prescriptionReportList: model.prescriptionReportList, - prescriptionReportEnhList: model.prescriptionReportEnhList, - ), - ), - ); - } - }, - color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846), - disabledColor: Color(0xff575757), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).resendOrder, + () { + if (model.isMedDeliveryAllowed == false) { + AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError); + } else { + Navigator.push( + context, + FadePage( + page: PrescriptionDeliveryAddressPage( + prescriptions: prescriptions, + prescriptionReportList: model.prescriptionReportList, + prescriptionReportEnhList: model.prescriptionReportEnhList, + ), + ), + ); + } + }, + color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846), + disabledColor: Color(0xff575757), + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).medicationInstructions, + () async { + GifLoaderDialogUtils.showMyDialog(context); + await _prescriptionsService + .getMedicationsInstructionsPDF(setupID: prescriptions.setupID!, projectID: prescriptions.projectID!, appointmentNo: prescriptions.appointmentNo.toString()) + .then((val) { + if (_prescriptionsService.hasError) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: _prescriptionsService.error ?? "Unable to get PDF."); + } else { + GifLoaderDialogUtils.hideDialog(context); + print(_prescriptionsService.prescriptionInstructionsPDFLink); + launchUrl(Uri.parse(_prescriptionsService.prescriptionInstructionsPDFLink)); + } + }); + }, + color: CustomColors.darkOrange, + fontSize: 14.0, + ), + ), + ], ), ), ], diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 10823d3e..72db3b20 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -3530,6 +3530,7 @@ class TranslationBase { String get normal => localizedValues["normal"][locale.languageCode]; String get low => localizedValues["low"][locale.languageCode]; String get verifyWithBiometric => localizedValues["verify-with-biometric"][locale.languageCode]; + String get medicationInstructions => localizedValues["medicationInstructions"][locale.languageCode]; String getTranslation(String label) { switch (label) { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index dde9c7a4..71d9a3c2 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -116,7 +116,11 @@ class Utils { static Future checkConnection({bool bypassConnectionCheck = false}) async { if (bypassConnectionCheck) return true; List connectivityResult = await (Connectivity().checkConnectivity()); - if (connectivityResult.contains(ConnectivityResult.mobile) || connectivityResult.contains(ConnectivityResult.wifi)) { + if (connectivityResult.contains(ConnectivityResult.mobile) || + connectivityResult.contains(ConnectivityResult.wifi) || + connectivityResult.contains(ConnectivityResult.ethernet) || + connectivityResult.contains(ConnectivityResult.bluetooth) || + connectivityResult.contains(ConnectivityResult.vpn)) { return true; } else { return false; @@ -145,7 +149,7 @@ class Utils { title: TranslationBase.of(context).covidConsentHeader, message: message, onTap: onTap!, - onConsentDeclined: onConsentDeclined!, + onConsentDeclined: onConsentDeclined ?? () {}, )); } diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index 11a5f1cc..dd8dc166 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -1,3 +1,4 @@ +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:hmg_patient_app/core/model/labs/patient_lab_orders.dart'; import 'package:hmg_patient_app/core/viewModels/medical/labs_view_model.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; @@ -22,7 +23,8 @@ class LaboratoryResultWidget extends StatefulWidget { final bool showConfirmMessageDialog; final LabsViewModel labmodel; - const LaboratoryResultWidget({Key? key, this.onTap, this.billNo, this.details, this.orderNo, this.projectName, this.patientLabOrder, this.showConfirmMessageDialog = true,required this.labmodel}) : super(key: key); + const LaboratoryResultWidget({Key? key, this.onTap, this.billNo, this.details, this.orderNo, this.projectName, this.patientLabOrder, this.showConfirmMessageDialog = true, required this.labmodel}) + : super(key: key); @override _LaboratoryResultWidgetState createState() => _LaboratoryResultWidgetState(); @@ -41,18 +43,16 @@ class _LaboratoryResultWidgetState extends State { this.model = widget.labmodel; } - @override void didChangeDependencies() { super.didChangeDependencies(); var oldStateTablateScreenState = isTabletScreen; - isTabletScreen = isTablet(context); - if(isTabletScreen != oldStateTablateScreenState); + isTabletScreen = isTablet(context); + if (isTabletScreen != oldStateTablateScreenState) ; { model?.recalculatePercentage(isTabletScreen); } - } bool isTablet(BuildContext context) { @@ -70,7 +70,8 @@ class _LaboratoryResultWidgetState extends State { onModelReady: (_) { print("the length of in on model Ready ${model?.patientLabSpecialResult.length}"); WidgetsBinding.instance.addPostFrameCallback((_) { - model?.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!, isTablet: isTabletScreen); + model?.getPatientLabResult( + isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!, isTablet: isTabletScreen); }); labSpecialResult = widget.details ?? "No Data Available"; }, @@ -190,8 +191,8 @@ class _LaboratoryResultWidgetState extends State { if (_isShowMore) Container( width: double.infinity, - child: Html( - data: labSpecialResult ?? TranslationBase.of(context).noDataAvailable, + child: HtmlWidget( + labSpecialResult ?? TranslationBase.of(context).noDataAvailable, ), ), ], diff --git a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart index 987f1ce7..82b8462a 100644 --- a/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart +++ b/lib/widgets/data_display/medical/LabResult/newUI/labWidgets.dart @@ -390,7 +390,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget { // child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), // ), Visibility( - visible: true, + visible: shouldShowResultBarAndGraph, child: GestureDetector( onTap: onButtonPressed, child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 1ebce592..b8fb51f9 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -38,9 +38,9 @@ class MyInAppBrowser extends InAppBrowser { static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/pubspec.yaml b/pubspec.yaml index d2ec347c..cf0045dc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,8 @@ name: hmg_patient_app description: A new Flutter application. -version: 4.6.017+1 -#version: 4.6.0972+40500972 +version: 4.6.017+4 +#version: 4.6.0976+40500976 environment: # sdk: ">=3.0.0 <3.13.0" @@ -41,7 +41,7 @@ dependencies: url_launcher: ^6.3.1 url_launcher_ios: ^6.3.2 shared_preferences: ^2.5.3 -# fluttertoast: ^8.0.8 + # fluttertoast: ^8.0.8 fluttertoast: ^8.2.12 flutter_progress_hud: ^2.0.2 @@ -142,8 +142,8 @@ dependencies: google_fonts: ^6.2.1 google_maps_place_picker_mb_v2: ^1.0.1 -# vital_sign_camera: -# path: ./packages/vital_sign_camera + # vital_sign_camera: + # path: ./packages/vital_sign_camera readmore: ^3.0.0 dependency_overrides: