From 5c8bb241b3105f3c044673c919a63ee748559f40 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Nov 2023 12:10:05 +0300 Subject: [PATCH 01/11] Next Actions handled when navigating from My Appointments to ToDo list --- .../widgets/AppointmentActions.dart | 36 ++++++++++++++----- lib/pages/ToDoList/ToDo.dart | 6 +++- .../appointment_services/GetDoctorsList.dart | 15 ++++++-- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 9a71e55c..bdab5211 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -588,14 +588,7 @@ class _AppointmentActionsState extends State { navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { if (widget.projectViewModel.isLogin) { if (model.count != 0) { - Navigator.push( - context, - FadePage( - page: ToDo( - isShowAppBar: true, - isFromMyAppointments: true, - appointment: widget.appo, - ))); + getPatientAppointmentHistoryWithAppo(); } else { AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); } @@ -611,6 +604,33 @@ class _AppointmentActionsState extends State { } } + getPatientAppointmentHistoryWithAppo() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.getPatientAppointmentHistoryWithAppoNo(widget.appo.appointmentNo).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList.fromJson(res['AppoimentAllHistoryResultList'][0]); + Navigator.push( + context, + FadePage( + page: ToDo( + isShowAppBar: true, + isFromMyAppointments: true, + appointment: appo, + ), + ), + ); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + err != null ?? AppToast.showErrorToast(message: err); + }); + } + rateAppointment() { widget.browser = new MyInAppBrowser(); var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 95be336f..76ed8e60 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -548,6 +548,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { case 10: confirmAppointment(appo); break; + case 15: + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingPaymentPending); + break; case 20: getPatientShare(context, appo); // checkPatientNphiesEligibility(context, appo); @@ -836,7 +839,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } dataLoaded = true; if (widget.isFromMyAppointments) { - getPatientShare(context, widget.appointment); + performNextAction(widget.appointment); + widget.isFromMyAppointments = false; } }); } else { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 0a293818..8923f76e 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -614,6 +614,19 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPatientAppointmentHistoryWithAppoNo(int appoNo) async { + Map request; + request = {"IsActiveAppointment": true, "AppointmentNo": appoNo, "IsComingFromCOC": false}; + dynamic localRes; + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + + return Future.value(localRes); + } + Future getPatientAppointmentHistory(bool isActiveAppointment, BuildContext context, {bool isForCOC = false}) async { Map request; @@ -1843,6 +1856,4 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - - } From 6dd5fda997d6cbb1e56246b9a0cca5402b719143 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Nov 2023 12:26:05 +0300 Subject: [PATCH 02/11] Location check in implementing --- lib/config/localized_values.dart | 1 + lib/pages/BookAppointment/QRCode.dart | 29 ++++++++++++++++++++++++ lib/uitl/translations_delegate_base.dart | 1 + 3 files changed, 31 insertions(+) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 63619f59..cc91b2af 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1901,4 +1901,5 @@ const Map localizedValues = { "habibCallCenter": {"en": "Please contact AlHabib call center to update your insurance manually.", "ar": "يرجى الاتصال بمركز اتصال الحبيب لتحديث التأمين الخاص بك يدوياً."}, "cashAmountUpdateInsurance": {"en": "Please note that this is the cash amount, If you want to update your insurance, Please tap below:", "ar": "يرجى ملاحظة أن هذا هو المبلغ النقدي، إذا كنت ترغب في تحديث التأمين الخاص بك، يرجى النقر أدناه:"}, "validInsurance": {"en": "Do you have a valid insurance?", "ar": "هل لديك تأمين صالح؟"}, + "checkInViaLocation": {"en": "Check-In Via Location", "ar": "تسجيل الوصول عبر الموقع"}, }; \ No newline at end of file diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index e9d88d7b..99f5ce3a 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; @@ -49,6 +50,7 @@ class _QRCodeState extends State { BuildContext _context; ProjectViewModel projectViewModel; + LocationUtils locationUtils; @override void initState() { @@ -90,6 +92,15 @@ class _QRCodeState extends State { } else {} } + startLocationCheckIn() async { + String onlineCheckInQRCode = ""; + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + locationUtils.getCurrentLocation(callBack: (value) { + print(value); + // sendNfcCheckInRequest(onlineCheckInQRCode); + }); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -228,6 +239,24 @@ class _QRCodeState extends State { ), ); + optionsList.add( + InkWell( + onTap: () { + if (projectViewModel.havePrivilege(79)) { + startLocationCheckIn(); + } + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).checkInViaLocation, + imagePath: 'qr_code.svg', + subTitle: "", + isEnable: projectViewModel.havePrivilege(79), + width: 80.0, + height: 80.0, + ), + ), + ); + return optionsList; } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 7af2010a..ae885739 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2910,6 +2910,7 @@ class TranslationBase { String get habibCallCenter => localizedValues["habibCallCenter"][locale.languageCode]; String get cashAmountUpdateInsurance => localizedValues["cashAmountUpdateInsurance"][locale.languageCode]; String get validInsurance => localizedValues["validInsurance"][locale.languageCode]; + String get checkInViaLocation => localizedValues["checkInViaLocation"][locale.languageCode]; } From 245716119e9b63c0973089e6f6b0bd662f31f0a7 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Nov 2023 16:15:10 +0300 Subject: [PATCH 03/11] Location based Check In implemented --- lib/config/localized_values.dart | 1 + .../privilege/ProjectDetailListModel.dart | 32 +++++++++++++++++++ lib/core/service/privilege_service.dart | 8 +++++ lib/core/viewModels/project_view_model.dart | 9 ++++++ lib/pages/BookAppointment/QRCode.dart | 16 +++++++--- lib/splashPage.dart | 1 + lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 30 +++++++++++++++++ lib/widgets/in_app_browser/InAppBrowser.dart | 4 +-- 9 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 lib/core/model/privilege/ProjectDetailListModel.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cc91b2af..3f3074d3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1902,4 +1902,5 @@ const Map localizedValues = { "cashAmountUpdateInsurance": {"en": "Please note that this is the cash amount, If you want to update your insurance, Please tap below:", "ar": "يرجى ملاحظة أن هذا هو المبلغ النقدي، إذا كنت ترغب في تحديث التأمين الخاص بك، يرجى النقر أدناه:"}, "validInsurance": {"en": "Do you have a valid insurance?", "ar": "هل لديك تأمين صالح؟"}, "checkInViaLocation": {"en": "Check-In Via Location", "ar": "تسجيل الوصول عبر الموقع"}, + "locationCheckInError": {"en": "Please make sure that you're within the hospital location to perform online check-in.", "ar": "يرجى التأكد من تواجدك داخل موقع المستشفى لإجراء تسجيل الوصول عبر الإنترنت."}, }; \ No newline at end of file diff --git a/lib/core/model/privilege/ProjectDetailListModel.dart b/lib/core/model/privilege/ProjectDetailListModel.dart new file mode 100644 index 00000000..b8241797 --- /dev/null +++ b/lib/core/model/privilege/ProjectDetailListModel.dart @@ -0,0 +1,32 @@ +class ProjectDetailListModel { + int projectID; + String latitude; + String longitude; + int geofenceRadius; + String checkInQrCode; + + ProjectDetailListModel( + {this.projectID, + this.latitude, + this.longitude, + this.geofenceRadius, + this.checkInQrCode}); + + ProjectDetailListModel.fromJson(Map json) { + projectID = json['ProjectID']; + latitude = json['Latitude']; + longitude = json['Longitude']; + geofenceRadius = json['GeofenceRadius']; + checkInQrCode = json['CheckInQrCode']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['GeofenceRadius'] = this.geofenceRadius; + data['CheckInQrCode'] = this.checkInQrCode; + return data; + } +} diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart index 137bfca6..ab0cee97 100644 --- a/lib/core/service/privilege_service.dart +++ b/lib/core/service/privilege_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/privilege/HMCProjectListModel.dart'; import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart'; import 'package:diplomaticquarterapp/core/model/privilege/VidaPlusProjectListModel.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -8,6 +9,7 @@ class PrivilegeService extends BaseService { List privilegeModelList = []; List vidaPlusProjectListModel = []; List hMCProjectListModel = []; + List projectDetailListModel = []; Future getPrivilege() async { Map body = Map(); @@ -28,6 +30,12 @@ class PrivilegeService extends BaseService { hMCProjectListModel.add(HMCProjectListModel.fromJson(item)); }); } + + if (response['ProjectDetailList'].length != 0) { + response['ProjectDetailList'].forEach((item) { + projectDetailListModel.add(ProjectDetailListModel.fromJson(item)); + }); + } }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 3a47c753..aff0faff 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/privilege/HMCProjectListModel.dart'; import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart'; import 'package:diplomaticquarterapp/core/model/privilege/VidaPlusProjectListModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -62,6 +63,7 @@ class ProjectViewModel extends BaseViewModel { List privilegeChildUser = List(); List _vidaPlusProjectListModel = List(); List _hMCProjectListModel = []; + List _projectDetailListModel = []; List get privileges => isLoginChild ? privilegeChildUser : privilegeChildUser; @@ -69,6 +71,8 @@ class ProjectViewModel extends BaseViewModel { List get hMCProjectListModel => _hMCProjectListModel; + List get projectDetailListModel => _projectDetailListModel; + List selectedBodyPartList = []; StreamSubscription subscription; @@ -134,6 +138,11 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setProjectsDetailList(List projectDetailListModel) { + _projectDetailListModel = projectDetailListModel; + notifyListeners(); + } + setHMCProjectList(List hMCProjectListModel) { _hMCProjectListModel = hMCProjectListModel; notifyListeners(); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 99f5ce3a..a4355187 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -3,6 +3,7 @@ import 'dart:typed_data'; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -19,6 +20,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; @@ -51,6 +53,7 @@ class _QRCodeState extends State { ProjectViewModel projectViewModel; LocationUtils locationUtils; + ProjectDetailListModel projectDetailListModel; @override void initState() { @@ -93,11 +96,16 @@ class _QRCodeState extends State { } startLocationCheckIn() async { - String onlineCheckInQRCode = ""; locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(callBack: (value) { - print(value); - // sendNfcCheckInRequest(onlineCheckInQRCode); + projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment.projectID); + double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude), double.parse(projectDetailListModel.longitude)).ceilToDouble() * 1000; + print(dist); + if (dist <= projectDetailListModel.geofenceRadius) { + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); + } }); } @@ -248,7 +256,7 @@ class _QRCodeState extends State { }, child: MedicalProfileItem( title: TranslationBase.of(context).checkInViaLocation, - imagePath: 'qr_code.svg', + imagePath: 'location.svg', subTitle: "", isEnable: projectViewModel.havePrivilege(79), width: 80.0, diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 8ffef7a4..7d6aa06f 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -56,6 +56,7 @@ class _SplashScreenState extends State { projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); projectProvider.setVidaPlusProjectList(_privilegeService.vidaPlusProjectListModel); projectProvider.setHMCProjectList(_privilegeService.hMCProjectListModel); + projectProvider.setProjectsDetailList(_privilegeService.projectDetailListModel); AppSharedPreferences().clear(); // Clearing Shared Preferences On App Launch AppSharedPreferences().setString(APP_LANGUAGE, projectProvider.isArabic ? "ar" : "en"); var themeNotifier = Provider.of(context, listen: false); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index ae885739..e1f1ac74 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2911,6 +2911,7 @@ class TranslationBase { String get cashAmountUpdateInsurance => localizedValues["cashAmountUpdateInsurance"][locale.languageCode]; String get validInsurance => localizedValues["validInsurance"][locale.languageCode]; String get checkInViaLocation => localizedValues["checkInViaLocation"][locale.languageCode]; + String get locationCheckInError => localizedValues["locationCheckInError"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index a39029b8..77522108 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -10,6 +10,7 @@ import 'package:connectivity/connectivity.dart'; import 'package:crypto/crypto.dart' as crypto; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/privilege/ProjectDetailListModel.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; @@ -45,6 +46,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_api_availability/google_api_availability.dart'; +import 'dart:math' show asin, cos, pi, pow, sin, sqrt; // import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:provider/provider.dart'; @@ -784,6 +786,24 @@ class Utils { return false; } + static double distance(double lat1, double lon1, double lat2, double lon2) { + const r = 6372.8; // Earth radius in kilometers + + final dLat = _toRadians(lat2 - lat1); + final dLon = _toRadians(lon2 - lon1); + final lat1Radians = _toRadians(lat1); + final lat2Radians = _toRadians(lat2); + + final a = _haversin(dLat) + cos(lat1Radians) * cos(lat2Radians) * _haversin(dLon); + final c = 2 * asin(sqrt(a)); + + return r * c; + } + + static double _toRadians(double degrees) => degrees * pi / 180; + + static double _haversin(double radians) => pow(sin(radians / 2), 2); + static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -832,6 +852,16 @@ class Utils { return isHMCProject; } + static ProjectDetailListModel getProjectDetailObj(ProjectViewModel projectViewModel, int projectID) { + ProjectDetailListModel projectDetailListModel; + projectViewModel.projectDetailListModel.forEach((element) { + if (element.projectID == projectID) { + projectDetailListModel = element; + } + }); + return projectDetailListModel; + } + static String generateSignature() {} } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f38ad57c..28a364e5 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -35,9 +35,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 From f8fb33674054b1f2031544ac43981efadc7192df Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 16 Nov 2023 11:33:24 +0300 Subject: [PATCH 04/11] Location checkin privilege applied --- lib/config/config.dart | 6 +++--- lib/pages/BookAppointment/BookSuccess.dart | 1 + lib/pages/BookAppointment/QRCode.dart | 8 ++++---- lib/pages/ToDoList/ToDo.dart | 3 +++ lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5ab2c668..177390af 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,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 = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/'; @@ -337,7 +337,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 11.1; +var VERSION_ID = 11.2; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 3642bed4..0a3d90ef 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -174,6 +174,7 @@ class _BookSuccessState extends State { elevation: 0, onPressed: () { // navigateToQR(context); + GifLoaderDialogUtils.showMyDialog(context); getAppoQR(context); }, child: Text(TranslationBase.of(context).viewQR.toUpperCase(), style: TextStyle(fontSize: 18.0, color: Colors.white)), diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index a4355187..a6d55dce 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -250,7 +250,7 @@ class _QRCodeState extends State { optionsList.add( InkWell( onTap: () { - if (projectViewModel.havePrivilege(79)) { + if (projectViewModel.havePrivilege(102)) { startLocationCheckIn(); } }, @@ -258,9 +258,9 @@ class _QRCodeState extends State { title: TranslationBase.of(context).checkInViaLocation, imagePath: 'location.svg', subTitle: "", - isEnable: projectViewModel.havePrivilege(79), - width: 80.0, - height: 80.0, + isEnable: projectViewModel.havePrivilege(102), + width: 70.0, + height: 70.0, ), ), ); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 76ed8e60..c4e4bcb9 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -545,6 +545,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { performNextAction(AppoitmentAllHistoryResultList appo) { switch (appo.nextAction) { + case 0: + // getAppoQR(context, appo); + break; case 10: confirmAppointment(appo); break; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 28a364e5..f38ad57c 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -35,9 +35,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 From 1ecb8ebfe9675620e29f9dd90da453b1f107a28e Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 21 Nov 2023 17:07:47 +0300 Subject: [PATCH 05/11] updated to stores version 11.3 --- lib/config/config.dart | 4 +- .../service/ancillary_orders_service.dart | 8 +- lib/core/service/client/base_app_client.dart | 8 +- .../ancillary_orders_view_model.dart | 9 +- .../ancillaryOrdersDetails.dart | 211 +++++++++--------- .../MyAppointments/models/BookedButtons.dart | 3 +- .../widgets/AppointmentActions.dart | 8 +- .../fragments/home_page_fragment2.dart | 3 +- lib/pages/landing/home_page_2.dart | 7 +- lib/pages/landing/widgets/services_view.dart | 5 +- .../appointment_services/GetDoctorsList.dart | 14 +- .../clinic_services/get_clinic_service.dart | 61 +---- lib/splashPage.dart | 9 +- pubspec.yaml | 2 +- 14 files changed, 169 insertions(+), 183 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 177390af..0eeacbad 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -38,6 +38,8 @@ var BASE_URL = 'https://hmgwebservices.com/'; var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +var PHARMACY_REDIRECT_URL = 'https://bit.ly/AlhabibPharmacy'; + // Pharmacy VidaPlus URLs // var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/'; // var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/'; @@ -337,7 +339,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 11.2; +var VERSION_ID = 11.3; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/core/service/ancillary_orders_service.dart b/lib/core/service/ancillary_orders_service.dart index 631f17ff..dcb34aad 100644 --- a/lib/core/service/ancillary_orders_service.dart +++ b/lib/core/service/ancillary_orders_service.dart @@ -54,15 +54,18 @@ class AncillaryOrdersService extends BaseService { return Future.value(localRes); } - Future getOrdersDetails(appointmentNo, orderNo, projectID) async { + Future getOrdersDetails(appointmentNo, orderNo, projectID) async { Map body = Map(); body['AppointmentNo_Vida'] = appointmentNo; body['OrderNo'] = orderNo; body['ProjectID'] = projectID; hasError = false; + + dynamic localRes; + await baseAppClient.post(GET_ANCILLARY_ORDERS_DETAILS, onSuccess: (dynamic response, int statusCode) { + localRes = response; _ancillaryProcLists = []; - response['AncillaryOrderProcList'].forEach((item) { ancillaryProcLists.add(AncillaryOrdersListProcListModel.fromJson(item)); }); @@ -70,5 +73,6 @@ class AncillaryOrdersService extends BaseService { hasError = true; super.error = error; }, body: body); + return Future.value(localRes); } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index e2fbe537..8c9118c8 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -90,7 +90,7 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isIOS ? 1 : 2; + body['DeviceTypeID'] = Platform.isIOS ? 1 : await Utils.isGoogleServicesAvailable() ? 2 : 3; if (!body.containsKey('IsPublicRequest')) { // if (!body.containsKey('PatientType')) { @@ -150,7 +150,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 2621536; //3844083 + // body['PatientID'] = 1048710; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 @@ -159,11 +159,11 @@ class BaseAppClient { body.removeWhere((key, value) => key == null || value == null); - // if (AppGlobal.isNetworkDebugEnabled) { + if (AppGlobal.isNetworkDebugEnabled) { print("URL : $url"); final jsonBody = json.encode(body); print(jsonBody); - // } + } if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); diff --git a/lib/core/viewModels/ancillary_orders_view_model.dart b/lib/core/viewModels/ancillary_orders_view_model.dart index 0d846313..4cc4628f 100644 --- a/lib/core/viewModels/ancillary_orders_view_model.dart +++ b/lib/core/viewModels/ancillary_orders_view_model.dart @@ -10,11 +10,10 @@ class AnciallryOrdersViewModel extends BaseViewModel { bool hasError = false; AncillaryOrdersService _ancillaryService = locator(); - List get ancillaryLists => - _ancillaryService.ancillaryLists; - List get ancillaryListsDetails => - _ancillaryService.ancillaryProcLists; + List get ancillaryLists => _ancillaryService.ancillaryLists; + + List get ancillaryListsDetails => _ancillaryService.ancillaryProcLists; Future getOrders() async { hasError = false; @@ -30,7 +29,7 @@ class AnciallryOrdersViewModel extends BaseViewModel { Future getOrdersDetails(appointmentNo, orderNo, projectID) async { hasError = false; setState(ViewState.Busy); - await _ancillaryService.getOrdersDetails(appointmentNo, orderNo, projectID ); + await _ancillaryService.getOrdersDetails(appointmentNo, orderNo, projectID); if (_ancillaryService.hasError) { error = _ancillaryService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 547d8467..8e224320 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -2,6 +2,7 @@ import 'dart:io'; import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/ancillary_orders_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -24,6 +25,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class AnicllaryOrdersDetails extends StatefulWidget { final dynamic appoNo; @@ -47,10 +49,15 @@ class _AnicllaryOrdersState extends State with SingleTic List selectedProcList = []; + List _ancillaryProcLists = []; + String tamaraPaymentStatus; String tamaraOrderID; void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) { + getAncillaryOrderDetails(); + }); super.initState(); } @@ -58,12 +65,21 @@ class _AnicllaryOrdersState extends State with SingleTic super.dispose(); } - void getAncillaryOrderDetails(AnciallryOrdersViewModel model) { + void getAncillaryOrderDetails() { GifLoaderDialogUtils.showMyDialog(context); - model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { - addToSelectedProcedures(model); + AncillaryOrdersService ancillaryOrdersService = new AncillaryOrdersService(); + ancillaryOrdersService.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((response) { + _ancillaryProcLists = []; + selectedProcList = []; + if (response['AncillaryOrderProcList'] != null && response['AncillaryOrderProcList'].length != 0) { + response['AncillaryOrderProcList'].forEach((item) { + _ancillaryProcLists.add(AncillaryOrdersListProcListModel.fromJson(item)); + }); + addToSelectedProcedures(); + } GifLoaderDialogUtils.hideDialog(context); }).catchError((err) { + AppToast.showErrorToast(message: err.toString()); GifLoaderDialogUtils.hideDialog(context); }); } @@ -73,83 +89,74 @@ class _AnicllaryOrdersState extends State with SingleTic projectViewModel = Provider.of(context); localContext = context; AppGlobal.context = context; - return BaseView( - onModelReady: (model) { - // getAncillaryOrderDetails(model); - model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { - addToSelectedProcedures(model); - }); - }, - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - appBarTitle: TranslationBase.of(context).anicllaryOrders, - body: SingleChildScrollView( - padding: EdgeInsets.all(12), - child: model.ancillaryListsDetails.length > 0 - ? Column(children: [ - getPatientInfo(model), - getAncillaryDetails(model), - ]) - : getNoDataWidget(context), - ), - bottomSheet: model.ancillaryListsDetails.length > 0 - ? Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15), - width: double.infinity, - // color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox(height: 12), - Text( - TranslationBase.of(context).YouCanPayByTheFollowingOptions, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.64, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.75, - child: getPaymentMethods(), - ), - _amountView(TranslationBase.of(context).patientShareTotalToDo, getTotalValue() + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true), - SizedBox(height: 12), - DefaultButton( - TranslationBase.of(context).payNow.toUpperCase(), - selectedProcList.length > 0 - ? () { - if (getTotalValue() != "0.00") { - makePayment(model); - } else { - autoGenerateInvoice(); - } - } - : null, - color: CustomColors.green, - disabledColor: CustomColors.grey2, - ), - ], - ), + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).anicllaryOrders, + body: SingleChildScrollView( + padding: EdgeInsets.all(12), + child: _ancillaryProcLists.isNotEmpty + ? Column( + children: [ + getPatientInfo(), + getAncillaryDetails(), + ], ) - : Container(), + : getNoDataWidget(context), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10), bottomLeft: Radius.circular(10), bottomRight: Radius.circular(10)), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 7, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15), + width: double.infinity, + // color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 12), + Text( + TranslationBase.of(context).YouCanPayByTheFollowingOptions, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.75, + child: getPaymentMethods(), + ), + _amountView(TranslationBase.of(context).patientShareTotalToDo, getTotalValue() + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true), + SizedBox(height: 12), + DefaultButton( + TranslationBase.of(context).payNow.toUpperCase(), + selectedProcList.length > 0 + ? () { + if (getTotalValue() != "0.00") { + makePayment(); + } else { + autoGenerateInvoice(); + } + } + : null, + color: selectedProcList.length > 0 ? CustomColors.green : CustomColors.grey2, + disabledColor: CustomColors.grey2, + ), + ], + ), ), ); } @@ -184,7 +191,7 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - Widget getPatientInfo(AnciallryOrdersViewModel model) { + Widget getPatientInfo() { return Padding( child: Column( children: [ @@ -277,7 +284,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - model.ancillaryListsDetails[0].appointmentNo.toString(), + _ancillaryProcLists[0].appointmentNo.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -300,7 +307,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList[0].orderNo.toString(), + _ancillaryProcLists[0].ancillaryOrderProcDetailsList[0].orderNo.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -325,7 +332,7 @@ class _AnicllaryOrdersState extends State with SingleTic mWidth(3), Expanded( child: Text( - model.ancillaryListsDetails[0].companyName.toString(), + _ancillaryProcLists[0].companyName.toString(), overflow: TextOverflow.clip, style: TextStyle( fontWeight: FontWeight.w600, @@ -350,7 +357,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - model.ancillaryListsDetails[0].insurancePolicyNo.toString(), + _ancillaryProcLists[0].insurancePolicyNo.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -370,8 +377,8 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - Widget getAncillaryDetails(model) { - Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); + Widget getAncillaryDetails() { + Map newMap = groupBy(_ancillaryProcLists[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); return Padding(padding: EdgeInsets.only(top: 0, bottom: 200), child: getHeaderDetails(newMap)); } @@ -493,21 +500,21 @@ class _AnicllaryOrdersState extends State with SingleTic return tableRow; } - makePayment(AnciallryOrdersViewModel model) { + makePayment() { showDraggableDialog( context, PaymentMethod( onSelectedMethod: (String method, [String selectedInstallmentPlan]) { selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, model, selectedInstallmentPlan); + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); }, patientShare: double.parse(getTotalValue()), isFromAdvancePayment: !projectViewModel.havePrivilege(94), )); } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String selectedInstallmentPlan]) { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String selectedInstallmentPlan]) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID); @@ -529,10 +536,10 @@ class _AnicllaryOrdersState extends State with SingleTic // Need to get new Service ID from Ayman for Ancillary Tamara "", context, - model.ancillaryListsDetails[0].appointmentDate, - model.ancillaryListsDetails[0].appointmentNo, - model.ancillaryListsDetails[0].clinicID, - model.ancillaryListsDetails[0].doctorID, + _ancillaryProcLists[0].appointmentDate, + _ancillaryProcLists[0].appointmentNo, + _ancillaryProcLists[0].clinicID, + _ancillaryProcLists[0].doctorID, selectedInstallmentPlan); } @@ -717,16 +724,18 @@ class _AnicllaryOrdersState extends State with SingleTic } } - addToSelectedProcedures(AnciallryOrdersViewModel model) { - if (model.ancillaryListsDetails.isNotEmpty) { + addToSelectedProcedures() { + if (_ancillaryProcLists.isNotEmpty) { selectedProcList.clear(); - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((element) { - if (!isProcedureDisabled(element)) { - selectedProcList.add(element); - } - }); - setState(() {}); + if (_ancillaryProcLists[0].ancillaryOrderProcDetailsList.isNotEmpty) { + _ancillaryProcLists[0].ancillaryOrderProcDetailsList.forEach((element) { + if (!isProcedureDisabled(element)) { + selectedProcList.add(element); + } + }); + } else {} } + setState(() {}); } String getInsuranceText(value) { diff --git a/lib/pages/MyAppointments/models/BookedButtons.dart b/lib/pages/MyAppointments/models/BookedButtons.dart index bec7f39c..66e4366f 100644 --- a/lib/pages/MyAppointments/models/BookedButtons.dart +++ b/lib/pages/MyAppointments/models/BookedButtons.dart @@ -38,6 +38,7 @@ class BookedButtons { "subtitle": TranslationBase.of(AppGlobal.context).location, "icon": "hosp_location.svg", "caller": "navigateToProject", - } + }, + {"title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, "icon": "online_payment.svg", "caller": "goToTodoList"} ]; } diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index bdab5211..deee5a5e 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -587,11 +587,11 @@ class _AppointmentActionsState extends State { navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { if (widget.projectViewModel.isLogin) { - if (model.count != 0) { + // if (model.count != 0) { getPatientAppointmentHistoryWithAppo(); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); - } + // } else { + // AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + // } } else { Navigator.push( context, diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 207310b4..c25e9fd0 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -417,7 +417,8 @@ class _HomePageFragment2State extends State { flex: 1, child: InkWell( onTap: () { - if (projectViewModel.havePrivilege(100)) widget.onPharmacyClick(); + if (projectViewModel.havePrivilege(100)) + widget.onPharmacyClick(); }, child: Stack(children: [ Container( diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 7374d273..a8b3a531 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -11,6 +12,8 @@ import 'package:diplomaticquarterapp/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 'package:url_launcher/url_launcher_string.dart'; import 'fragments/home_page_fragment2.dart'; import 'landing_page_pharmcy.dart'; @@ -48,7 +51,9 @@ class _HomePageState2 extends State { widget.onLoginClick(); }, onPharmacyClick: () { - getPharmacyToken(model); + // getPharmacyToken(model); + Uri uri = Uri.parse(PHARMACY_REDIRECT_URL); + launchUrl(uri, mode: LaunchMode.externalApplication); }, onMedicalFileClick: () { widget.onMedicalFileClick(); diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index f1753f3c..84682c64 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -209,7 +210,9 @@ class ServicesView extends StatelessWidget { Navigator.push(context, FadePage(page: CMCPage())); locator().hmgServices.logServiceName('comprehensive medical checkup'); } else if (hmgServices.action == 5) { - getPharmacyToken(context); + // getPharmacyToken(context); + Uri uri = Uri.parse(PHARMACY_REDIRECT_URL); + launchUrl(uri, mode: LaunchMode.externalApplication); locator().hmgServices.logServiceName('al habib pharmacy'); } else if (hmgServices.action == 6) { Navigator.push(context, FadePage(page: MedicalProfilePageNew())); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 8923f76e..052078bf 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -48,16 +48,16 @@ class DoctorsListService extends BaseService { } var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); + // Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', + // "LanguageID": languageID == 'ar' ? 1 : 2, + // "IPAdress": "10.20.10.20", + // "VersionID": req.VersionID, + // "Channel": req.Channel, + // "generalid": 'Cs2020@2016\$2958', "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, + // "DeviceTypeID": req.DeviceTypeID, "SessionID": "YckwoXhUmWBsnHKEKig", "ClinicID": clinicID, "ProjectID": projectID, diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 8bf3a0ec..9f75f8fa 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -18,19 +18,7 @@ class ClinicListService extends BaseService { double long; Future getClinicsList(context) async { - Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": null - }; + Map request = {}; dynamic localRes; @@ -44,22 +32,7 @@ class ClinicListService extends BaseService { } Future getActiveAppointmentNo(context) async { - Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - request = { - // "LanguageID": languageID == 'ar' ? 1 : 2, - // "IPAdress": "10.20.10.20", - // "VersionID": req.VersionID, - // "Channel": req.Channel, - // "generalid": 'Cs2020@2016\$2958', - // "PatientOutSA": user.outSA, - "IsActiveAppointment": true, - // "DeviceTypeID": req.DeviceTypeID, - // "PatientType": user.patientType, - // "PatientTypeID": user.patientType, - // "SessionID": null - }; + Map request = {}; dynamic localRes; @@ -72,19 +45,7 @@ class ClinicListService extends BaseService { } Future getProjectsList(context) async { - Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": null - }; + Map request = {}; dynamic localRes; @@ -113,9 +74,9 @@ class ClinicListService extends BaseService { "SelectedDate": "", "SelectedTime": "", "License": true, - "VersionID": 5.6, - "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, + // "VersionID": 5.6, + // "Channel": 3, + // "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "SessionID": null, @@ -155,11 +116,11 @@ class ClinicListService extends BaseService { request = { "ChiefComplaintID": chiefComplaintID, "ProjectID": projectID, - "VersionID": 5.6, - "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": req.IPAdress, - "generalid": req.generalid, + // "VersionID": 5.6, + // "Channel": 3, + // "LanguageID": languageID == 'ar' ? 1 : 2, + // "IPAdress": req.IPAdress, + // "generalid": req.generalid, "SessionID": null, "isDentalAllowedBackend": true, "Latitude": lat != null ? lat.toString() : "0.0", diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 7d6aa06f..2c74a963 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; @@ -32,8 +33,8 @@ class _SplashScreenState extends State { super.initState(); Timer( Duration(seconds: 1, milliseconds: 500), - () { - loadPrivilege().then((value) { + () async { + await loadPrivilege().then((value) { Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (BuildContext context) => LandingPage(), @@ -44,8 +45,8 @@ class _SplashScreenState extends State { ); AppSharedPreferences().getAll().then((value) { - // debugPrint("ALL SHARED PREFERENCES!!!!!"); - // debugPrint(jsonEncode(value)); + debugPrint("ALL SHARED PREFERENCES!!!!!"); + debugPrint(jsonEncode(value)); }); } diff --git a/pubspec.yaml b/pubspec.yaml index ae5a6c0a..2494a580 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.029+4050029 +version: 4.5.73+1 environment: sdk: ">=2.7.0 <3.0.0" From cb9ced27c2ec9bfe80b500608bd3e1f63fd9bede Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 23 Nov 2023 10:45:53 +0300 Subject: [PATCH 06/11] updates --- lib/pages/BookAppointment/BookSuccess.dart | 2 +- lib/services/clinic_services/get_clinic_service.dart | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 0a3d90ef..62708472 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -191,7 +191,7 @@ class _BookSuccessState extends State { child: Container( color: CustomColors.appBackgroudGreyColor, margin: EdgeInsets.all(14), - height: 150.0, + height: widget.isCash ? 150.0 : 50, child: Column( children: [ Row( diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 9f75f8fa..ce9d511f 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -34,6 +34,10 @@ class ClinicListService extends BaseService { Future getActiveAppointmentNo(context) async { Map request = {}; + request = { + "IsActiveAppointment": true, + }; + dynamic localRes; await baseAppClient.post(GET_ACTIVE_APPOINTMENTS_LIST_URL, onSuccess: (response, statusCode) async { From 1ddac14efbf8bfad9b2bdeddac93e948596f4169 Mon Sep 17 00:00:00 2001 From: devamirsaleemahmad Date: Thu, 23 Nov 2023 12:08:37 +0300 Subject: [PATCH 07/11] Calender Permission Fix Ios 17+ --- ios/Podfile | 2 +- ios/Runner/Info.plist | 4 ++++ lib/main.dart | 2 +- lib/pages/BookAppointment/book_reminder_page.dart | 6 +++--- lib/pages/BookAppointment/widgets/reminder_dialog.dart | 1 - lib/pages/landing/landing_page.dart | 2 +- lib/uitl/location_util.dart | 4 ++-- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 264db98d..5495f0ca 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -48,7 +48,7 @@ post_install do |installer| 'PERMISSION_CAMERA=1', 'PERMISSION_MICROPHONE=1', ## dart: PermissionGroup.calendar - 'PERMISSION_EVENTS=1', + 'PERMISSION_EVENTS_FULL_ACCESS=1', ## dart: PermissionGroup.reminders 'PERMISSION_REMINDERS=1', ] diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 65a0bf75..43474d39 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -59,6 +59,10 @@ This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. NSCalendarsUsageDescription This app requires calendar access to set reminders for Virtual & Normal Appointments. + NSCalendarsWriteOnlyAccessUsageDescription + This app requires calendar access to set reminders for Virtual & Normal Appointments. + NSCalendarsFullAccessUsageDescription + This app requires calendar access to set reminders for Virtual & Normal Appointments. NSCameraUsageDescription This app requires camera access to enable virtual consultation between patient & doctor NSContactsUsageDescription diff --git a/lib/main.dart b/lib/main.dart index 44be8712..1842c15e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -161,7 +161,7 @@ class _MyApp extends State { builder: (_, mchild) { return MediaQuery( data: MediaQuery.of(context).copyWith( - textScaleFactor: 1.0, + textScaler: TextScaler.linear(1.0), ), //set desired text scale factor here child: mchild! ); diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index 6a124fd2..6615f092 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -82,10 +82,10 @@ class _BookReminderPageState extends State { widget.docObject.projectName!, null, null, - widget.docObject.nationalityFlagURL!, - widget.docObject.doctorRate!, + widget.docObject.nationalityFlagURL ?? "", + widget.docObject.doctorRate?? 0, null, - widget.docObject.noOfPatientsRate!, + widget.docObject.noOfPatientsRate ?? 0, "", ), isNeedToShowButton: false, diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index a68fbfa4..91c04833 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -35,7 +35,6 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S } } else { if (await Permission.calendarFullAccess.request().isGranted) { - print(await Permission.calendarFullAccess.request().isGranted); _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 02850e7c..13fa4e23 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -641,7 +641,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { projectViewModel.analytics.setUser(AuthenticatedUser()); } if (Platform.isIOS) { - String voipToken = await sharedPref.getString(APNS_TOKEN); + String? voipToken = await sharedPref.getString(APNS_TOKEN?? ""); // getOneSignalVOIPToken(voipToken); } } diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 402d9f57..a40277c7 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -128,8 +128,8 @@ class LocationUtils { heading: 0.0, speed: 0.0, speedAccuracy: 1, - altitudeAccuracy: 0, - headingAccuracy: 0, + altitudeAccuracy: 0, + headingAccuracy: 0, // Added by Aamir ), ); From fb62ce2f19b1252284683401541066ec95375283 Mon Sep 17 00:00:00 2001 From: devamirsaleemahmad Date: Sun, 26 Nov 2023 10:16:51 +0300 Subject: [PATCH 08/11] Calender Fix Ios 17+ --- lib/pages/BookAppointment/BookSuccess.dart | 2 +- lib/pages/BookAppointment/QRCode.dart | 2 +- .../BookAppointment/book_reminder_page.dart | 6 ++-- .../widgets/reminder_dialog.dart | 32 ++++++++++--------- .../appointment_services/GetDoctorsList.dart | 2 -- lib/uitl/CalendarUtils.dart | 4 +-- pubspec.yaml | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 021d4bf2..4e5d36b9 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -94,7 +94,7 @@ class _BookSuccessState extends State { widget.docObject.projectName!, null, null, - widget.docObject.nationalityFlagURL!, + widget.docObject.nationalityFlagURL ?? "", widget.docObject.doctorRate, null, widget.docObject.noOfPatientsRate, diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 1844a3d6..ffe8e268 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -107,7 +107,7 @@ class _QRCodeState extends State { DoctorHeader( headerModel: HeaderModel( widget.appointment!.doctorTitle! + " " + widget.appointment!.doctorNameObj!, - widget.appointment!.doctorID!, + widget.appointment!.doctorID ?? 0, widget.appointment!.doctorImageURL!, widget.appointment!.doctorSpeciality!, "", diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index 6615f092..56c48589 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -1,5 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; @@ -188,8 +189,6 @@ class _BookReminderPageState extends State { backgroundColor: CustomColors.green, elevation: 0, onPressed: () async { - print(widget.patientShareResponse); - print(widget.patientShareResponse.appointmentNo); showReminderDialog( context, widget.dateTime!, @@ -201,7 +200,8 @@ class _BookReminderPageState extends State { AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); navigateToBookSuccess(context); }, - title: "" + title: null, + description: null ); projectViewModel.analytics.appointment.appointment_reminder(true); }, diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 91c04833..37f343ad 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -24,27 +24,25 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S if (Platform.isAndroid) { if (await PermissionService.isCalendarPermissionEnabled()) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); } else { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async { if (await Permission.calendarFullAccess.request().isGranted) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); } }); } } else { if (await Permission.calendarFullAccess.request().isGranted) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); } } } -final CalendarPlugin _myPlugin = CalendarPlugin(); - Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {required Function onSuccess, required String title, required String description, required Function(int) onMultiDateSuccess}) async { + {required Function onSuccess, String? title, String? description, required Function(int) onMultiDateSuccess}) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -77,17 +75,21 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String text = "2 hours"; } - if (onMultiDateSuccess == null) { + if (onMultiDateSuccess.call(i) == null) { CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - calendarUtils - .createOrUpdateEvent( - title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, - description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, - scheduleDateTime: dateTime, - eventId: eventId) - .then((value) {}); + try { + await calendarUtils.createOrUpdateEvent( + title: title ?? TranslationBase + .of(context) + .reminderTitle + " " + doctorName, + description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + scheduleDateTime: dateTime, + eventId: eventId); - onSuccess(); + onSuccess(); + }catch(e){ + print(e); + } } else { onMultiDateSuccess(i); } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 15e9e0a0..fa87e489 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -393,10 +393,8 @@ class DoctorsListService extends BaseService { await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { - logger.d(error); throw error; }, body: request); - logger.d(localRes); return Future.value(localRes); } catch (e) { logger.d(e); diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index add65f64..1b34d18b 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -59,7 +59,7 @@ class CalendarUtils { }); } - Future createOrUpdateEvent({String? title, String? description, DateTime? scheduleDateTime, String? eventId}) async { + Future createOrUpdateEvent({required String title, required String description, DateTime? scheduleDateTime, String? eventId}) async { RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceFrequency.Daily, // daysOfWeek: daysOfWeek, @@ -74,7 +74,7 @@ class CalendarUtils { TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime!, _currentLocation); - // print("eventId: " + eventId); + //print("eventId: " + eventId); // print("writableCalendars-name: " + writableCalendars.name); // print("writableCalendars-Id: " + writableCalendars.id); // print("writableCalendarsToString: " + writableCalendars.toString()); diff --git a/pubspec.yaml b/pubspec.yaml index 5f16ef12..c00d6d1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -121,7 +121,7 @@ dependencies: flutter_datetime_picker_plus: ^2.1.0 carousel_pro_nullsafety: ^2.0.0 flutter_local_notifications: any - device_calendar: ^4.2.0 + device_calendar: ^4.3.2 geolocator: ^9.0.2 geocoding: ^2.0.1 jiffy: ^6.2.1 From 2def9f37447592d0be9431ef47c3461a52b870c9 Mon Sep 17 00:00:00 2001 From: devamirsaleemahmad Date: Sun, 26 Nov 2023 10:52:51 +0300 Subject: [PATCH 09/11] Merges From 3.3 --- .../privilege/ProjectDetailListModel.dart | 10 ++++---- .../ancillaryOrdersDetails.dart | 24 +++++++------------ lib/pages/BookAppointment/QRCode.dart | 13 +++++----- lib/pages/ToDoList/ToDo.dart | 2 +- lib/uitl/utils.dart | 6 ++--- 5 files changed, 23 insertions(+), 32 deletions(-) diff --git a/lib/core/model/privilege/ProjectDetailListModel.dart b/lib/core/model/privilege/ProjectDetailListModel.dart index b8241797..782c376b 100644 --- a/lib/core/model/privilege/ProjectDetailListModel.dart +++ b/lib/core/model/privilege/ProjectDetailListModel.dart @@ -1,9 +1,9 @@ class ProjectDetailListModel { - int projectID; - String latitude; - String longitude; - int geofenceRadius; - String checkInQrCode; + int? projectID; + String? latitude; + String? longitude; + int? geofenceRadius; + String? checkInQrCode; ProjectDetailListModel( {this.projectID, diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index e077e545..915703aa 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -47,9 +47,8 @@ class _AnicllaryOrdersState extends State with SingleTic String? selectedInstallmentPlan; List selectedProcList = []; - List _ancillaryProcLists = []; - + String? tamaraPaymentStatus; String? tamaraOrderID; @@ -376,16 +375,11 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - // Widget getAncillaryDetails() { - // Map newMap = groupBy(_ancillaryProcLists[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); - // return Padding(padding: EdgeInsets.only(top: 0, bottom: 200), child: getHeaderDetails(newMap)); - // } + - Widget getAncillaryDetails(AnciallryOrdersViewModel model) { + Widget getAncillaryDetails() { Map> newMap = {}; - - // Grouping the list manually by the 'procedureCategoryName' key - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList!.forEach((obj) { + _ancillaryProcLists[0].ancillaryOrderProcDetailsList!.forEach((obj) { String key = obj.procedureCategoryName!; if (newMap.containsKey(key)) { newMap[key]!.add(obj); @@ -399,9 +393,8 @@ class _AnicllaryOrdersState extends State with SingleTic child: getHeaderDetails(newMap), ); } - - - Widget getHeaderDetails(newMap) { + + Widget getHeaderDetails(newMap) { List list = []; newMap.forEach((key, value) { list.add( @@ -526,15 +519,14 @@ class _AnicllaryOrdersState extends State with SingleTic onSelectedMethod: (String method, [String? selectedInstallmentPlan]) { selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), AppoitmentAllHistoryResultList(), model, selectedInstallmentPlan); + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), AppoitmentAllHistoryResultList(), selectedInstallmentPlan); }, patientShare: double.parse(getTotalValue()), isFromAdvancePayment: !projectViewModel.havePrivilege(94), )); } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String selectedInstallmentPlan]) { - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String? selectedInstallmentPlan]) { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String? selectedInstallmentPlan]) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID!); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 99bd8717..0f253b63 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -52,9 +52,8 @@ class _QRCodeState extends State { late BuildContext _context; late ProjectViewModel projectViewModel; - LocationUtils locationUtils; - ProjectDetailListModel projectDetailListModel; - + late LocationUtils locationUtils; + ProjectDetailListModel projectDetailListModel = ProjectDetailListModel(); @override void initState() { @@ -99,11 +98,11 @@ class _QRCodeState extends State { startLocationCheckIn() async { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(callBack: (value) { - projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment.projectID); - double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude), double.parse(projectDetailListModel.longitude)).ceilToDouble() * 1000; + projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment!.projectID); + double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; print(dist); - if (dist <= projectDetailListModel.geofenceRadius) { - sendNfcCheckInRequest(projectDetailListModel.checkInQrCode); + if (dist <= projectDetailListModel.geofenceRadius!) { + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!); } else { AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index b53f5515..cefaaa4f 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -865,7 +865,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } dataLoaded = true; if (widget.isFromMyAppointments) { - performNextAction(widget.appointment); + performNextAction(widget.appointment!); widget.isFromMyAppointments = false; } }); diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index ebbb6069..21bef1ce 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -821,7 +821,7 @@ class Utils { static double _toRadians(double degrees) => degrees * pi / 180; - static double _haversin(double radians) => pow(sin(radians / 2), 2); + static num _haversin(double radians) => pow(sin(radians / 2), 2); static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) { return Column( @@ -872,7 +872,7 @@ class Utils { } static ProjectDetailListModel getProjectDetailObj(ProjectViewModel projectViewModel, int projectID) { - ProjectDetailListModel projectDetailListModel; + ProjectDetailListModel projectDetailListModel = ProjectDetailListModel(); projectViewModel.projectDetailListModel.forEach((element) { if (element.projectID == projectID) { projectDetailListModel = element; @@ -881,7 +881,7 @@ class Utils { return projectDetailListModel; } - static String generateSignature() {} + //static String generateSignature() {} } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) { From 62dc3c162ac87ca0eeb43344d2f44d38e7735991 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 26 Nov 2023 11:21:05 +0300 Subject: [PATCH 10/11] updated 3.13.6 --- .../new_e_referral_step_two_page.dart | 4 ++-- .../widgets/reminder_dialog.dart | 10 +++++----- lib/pages/ChildVaccines/add_newchild_page.dart | 2 +- .../widgets/AppointmentActions.dart | 18 +++++++++++++++++- lib/widgets/others/floating_button_search.dart | 16 +++++++++------- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 2ea76b65..daf11a8f 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -35,7 +35,7 @@ class _NewEReferralStepTowPageState extends State { TextEditingController _patientNameTextController = TextEditingController(); TextEditingController _patientIdentificationTextController = TextEditingController(); String mobileNo = ""; - late GetAllCitiesResponseModel _selectedCity; + GetAllCitiesResponseModel _selectedCity =GetAllCitiesResponseModel(); late GetAllSharedRecordsByStatusList selectedPatientFamily; @@ -297,7 +297,7 @@ class _NewEReferralStepTowPageState extends State { } String getRelationName() { - if (_selectedCity != null) + if (_selectedCity?.description != null) return _selectedCity.description!; else return TranslationBase.of(context).selectCity /*TranslationBase.of(context).selectHospital*/; diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 91c04833..60e719fd 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -24,19 +24,19 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S if (Platform.isAndroid) { if (await PermissionService.isCalendarPermissionEnabled()) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? null); } else { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async { if (await Permission.calendarFullAccess.request().isGranted) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? null); } }); } } else { if (await Permission.calendarFullAccess.request().isGranted) { _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? null); } } } @@ -44,7 +44,7 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S final CalendarPlugin _myPlugin = CalendarPlugin(); Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {required Function onSuccess, required String title, required String description, required Function(int) onMultiDateSuccess}) async { + {required Function onSuccess, required String title, required String description, Function(int)? onMultiDateSuccess}) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -77,7 +77,7 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String text = "2 hours"; } - if (onMultiDateSuccess == null) { + if (onMultiDateSuccess ==null) { CalendarUtils calendarUtils = await CalendarUtils.getInstance(); calendarUtils .createOrUpdateEvent( diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index b03a6db2..19ccae1e 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -47,7 +47,7 @@ class AddNewChildPage extends StatefulWidget { class _AddNewChildPageState extends State { late int tappedIndex; - late int checkedValue; + int checkedValue =0; @override void initState() { diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 769b6761..28094c14 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -34,11 +34,15 @@ import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profil import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:intl/intl.dart'; import 'package:map_launcher/map_launcher.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'dart:io'; +import 'package:huawei_map/huawei_map.dart' as hmsMap; + class AppointmentActions extends StatefulWidget { AppoitmentAllHistoryResultList appo; @@ -55,10 +59,13 @@ class AppointmentActions extends StatefulWidget { class _AppointmentActionsState extends State { List appoButtonsList = []; + static bool isHuawei =false; + late HmsApiAvailability hmsApiAvailability; @override void initState() { _getAppointmentActionButtons(); + checkIsHuawei(); super.initState(); } @@ -455,13 +462,22 @@ class _AppointmentActionsState extends State { static Future openMap(double latitude, double longitude) async { await MapLauncher.showMarker( - mapType: MapType.google, + mapType: Platform.isAndroid ? isHuawei == true ? MapType.petal: MapType.google : MapType.apple, coords: Coords(latitude, longitude), title: "Sulaiman Al Habib", description: "Appointment Location", ); } + checkIsHuawei() async { + if( Platform.isAndroid) { + await hmsApiAvailability.isHMSAvailable().then((value) { + isHuawei = value == 0 ? true : false; + hmsMap.HuaweiMapInitializer.initializeMap(); + }); + print(isHuawei); + } + } askYourDoc() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index d2da2564..c3e9e884 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -68,7 +68,6 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; -import 'package:speech_to_text/speech_to_text.dart'; import 'package:url_launcher/url_launcher.dart'; class FloatingSearchButton extends StatefulWidget { @@ -144,7 +143,7 @@ class _FloatingSearchButton extends State with TickerProvi if (p['startPopUp'] == 'true') { if (this.mounted) { new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); + initSpeechState().then((value) => {startVoiceSearch()}); } } }); @@ -259,16 +258,19 @@ class _FloatingSearchButton extends State with TickerProvi // } // some time later... if(available) { - speech.stop(); + + // speech.listen( onResult: resultListener ); + // speech.stop(); speech.listen( onResult: resultListener, listenFor: Duration(seconds: 10), localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', onSoundLevelChange: soundLevelListener, - cancelOnError: true, - partialResults: true, - onDevice: true, - listenMode: ListenMode.deviceDefault); + // cancelOnError: true, + // partialResults: true, + // onDevice: true, + // listenMode: stt.ListenMode.deviceDefault + ); } } From 6671dea8d87e749ba6589a910ce038516ca49724 Mon Sep 17 00:00:00 2001 From: devamirsaleemahmad Date: Sun, 26 Nov 2023 14:57:09 +0300 Subject: [PATCH 11/11] Delete Event on Calender --- .../MyAppointments/AppointmentDetails.dart | 123 ++++++++++-------- 1 file changed, 72 insertions(+), 51 deletions(-) diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 29ed7736..7889c531 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,8 +1,10 @@ import 'dart:collection'; +import 'dart:convert'; 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/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; @@ -30,7 +32,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:provider/provider.dart'; - import 'widgets/AppointmentActions.dart'; class AppointmentDetails extends StatefulWidget { @@ -50,7 +51,7 @@ class _AppointmentDetailsState extends State with SingleTick static TabController? _tabController; AppSharedPreferences sharedPref = AppSharedPreferences(); - List doctorDetailsList =[]; + List doctorDetailsList = []; ToDoCountProviderModel? toDoProvider; ProjectViewModel? projectViewModel; @@ -306,10 +307,12 @@ class _AppointmentDetailsState extends State with SingleTick context, FadePage( page: BookConfirm( - doctor: getDoctorObject(), - isLiveCareAppointment: widget.appo.isLiveCareAppointment!, - selectedDate: DocAvailableAppointments.selectedDate!, - selectedTime: DocAvailableAppointments.selectedTime!, initialSlotDuration: 0,))); + doctor: getDoctorObject(), + isLiveCareAppointment: widget.appo.isLiveCareAppointment!, + selectedDate: DocAvailableAppointments.selectedDate!, + selectedTime: DocAvailableAppointments.selectedTime!, + initialSlotDuration: 0, + ))); } void getDoctorRatingsDetails() { @@ -357,41 +360,50 @@ class _AppointmentDetailsState extends State with SingleTick margin: EdgeInsets.only(bottom: 5.0), padding: EdgeInsets.all(10.0), child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.black))), - Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate!.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: - // RatingBar.readOnly( - // initialRating: this.widget.appo.actualDoctorRate.toDouble(), - // size: 35.0, - // filledColor: Colors.yellow[700], - // emptyColor: Colors.grey[500], - // isHalfAllowed: true, - // halfFilledIcon: Icons.star_half, - // filledIcon: Icons.star, - // emptyIcon: Icons.star, - // ), - RatingBar( - initialRating: this.widget.appo.actualDoctorRate!.toDouble(), - direction: Axis.horizontal, - allowHalfRating: true, - itemCount: 5, - itemSize: 20, - ignoreGestures: true, - ratingWidget: RatingWidget( - full: Icon(Icons.star, color: CustomColors.accentColor,), - half: Icon(Icons.star_half, color: CustomColors.accentColor,), - empty: Icon(Icons.star, color: CustomColors.accentColor,), - ), - tapOnlyMode: true, - unratedColor: Colors.grey[500], - itemPadding: EdgeInsets.symmetric(horizontal: 4.0), - onRatingUpdate: (rating) { - print(rating); - }, - ) - ), + margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate!.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: + // RatingBar.readOnly( + // initialRating: this.widget.appo.actualDoctorRate.toDouble(), + // size: 35.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + RatingBar( + initialRating: this.widget.appo.actualDoctorRate!.toDouble(), + direction: Axis.horizontal, + allowHalfRating: true, + itemCount: 5, + itemSize: 20, + ignoreGestures: true, + ratingWidget: RatingWidget( + full: Icon( + Icons.star, + color: CustomColors.accentColor, + ), + half: Icon( + Icons.star_half, + color: CustomColors.accentColor, + ), + empty: Icon( + Icons.star, + color: CustomColors.accentColor, + ), + ), + tapOnlyMode: true, + unratedColor: Colors.grey[500], + itemPadding: EdgeInsets.symmetric(horizontal: 4.0), + onRatingUpdate: (rating) { + print(rating); + }, + )), Container( margin: EdgeInsets.only(top: 10.0), child: Text(this.widget.appo.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black))), @@ -510,10 +522,10 @@ class _AppointmentDetailsState extends State with SingleTick minWidth: MediaQuery.of(context).size.width, height: 40.0, child: CustomTextButton( - elevation: 0.0, - backgroundColor: Colors.white, - disabledForegroundColor: new Color(0xFFbcc2c4).withOpacity(0.38), - disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), + elevation: 0.0, + backgroundColor: Colors.white, + disabledForegroundColor: new Color(0xFFbcc2c4).withOpacity(0.38), + disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), onPressed: () { Navigator.of(context).pop(); }, @@ -612,15 +624,24 @@ class _AppointmentDetailsState extends State with SingleTick 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); + if (calendarUtils.calendars.length > 1) { + calendarUtils.calendars.forEach((calender) { + calendarUtils.retrieveEvents(calender.id!, params).then((value) { + Result> events = value; + events.data!.forEach((element) { + if (element.title!.contains(widget.appo.doctorNameObj!)) calendarUtils.deleteEvent(calender, element); + }); + }); }); - }); + } else { + 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() {