diff --git a/lib/config/config.dart b/lib/config/config.dart index 3ac3e1d6..082c6bde 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -350,6 +350,9 @@ var INSERT_LIVECARE_SCHEDULE_APPOINTMENT = var GET_PATIENT_SHARE_LIVECARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; +var SET_ONLINE_CHECKIN_FOR_APPOINTMENT = + "Services/Patients.svc/REST/SetOnlineCheckInForAppointment"; + var GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b8fa04ab..3f0b60a3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1812,5 +1812,6 @@ const Map localizedValues = { "bluetoothPermission": { "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." }, "privacyPolicy": {"en": "Privacy Policy", "ar": "سياسة الخصوصية"}, "termsConditions": {"en": "Terms & Conditions", "ar": "الأحكام والشروط"}, - "liveCarePermissions": {"en": "LiveCare required Camera & Microphone permissions, Please allow these to proceed.", "ar": "يتطلب لايف كير أذونات الكاميرا والميكروفون ، يرجى السماح لها بالمتابعة."}, + "prescriptionDeliveryError": {"en": "This clinic does not support refill & delivery.", "ar": "هذه العيادة لا تدعم إعادة التعبئة والتسليم."}, + "liveCarePermissions": {"en": "LiveCare required Camera & Microphone permissions, Please allow these to proceed.", "ar": "هذه العيادة لا تدعم خدمة إعادة التعبئة والتسليم."}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 5c7214d6..50370b52 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -132,7 +132,7 @@ class BaseAppClient { // body['IdentificationNo'] = 2076117163; // body['MobileNo'] = "966503109207"; - // body['PatientID'] = 3569409; //3844083 + // body['PatientID'] = 50121262; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 86c72ae3..a11915da 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/theme/colors.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/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -52,12 +51,18 @@ class _IdealBodyState extends State { List _heightPopupList = List(); List _weightPopupList = List(); - - void calculateIdealWeight() { - heightInches = int.parse(_heightController.text) * .39370078740157477; - heightFeet = heightInches / 12; - idealWeight = (50 + 2.3 * (heightInches - 60)); + var height = int.parse(_heightController.text); + var weight = double.parse(_weightController.text); + var inchesVal = ((height) * .39370078740157477); + var meters = height / 100; + var feetVal = (inchesVal / 12).floor().round(); + inchesVal = (inchesVal % 12).roundToDouble(); + var kgValue = (weight * 2.2).floor(); + var heightFeet = feetVal; + var heightInches = inchesVal; + weight = kgValue.floorToDouble(); + var idealWeight = (((((heightFeet * 12) + heightInches) - 60) * 6) + 106); if (dropdownValue == TranslationBase.of(context).smallFinger) { idealWeight = idealWeight - 10; } else if (dropdownValue == TranslationBase.of(context).mediumFinger) { @@ -65,18 +70,22 @@ class _IdealBodyState extends State { } else if (dropdownValue == TranslationBase.of(context).largeFinger) { idealWeight = idealWeight + 10; } - - maxIdealWeight = (((idealWeight) * 1.1).round() * 100) / 100; - overWeightBy = weight - maxIdealWeight.roundToDouble(); - minRange = ((idealWeight / 1.1) * 10).round() / 10; - maxRange = maxIdealWeight; - idealWeight = idealWeight; + var maxIdealWeight = (((idealWeight).floorToDouble() * 1.1) * 100).round() / 100; + var overWeightBy = ((weight - double.parse(maxIdealWeight.toString())) * 100).round() / 100; + var difference = (((overWeightBy / 2.2) * 100) / 100).round(); //+ Loc.healthCalPage.IBWKg; Loc.healthCalPage.IBWRange + var minRange = ((idealWeight / 2.2) * 10).round() / 10; + var maxRange = ((maxIdealWeight / 2.2) * 100).round() / 100; //+ //Loc.healthCalPage.IBWKg; + idealWeight = weight / idealWeight; + idealWeight = (idealWeight * 100).round() / 100; + this.overWeightBy = overWeightBy; + this.minRange = minRange; + this.maxRange = maxIdealWeight; + this.idealWeight = idealWeight; } @override Widget build(BuildContext context) { - if(dropdownValue==null) - dropdownValue=TranslationBase.of(context).mediumFinger; + if (dropdownValue == null) dropdownValue = TranslationBase.of(context).mediumFinger; _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; @@ -200,7 +209,8 @@ class _IdealBodyState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( value: dropdownValue, - icon: Icon(Icons.arrow_downward), key: clinicDropdownKey, + icon: Icon(Icons.arrow_downward), + key: clinicDropdownKey, iconSize: 0, elevation: 16, isExpanded: true, @@ -500,5 +510,3 @@ class CommonDropDownView extends StatelessWidget { ); } } - - diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index a29d4bf0..0477fda4 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -33,7 +32,6 @@ class IdealBodyResult extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( padding: const EdgeInsets.all(20.0), child: Column( @@ -60,7 +58,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - " "+TranslationBase.of(context).kg+" ", + " " + TranslationBase.of(context).kg + " ", style: TextStyle(color: Colors.red), ), ), @@ -74,13 +72,13 @@ class IdealBodyResult extends StatelessWidget { Row( children: [ Texts( - mixRange.toStringAsFixed(1), + (mixRange / 2.2).toStringAsFixed(1), fontSize: 30.0, ), Padding( padding: EdgeInsets.only(top: 8.0, left: 4.0), child: Text( - " "+TranslationBase.of(context).kg+" ", + " " + TranslationBase.of(context).kg + " ", style: TextStyle(color: Colors.red), ), ), @@ -93,7 +91,7 @@ class IdealBodyResult extends StatelessWidget { ? Column( children: [ Texts( - TranslationBase.of(context).currentWeightPerfect, + TranslationBase.of(context).currentWeightPerfect, fontSize: 20.0, ), ], @@ -108,7 +106,6 @@ class IdealBodyResult extends StatelessWidget { ) : overWeightBy >= 18 ? Container( - child: Column( children: [ Texts( @@ -117,13 +114,21 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 12.0, ), - Text( - overWeightBy.toStringAsFixed(1), - style: TextStyle( - fontSize: 17, - fontWeight: FontWeight.bold, - letterSpacing: -1.34, - ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Texts( + (overWeightBy / 2.2).toStringAsFixed(1), + fontSize: 30.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, left: 4.0), + child: Text( + " " + TranslationBase.of(context).kg + " ", + style: TextStyle(color: Colors.red), + ), + ), + ], ), SizedBox( height: 12.0, @@ -139,7 +144,7 @@ class IdealBodyResult extends StatelessWidget { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).underWeight, + TranslationBase.of(context).underWeight, fontSize: 18.0, ), ), @@ -157,7 +162,6 @@ class IdealBodyResult extends StatelessWidget { ], ) : Container( - child: Column( children: [ Text( diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index e7db06e4..693f98e9 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -47,6 +47,17 @@ class _BookSuccessState extends State { ProjectViewModel projectViewModel; + @override + initState() { + WidgetsBinding.instance.addPostFrameCallback((_) async { + if (widget.patientShareResponse.isLiveCareAppointment && + (widget.patientShareResponse.patientShareWithTax.toString() == "0" || widget.patientShareResponse.patientShareWithTax.toString() == "0.0")) { + setOnlineCheckInForAppointment(); + } + }); + super.initState(); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -403,6 +414,24 @@ class _BookSuccessState extends State { return Container(); } + setOnlineCheckInForAppointment() { + DoctorsListService service = new DoctorsListService(); + service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID, context).then((res) { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + appo.clinicID = widget.docObject.clinicID; + appo.projectID = widget.docObject.projectID; + appo.appointmentNo = widget.patientShareResponse.appointmentNo; + appo.serviceID = widget.patientShareResponse.serviceID; + appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; + appo.doctorID = widget.patientShareResponse.doctorID; + insertLiveCareVIDARequest(appo, isMoveHome: false); + }).catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); @@ -425,14 +454,13 @@ class _BookSuccessState extends State { }); } - insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo, {bool isMoveHome = true}) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - navigateToHome(context); + if (isMoveHome) navigateToHome(context); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 3e6c0450..89ce6699 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -22,7 +22,7 @@ Future> requestPermissions() async { showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { if (Platform.isAndroid) { - if (await PermissionService.isCameraEnabled()) { + if (await PermissionService.isCalendarPermissionEnabled()) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } else { diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 901e6c6c..d4a1d367 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,3 +1,6 @@ +import 'dart:collection'; + +import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -11,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -94,23 +98,30 @@ class _AppointmentDetailsState extends State with SingleTick children: [ DoctorHeader( headerModel: HeaderModel( - widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, - widget.appo.doctorID, - widget.appo.doctorImageURL, - widget.appo.doctorSpeciality, - "", - widget.appo.projectName, - DateUtil.convertStringToDate(widget.appo.appointmentDate), - widget.appo.startTime.substring(0, 5), - null, - widget.appo.doctorRate, - widget.appo.actualDoctorRate, - widget.appo.noOfPatientsRate, - "", - decimalDoctorRate: widget.appo.decimalDoctorRate.toString() - //model.user.emailAddress, - ), - isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, + widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, + widget.appo.doctorID, + widget.appo.doctorImageURL, + widget.appo.doctorSpeciality, + "", + widget.appo.projectName, + DateUtil.convertStringToDate(widget.appo.appointmentDate), + widget.appo.startTime.substring(0, 5), + null, + widget.appo.doctorRate, + widget.appo.actualDoctorRate, + widget.appo.noOfPatientsRate, + "", + decimalDoctorRate: widget.appo.decimalDoctorRate.toString() + //model.user.emailAddress, + ), + isNeedToShowButton: (widget.appo.clinicID == 17 || + widget.appo.clinicID == 47 || + widget.appo.clinicID == 23 || + widget.appo.clinicID == 265 || + widget.appo.isExecludeDoctor || + widget.appo.isLiveCareAppointment) + ? false + : true, buttonTitle: TranslationBase.of(context).schedule, buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, @@ -139,7 +150,12 @@ class _AppointmentDetailsState extends State with SingleTick onTap: (index) { setState(() { if (index == 1) { - if (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { + if (widget.appo.clinicID == 17 || + widget.appo.clinicID == 47 || + widget.appo.clinicID == 23 || + widget.appo.clinicID == 265 || + widget.appo.isExecludeDoctor || + widget.appo.isLiveCareAppointment) { _tabController.index = _tabController.previousIndex; AppointmentDetails.showFooterButton = false; } else { @@ -150,7 +166,12 @@ class _AppointmentDetailsState extends State with SingleTick }, tabs: [ Tab(child: Text(TranslationBase.of(context).appoActions, style: TextStyle(color: Colors.black))), - widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 47 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment + widget.appo.clinicID == 17 || + widget.appo.clinicID == 23 || + widget.appo.clinicID == 47 || + widget.appo.clinicID == 265 || + widget.appo.isExecludeDoctor || + widget.appo.isLiveCareAppointment ? Tab( child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)), ) @@ -563,15 +584,31 @@ class _AppointmentDetailsState extends State with SingleTick }); } + checkIfHasReminder() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate); + DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate); + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.appo.doctorNameObj)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + }); + }); + } + cancelAppointment() { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(widget.appo, context).then((res) { - projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { + checkIfHasReminder(); getToDoCount(); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); Navigator.of(context).pop(); diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 56b16c10..92659c1b 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -113,7 +113,7 @@ class _HomePageFragment2State extends State { // utf8.encode("asD123@saereaccess_code=BsM6He4FMBaZ86W64kjZdevice_id=" + deviceID + "language=enmerchant_identifier=ipxnRXXqservice_command=SDK_TOKENasD123@saere")) // .toString(); // print("signature: $output"); - // PayfortPlugin.performPaymentRequest('ipxnRXXq', '099529edbf88418e92a0cb915eba0f3b', 'ahmed', 'en', 'haroon6138@mail.com', '10000', 'PURCHASE', 'SAR', '0' // 0 for test mode and 1 for production + // PayfortPlugin.performPaymentRequest('ipxnRXXq', '92f1dffb1abd43c8b60fe55bfeb10c73', 'haroon', 'en', 'haroon6138@mail.com', '100000', 'PURCHASE', 'SAR', '0' // 0 for test mode and 1 for production // ) // .then((value) => { // // value object contains payfort response, such card number, transaction reference, ... diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index 1ab20ffb..4ae09885 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -287,10 +287,16 @@ class _LiveCarePatmentPageState extends State { if (_selected == 0) { AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); } else { - askVideoCallPermission().then((value) { + askVideoCallPermission().then((value) async { if (value) { - projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); - Navigator.pop(context, true); + if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { + await drawOverAppsMessageDialog(context).then((value) { + return false; + }); + } else { + projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); + Navigator.pop(context, true); + } } else { openPermissionsDialog(); } @@ -313,11 +319,6 @@ class _LiveCarePatmentPageState extends State { if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { return false; } - if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { - await drawOverAppsMessageDialog(context).then((value) { - return false; - }); - } return true; } diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index fb5f1e0f..4c350123 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -122,7 +122,7 @@ class _LiveCareTypeSelectState extends State { } }, child: Container( - padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + padding: EdgeInsets.only(left: 20, right: 20, bottom: 3, top: 28), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: Colors.white, diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 3a611a20..6e817f8c 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -384,21 +385,23 @@ class PrescriptionItemsPage extends StatelessWidget { padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( TranslationBase.of(context).resendOrder, - model.isMedDeliveryAllowed == false - ? null - : () => { - Navigator.push( - context, - FadePage( - page: PrescriptionDeliveryAddressPage( - prescriptions: prescriptions, - prescriptionReportList: model.prescriptionReportList, - prescriptionReportEnhList: model.prescriptionReportEnhList, - ), - ), - ) - }, - color: Color(0xff359846), + () { + 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), ), ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 90c2be46..7003f376 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -473,6 +473,28 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future setOnlineCheckInForAppointment(String appoID, int projectID, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { + "ProjectID": projectID, + "AppointmentNo": appoID + }; + + dynamic localRes; + + await baseAppClient.post(SET_ONLINE_CHECKIN_FOR_APPOINTMENT, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { Map request; diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index a6f43184..b448bff4 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -181,21 +181,12 @@ class PushNotificationHandler { print('🎈 example: onDidRejectIncomingCall $uuid, $callerId'); voIPKit.endCall(); timeOutTimer?.cancel(); - - // setState(() { - // isTalking = false; - // }); }; voIPKit.onDidAcceptIncomingCall = ( String uuid, String callerId, ) { - // print('🎈 example: isTalking $isTalking'); - // if (isTalking) { - // return; - // } - print('🎈 example: onDidAcceptIncomingCall $uuid, $callerId'); String sessionID = callerId.split("*")[0]; @@ -258,14 +249,12 @@ class PushNotificationHandler { FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async { print("Firebase getInitialMessage!!!"); - // Utils.showPermissionConsentDialog(context, "getInitialMessage", (){}); + subscribeFCMTopic(); if (Platform.isIOS) await Future.delayed(Duration(milliseconds: 3000)).then((value) { if (message != null) newMessage(message); }); - else - // if(message != null) - newMessage(message); + else if (message != null) newMessage(message); }); FirebaseMessaging.onMessage.listen((RemoteMessage message) async { @@ -300,6 +289,13 @@ class PushNotificationHandler { } } + subscribeFCMTopic() async { + print("subscribeFCMTopic!!!"); + await FirebaseMessaging.instance.unsubscribeFromTopic('all_hmg_patients').then((value) async { + await FirebaseMessaging.instance.subscribeToTopic('all_hmg_patients'); + }); + } + newMessage(RemoteMessage remoteMessage) async { print("Remote Message: " + remoteMessage.data.toString()); if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 1a537ab2..7aa4bf66 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2848,6 +2848,7 @@ class TranslationBase { String get privacyPolicy => localizedValues["privacyPolicy"][locale.languageCode]; String get termsConditions => localizedValues["termsConditions"][locale.languageCode]; String get liveCarePermissions => localizedValues["liveCarePermissions"][locale.languageCode]; + String get prescriptionDeliveryError => localizedValues["prescriptionDeliveryError"][locale.languageCode]; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e20bd015..b258a7ff 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -148,6 +148,7 @@ class MyInAppBrowser extends InAppBrowser { this.browser = browser; await getPatientData(); if (paymentMethod == "ApplePay") { + getDeviceToken(); MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); if (context != null) GifLoaderDialogUtils.showMyDialog(context); @@ -161,7 +162,7 @@ class MyInAppBrowser extends InAppBrowser { applePayInsertRequest.customerEmail = emailId; applePayInsertRequest.customerID = authenticatedUser.patientID; applePayInsertRequest.customerName = authenticatedUser.firstName; - applePayInsertRequest.deviceToken = deviceToken; + applePayInsertRequest.deviceToken = await sharedPref.getString(PUSH_TOKEN); applePayInsertRequest.doctorID = (doctorID != null && doctorID != "") ? doctorID : 0; applePayInsertRequest.projectID = projId; applePayInsertRequest.serviceID = servID; diff --git a/pubspec.yaml b/pubspec.yaml index 3de4d3db..0165c607 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.4.92+404092 +version: 4.4.94+404094 environment: sdk: ">=2.7.0 <3.0.0" @@ -202,6 +202,8 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 + payfort_plugin: ^0.3.1 + dependency_overrides: provider : ^5.0.0 permission_handler : ^6.0.1+1