From abcf82346e3afc81bc475415d55a6976c520f926 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Thu, 21 Sep 2023 16:44:58 +0300 Subject: [PATCH 01/71] Excluded change --- lib/config/config.dart | 2 +- .../send_activation_request.dart | 8 +- .../DrawerPages/family/add-family-member.dart | 41 +++++-- lib/pages/DrawerPages/family/my-family.dart | 8 +- .../family_files/family_files_provider.dart | 3 +- lib/uitl/LocalNotification.dart | 114 +++++++++--------- lib/uitl/push-notification-handler.dart | 12 +- 7 files changed, 105 insertions(+), 83 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e93af7c8..d5482cb8 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,7 +19,7 @@ var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; 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 = 'http://10.50.100.198:4422/'; var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index 9c9c7804..fbaa744c 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -28,7 +28,7 @@ class SendActivationRequest { int responseID; int status; int familyRegionID; - + bool isPatientExcluded; SendActivationRequest( {this.patientMobileNumber, this.mobileNo, @@ -58,7 +58,9 @@ class SendActivationRequest { this.healthId, this.responseID, this.status, - this.familyRegionID}); + this.familyRegionID, + this.isPatientExcluded + }); SendActivationRequest.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -90,6 +92,7 @@ class SendActivationRequest { responseID = json['ReponseID']; status = json['Status']; familyRegionID = json['FamilyRegionID']; + isPatientExcluded = json['IsPatientExcluded']; } Map toJson() { @@ -123,6 +126,7 @@ class SendActivationRequest { data['ResponseID'] = responseID; data['Status'] = status; data['FamilyRegionID'] = familyRegionID; + data['IsPatientExcluded'] = isPatientExcluded; return data; } } diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 6d9064d7..c3d79918 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -161,7 +161,8 @@ class _AddMember extends State { } insertFamilyData(addMemberResult) { - sendActivationCode(addMemberResult); + + sendActivationCode(addMemberResult, addMemberResult['ShareFamilyFileObj']['IsPatientExcluded']); // var request = InsertSharePatientFileReq(); // request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; // request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; @@ -178,13 +179,21 @@ class _AddMember extends State { // }); } - sendActivationCode(result) { + sendActivationCode(result, bool isExcluded) { // var request = this.getCommonRequest(); loading(true); patientShareResponseID = result['ShareFamilyFileObj']['ReponseID']; - familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID).then((res) => { - patientShareRequestID = res['PatientShareRequestID'], - if (res != null && res['isSMSSent'] == true) {this.startSMSService(1, res)} + familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID, isExcluded).then((res) { + patientShareRequestID = res['PatientShareRequestID']; + if (res != null && res['isSMSSent'] == true) + { + this.startSMSService(1, res); + + }else + { + this.checkActivationCodeExcluded('0000', res); + } + }); } @@ -206,12 +215,19 @@ class _AddMember extends State { ).displayDialog(context); } + checkActivationCodeExcluded(value, result){ + familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) { + SMSOTP.hideSMSBox(context); + handleFamilyRequests(); + }); + } + checkActivationCode(value, result) { Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context); familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) { SMSOTP.hideSMSBox(context); - handleFamilyRequests(this.patientShareRequestID, 3); + handleFamilyRequests(); }).catchError((err) { Future.delayed(Duration(seconds: 1), () { AppToast.showErrorToast(message: err); @@ -220,13 +236,12 @@ class _AddMember extends State { }); } - handleFamilyRequests(id, stauts) { - // familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { - sharedPref.remove(FAMILY_FILE); - Navigator.of(context).pushNamed( - MY_FAMILIY, - ); - // }); + handleFamilyRequests() { + Navigator.pop(context); + sharedPref.remove(FAMILY_FILE); + Navigator.of(context).pushNamed( + MY_FAMILIY + ); } loading(flag) { diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index fa7d4a6a..0eedf483 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -443,7 +443,11 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request['ID'] = this.userID; request['IsActive'] = false; - this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context)); + this.familyFileProvider.deativateActivateMemberFile(request).then((value) { + refreshFamily(context); + GifLoaderDialogUtils.hideDialog(context); + }); + } refreshFamily(context) async { @@ -541,6 +545,7 @@ class _MyFamily extends State with TickerProviderStateMixin { setState(() { }); + } } @@ -561,6 +566,7 @@ class _MyFamily extends State with TickerProviderStateMixin { familySharedRecords = await familyFileProvider.getSharedRecordByStatus(); } sentRecordsList =[]; + familySharedRecordsList =[]; familySharedRecords.getAllSharedRecordsByStatusList.forEach((element) { if (element.status == 3) { familySharedRecordsList.add(element); diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 7a41f6b9..901d3b42 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -138,7 +138,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future sendActivationCode(cellNumber, zipCode, patientIdentificationID, responseID) async { + Future sendActivationCode(cellNumber, zipCode, patientIdentificationID, responseID, bool isExcluded) async { try { dynamic localRes; var request = SendActivationRequest(); @@ -152,6 +152,7 @@ class FamilyFilesProvider with ChangeNotifier { request.responseID = responseID; request.status = 2; request.familyRegionID = zipCode == '966' ? 1 : 2; + request.isPatientExcluded = isExcluded; await new BaseAppClient().post(SEND_FAMILY_FILE_ACTIVATION, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index d7afaa90..9e0cd11b 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -31,24 +31,24 @@ class LocalNotification { _initialize() async { try { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); - var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); - await flutterLocalNotificationsPlugin.initialize( - initializationSettings, - onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { - switch (notificationResponse.notificationResponseType) { - case NotificationResponseType.selectedNotification: - // selectNotificationStream.add(notificationResponse.payload); - break; - case NotificationResponseType.selectedNotificationAction: - // if (notificationResponse.actionId == navigationActionId) { - // selectNotificationStream.add(notificationResponse.payload); - // } - break; - } - }, - onDidReceiveBackgroundNotificationResponse: notificationTapBackground, - ); + // var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); + // var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); + // await flutterLocalNotificationsPlugin.initialize( + // initializationSettings, + // onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { + // switch (notificationResponse.notificationResponseType) { + // case NotificationResponseType.selectedNotification: + // // selectNotificationStream.add(notificationResponse.payload); + // break; + // case NotificationResponseType.selectedNotificationAction: + // // if (notificationResponse.actionId == navigationActionId) { + // // selectNotificationStream.add(notificationResponse.payload); + // // } + // break; + // } + // }, + // onDidReceiveBackgroundNotificationResponse: notificationTapBackground, + // ); } catch (ex) {} // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) // { @@ -68,16 +68,16 @@ class LocalNotification { // ); } - void notificationTapBackground(NotificationResponse notificationResponse) { - // ignore: avoid_print - print('notification(${notificationResponse.id}) action tapped: ' - '${notificationResponse.actionId} with' - ' payload: ${notificationResponse.payload}'); - if (notificationResponse.input?.isNotEmpty ?? false) { - // ignore: avoid_print - print('notification action tapped with input: ${notificationResponse.input}'); - } - } + // void notificationTapBackground(NotificationResponse notificationResponse) { + // // ignore: avoid_print + // print('notification(${notificationResponse.id}) action tapped: ' + // '${notificationResponse.actionId} with' + // ' payload: ${notificationResponse.payload}'); + // if (notificationResponse.input?.isNotEmpty ?? false) { + // // ignore: avoid_print + // print('notification action tapped with input: ${notificationResponse.input}'); + // } + // } var _random = new Random(); @@ -96,15 +96,15 @@ class LocalNotification { } Future showNow({@required String title, @required String subtitle, String payload}) { - Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', - channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - print(err); - }); - }); + // Future.delayed(Duration(seconds: 1)).then((result) async { + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', + // channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + // print(err); + // }); + // }); } Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { @@ -115,31 +115,31 @@ class LocalNotification { vibrationPattern[2] = 5000; vibrationPattern[3] = 2000; - var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', - channelDescription: 'ActivePrescriptionsDescription', - // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'), - - ///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic - vibrationPattern: vibrationPattern, - enableLights: true, - color: const Color.fromARGB(255, 255, 0, 0), - ledColor: const Color.fromARGB(255, 255, 0, 0), - ledOnMs: 1000, - ledOffMs: 500); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + // channelDescription: 'ActivePrescriptionsDescription', + // // icon: 'secondary_icon', + // sound: RawResourceAndroidNotificationSound('slow_spring_board'), + // + // ///change it to be as ionic + // // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + // vibrationPattern: vibrationPattern, + // enableLights: true, + // color: const Color.fromARGB(255, 255, 0, 0), + // ledColor: const Color.fromARGB(255, 255, 0, 0), + // ledOnMs: 1000, + // ledOffMs: 500); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); // /change it to be as ionic - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); + // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am Future showDailyAtTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); // await flutterLocalNotificationsPlugin.showDailyAtTime( @@ -153,8 +153,8 @@ class LocalNotification { ///Repeat notification weekly on Monday at approximately 10:00:00 am Future showWeeklyAtDayAndTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 3e765c17..7ae1ba43 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -303,10 +303,6 @@ class PushNotificationHandler { onToken(token); }); - FirebaseMessaging.instance.getAPNSToken().then((value) { - print("Push APNS getToken: " + value); - }); - FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); } @@ -349,10 +345,10 @@ class PushNotificationHandler { Future isAndroidPermissionGranted() async { if (Platform.isAndroid) { - final bool granted = await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.areNotificationsEnabled() ?? false; - if (!granted) { - await requestPermissions(); - } + // final bool granted = await flutterLocalNotificationsPlugin.resolvePlatfxormSpecificImplementation()?.areNotificationsEnabled() ?? false; + // if (!granted) { + // await requestPermissions(); + // } } } From 1492efdedbd07a03a3f06d1376653aa96d29a792 Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Tue, 17 Oct 2023 11:27:23 +0300 Subject: [PATCH 02/71] changes to build app --- android/app/build.gradle | 2 +- android/app/gradle/wrapper/gradle-wrapper.properties | 2 +- android/build.gradle | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 10 +++++----- pubspec.yaml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 965934fd..a1387dd3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -75,7 +75,7 @@ android { buildTypes { debug { debuggable true - signingConfig signingConfigs.release + signingConfig signingConfigs.debug } release { debuggable false diff --git a/android/app/gradle/wrapper/gradle-wrapper.properties b/android/app/gradle/wrapper/gradle-wrapper.properties index a2c20300..dd658e01 100644 --- a/android/app/gradle/wrapper/gradle-wrapper.properties +++ b/android/app/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/android/build.gradle b/android/build.gradle index e723adba..4ee80e4c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.20' + ext.kotlin_version = '1.8.20' repositories { google() jcenter() diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index e71a4266..dad9e879 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -50,7 +50,7 @@ import 'package:flutter/services.dart'; // import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:in_app_review/in_app_review.dart'; +// import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -64,7 +64,7 @@ class AppDrawer extends StatefulWidget { } class _AppDrawerState extends State { - final InAppReview _inAppReview = InAppReview.instance; + // final InAppReview _inAppReview = InAppReview.instance; @override void initState() { @@ -737,9 +737,9 @@ class _AppDrawerState extends State { } openAppReviewDialog() async { - if (await _inAppReview.isAvailable()) { - _inAppReview.requestReview(); - } + // if (await _inAppReview.isAvailable()) { + // _inAppReview.requestReview(); + // } } void setUserValues(value) async { diff --git a/pubspec.yaml b/pubspec.yaml index 235254f9..c90a0ebf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -132,7 +132,7 @@ dependencies: carousel_pro: ^1.0.0 #local_notifications - flutter_local_notifications: any + flutter_local_notifications: 10.0.0 #device_calendar device_calendar: ^4.2.0 @@ -187,7 +187,7 @@ dependencies: in_app_update: ^3.0.0 - in_app_review: ^2.0.3 +# in_app_review: ^2.0.6 badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 From 5c8bb241b3105f3c044673c919a63ee748559f40 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Nov 2023 12:10:05 +0300 Subject: [PATCH 03/71] 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 04/71] 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 05/71] 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 06/71] 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 07/71] 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 08/71] 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 ded6e02663f4efdde3812318b6f25a51df919f3b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 26 Nov 2023 15:05:45 +0300 Subject: [PATCH 09/71] CheckIn By Param added --- lib/pages/BookAppointment/QRCode.dart | 10 +++++----- lib/services/appointment_services/GetDoctorsList.dart | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index a6d55dce..2c2cc83d 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -77,7 +77,7 @@ class _QRCodeState extends State { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { - sendNfcCheckInRequest(nfcId); + sendNfcCheckInRequest(nfcId, 1); locator().todoList.to_do_list_nfc(widget.appointment); }); }, onCancel: () { @@ -90,7 +90,7 @@ class _QRCodeState extends State { startQRCodeScan() async { String onlineCheckInQRCode = (await BarcodeScanner.scan())?.rawContent; if (onlineCheckInQRCode != "") { - sendNfcCheckInRequest(onlineCheckInQRCode); + sendNfcCheckInRequest(onlineCheckInQRCode, 2); locator().todoList.to_do_list_nfc(widget.appointment); } else {} } @@ -102,7 +102,7 @@ class _QRCodeState extends State { 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); + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode, 3); } else { AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } @@ -341,12 +341,12 @@ class _QRCodeState extends State { return docSpeciality; } - sendNfcCheckInRequest(String nfcId) { + sendNfcCheckInRequest(String nfcId, int checkInBy) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.sendCheckinNfcRequest(widget.patientShareResponse.appointmentNo, nfcId, widget.patientShareResponse.projectID, context).then((res) { + service.sendCheckinNfcRequest(widget.patientShareResponse.appointmentNo, nfcId, widget.patientShareResponse.projectID, checkInBy, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 052078bf..a7482eaa 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1553,13 +1553,14 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, BuildContext context) async { + Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, int checkInBy, BuildContext context) async { Map request; request = { "AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, + "CheckinBy": checkInBy }; dynamic localRes; await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { From beb3453ff5e57842c0ba0ee52929f50ee261eb40 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 27 Nov 2023 14:09:54 +0300 Subject: [PATCH 10/71] updates --- lib/core/model/rate/appoitment_rated.dart | 4 ++-- lib/uitl/push-notification-handler.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/model/rate/appoitment_rated.dart b/lib/core/model/rate/appoitment_rated.dart index 95358b23..2f0d0dae 100644 --- a/lib/core/model/rate/appoitment_rated.dart +++ b/lib/core/model/rate/appoitment_rated.dart @@ -26,12 +26,12 @@ class AppoitmentRated { String arrivedOn; int editedBy; String editedOn; - Null doctorName; + String doctorName; String doctorNameN; String statusDesc; String statusDescN; bool vitalStatus; - Null vitalSignAppointmentNo; + dynamic vitalSignAppointmentNo; int episodeID; String doctorTitle; bool isAppoitmentLiveCare; diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 3e765c17..03e6ec29 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -336,7 +336,7 @@ class PushNotificationHandler { onToken(String token) async { print("Push Notification Token: " + token); - AppSharedPreferences().setString(PUSH_TOKEN, token); + await AppSharedPreferences().setString(PUSH_TOKEN, token); DEVICE_TOKEN = token; } From 8b468fe4b541738c4ab434335dfff3691b8416a9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 28 Nov 2023 11:18:37 +0300 Subject: [PATCH 11/71] Updates & fixes --- lib/config/config.dart | 4 +- lib/pages/BookAppointment/BookSuccess.dart | 60 ++++++++++++----- .../models/BookedButtonsAllowCheckIn.dart | 6 +- .../widgets/AppointmentActions.dart | 1 + lib/pages/landing/landing_page.dart | 23 +++++++ lib/pages/login/confirm-login.dart | 53 +++++---------- lib/pages/login/login.dart | 67 +++++++++++-------- .../rate_appointment_clinic.dart | 14 ++-- .../rate_appointment_doctor.dart | 8 +-- lib/splashPage.dart | 8 +-- 10 files changed, 147 insertions(+), 97 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 0eeacbad..3b774575 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/'; diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 62708472..ea0f186b 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -159,26 +159,54 @@ class _BookSuccessState extends State { Widget _getQRButtons() { return Container( alignment: Alignment.bottomCenter, + margin: EdgeInsets.all(14), height: MediaQuery.of(context).size.height * 0.18, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: CustomTextButton( - backgroundColor: Color(0xFF60686b), - 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)), - ), + Row( + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: CustomTextButton( + backgroundColor: CustomColors.green, + elevation: 0, + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + getAppoQR(context); + }, + child: Text(TranslationBase.of(context).checkinOptions, style: TextStyle(fontSize: 18.0, color: Colors.white)), + ), + ), + ), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: CustomTextButton( + backgroundColor: Color(0xffc5272d), + elevation: 0, + onPressed: () { + navigateToHome(context); + // GifLoaderDialogUtils.showMyDialog(context); + // getAppoQR(context); + }, + child: Text(TranslationBase.of(context).done, style: TextStyle(fontSize: 18.0, color: Colors.white)), + ), + ), + ), + ], ), ], ), diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart index 96174828..1062eaf3 100644 --- a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -30,19 +30,19 @@ class BookedButtonsAllowCheckIn { { "title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, - "icon": "reminder_icon.png", + "icon": "assets/images/new-design/reminder_icon.png", "caller": "addReminder", }, { "title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, - "icon": "location_icon.png", + "icon": "assets/images/new-design/location_icon.png", "caller": "navigateToProject", }, { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, - "icon": "check-in.png", + "icon": "assets/images/new-design/check-in.png", "caller": "goToTodoList", } ]; diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index deee5a5e..76d89f82 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -92,6 +92,7 @@ class _AppointmentActionsState extends State { hasBadge: true, isEnable: !shouldEnable, imgColor: Color(0xff28323A), + isPngImage: appoButtonsList[index].icon.contains(".png") ? true : false, ), ); }, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 0c044e6b..eef268ab 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; +import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -17,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; @@ -36,6 +38,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -71,6 +74,7 @@ class LandingPage extends StatefulWidget { class _LandingPageState extends State with WidgetsBindingObserver { var authProvider = new AuthProvider(); + AppointmentRateViewModel appointmentRateViewModel = locator(); int currentTab = 0; PageController pageController; @@ -648,6 +652,25 @@ class _LandingPageState extends State with WidgetsBindingObserver { model.setState(model.count, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); + + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + // getToDoCount(), + // GifLoaderDialogUtils.hideDialog(AppGlobal.context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.push( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + ), + } + }) + .catchError((err) { + print(err); + }); } }), }); diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 73012bd5..12ee9ecb 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -42,8 +42,9 @@ import 'package:provider/provider.dart'; class ConfirmLogin extends StatefulWidget { final Function changePageViewIndex; final fromRegistration; - final bool isDubai; - const ConfirmLogin({Key key, this.changePageViewIndex, this.fromRegistration = false, this.isDubai =false}) : super(key: key); + final bool isDubai; + + const ConfirmLogin({Key key, this.changePageViewIndex, this.fromRegistration = false, this.isDubai = false}) : super(key: key); @override _ConfirmLogin createState() => _ConfirmLogin(); @@ -386,9 +387,9 @@ class _ConfirmLogin extends State { request.sMSSignature = await SMSOTP.getSignature(); GifLoaderDialogUtils.showMyDialog(context); if (healthId != null || widget.isDubai) { - if(!widget.isDubai){ - request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); - } + if (!widget.isDubai) { + request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); + } request.healthId = healthId; request.isHijri = isHijri; await this.authService.sendActivationCodeRegister(request).then((result) { @@ -568,7 +569,7 @@ class _ConfirmLogin extends State { var request = this.getCommonRequest().toJson(); dynamic res; if (healthId != null || widget.isDubai) { - if(!widget.isDubai) { + if (!widget.isDubai) { request['DOB'] = dob; } request['HealthId'] = healthId; @@ -583,7 +584,7 @@ class _ConfirmLogin extends State { result = CheckActivationCode.fromJson(result), if (this.registerd_data != null && this.registerd_data.isRegister == true) { - // if(widget.isDubai ==false){ + // if(widget.isDubai ==false){ widget.changePageViewIndex(1), Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), } @@ -694,36 +695,16 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - // getToDoCount(); + GifLoaderDialogUtils.hideDialog(context); - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - getToDoCount(), - GifLoaderDialogUtils.hideDialog(AppGlobal.context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - }, - insertIMEI() - }) - .catchError((err) { - print(err); - }); + getToDoCount(); + + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false); } loading(flag) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index adcc4820..107db2c3 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -345,34 +345,45 @@ class _Login extends State { authenticatedUserObject.user = result.list; projectViewModel.user = authenticatedUserObject.user; - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - getToDoCount(), - GifLoaderDialogUtils.hideDialog(context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - } - }) - .catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - }); + GifLoaderDialogUtils.hideDialog(context); + + getToDoCount(); + + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false); + + // appointmentRateViewModel + // .getIsLastAppointmentRatedList() + // .then((value) => { + // getToDoCount(), + // GifLoaderDialogUtils.hideDialog(context), + // if (appointmentRateViewModel.isHaveAppointmentNotRate) + // { + // Navigator.pushAndRemoveUntil( + // context, + // FadePage( + // page: RateAppointmentDoctor(), + // ), + // (r) => false) + // } + // else + // { + // Navigator.pushAndRemoveUntil( + // context, + // FadePage( + // page: LandingPage(), + // ), + // (r) => false) + // } + // }) + // .catchError((err) { + // print(err); + // GifLoaderDialogUtils.hideDialog(context); + // }); }); } diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index aac0a4d6..09b083cc 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -191,11 +191,17 @@ class _RateAppointmentClinicState extends State { child: DefaultButton( TranslationBase.of(context).later, () { - Navigator.pushReplacement( + // Navigator.pushReplacement( + // context, + // FadePage( + // page: LandingPage(), + // ), + // ); + Navigator.pop( + context, + ); + Navigator.pop( context, - FadePage( - page: LandingPage(), - ), ); }, color: CustomColors.accentColor, diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 08a597ab..5127dfa6 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -189,11 +189,11 @@ class _RateAppointmentDoctorState extends State { }); dialog.showAlertDialog(context); } else { - Navigator.pushReplacement( + Navigator.pop( context, - FadePage( - page: LandingPage(), - ), + // FadePage( + // page: LandingPage(), + // ), ); } }, diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 2c74a963..b8293e0f 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -44,10 +44,10 @@ class _SplashScreenState extends State { }, ); - AppSharedPreferences().getAll().then((value) { - debugPrint("ALL SHARED PREFERENCES!!!!!"); - debugPrint(jsonEncode(value)); - }); + // AppSharedPreferences().getAll().then((value) { + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + // }); } /// load the Privilege from service From 421bae2037d6a5f1754a83b6ec4316a115972930 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 5 Dec 2023 11:36:14 +0300 Subject: [PATCH 12/71] updates --- lib/config/config.dart | 4 +- lib/config/shared_pref_kay.dart | 1 + lib/core/model/rate/appoitment_rated.dart | 2 +- lib/core/service/client/base_app_client.dart | 2 +- lib/pages/landing/landing_page.dart | 52 +++++++++----------- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 3b774575..0eeacbad 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/'; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index ec82db11..f92841e3 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -43,3 +43,4 @@ const CLINICS_LIST = 'CLINICS_LIST'; const COVID_QA_LIST = 'COVID_QA_LIST'; const IS_COVID_CONSENT_SHOWN = 'IS_COVID_CONSENT_SHOWN'; const REGISTER_INFO_DUBAI ='register-info-dubai'; +const IS_LAST_APPOINTMENT_RATE_SHOWN ='is-last-appointment-rate-shown'; diff --git a/lib/core/model/rate/appoitment_rated.dart b/lib/core/model/rate/appoitment_rated.dart index 2f0d0dae..820e36a5 100644 --- a/lib/core/model/rate/appoitment_rated.dart +++ b/lib/core/model/rate/appoitment_rated.dart @@ -26,7 +26,7 @@ class AppoitmentRated { String arrivedOn; int editedBy; String editedOn; - String doctorName; + dynamic doctorName; String doctorNameN; String statusDesc; String statusDescN; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 8c9118c8..81fc2d6a 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -150,7 +150,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 1048710; //3844083 + // body['PatientID'] = 3183712; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index eef268ab..0ecdc0d4 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -645,35 +645,31 @@ class _LandingPageState extends State with WidgetsBindingObserver { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); - authService.getDashboard().then((value) => { - setState(() { - if (value != null) { - notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - model.setState(model.count, true, notificationCount); - sharedPref.setString(NOTIFICATION_COUNT, notificationCount); - FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); - - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - // getToDoCount(), - // GifLoaderDialogUtils.hideDialog(AppGlobal.context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.push( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - ), - } - }) - .catchError((err) { - print(err); - }); - } - }), + authService.getDashboard().then((value) async { + setState(() { + if (value != null) { + notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + model.setState(model.count, true, notificationCount); + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); + } + }); + if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) { + appointmentRateViewModel.getIsLastAppointmentRatedList().then((value) async { + if (appointmentRateViewModel.isHaveAppointmentNotRate) { + await AppSharedPreferences().setBool(IS_LAST_APPOINTMENT_RATE_SHOWN, true); + Navigator.push( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + ); + } + }).catchError((err) { + print(err); }); + } + }); } projectViewModel.analytics.setUser(data); } else { From 0a9aee0246c5af174ea41a93f3ba95e3fc85fe76 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 5 Dec 2023 14:47:56 +0300 Subject: [PATCH 13/71] updates --- lib/pages/landing/landing_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 0ecdc0d4..47dab9ba 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -640,7 +640,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { void checkUserStatus(token) async { await PushNotificationHandler.getInstance().isAndroidPermissionGranted(); - authService.selectDeviceImei(token).then((SelectDeviceIMEIRES value) => setUserValues(value)); + // authService.selectDeviceImei(token).then((SelectDeviceIMEIRES value) => setUserValues(value)); if (authenticatedUserObject.isLogin) { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { From c6c4f933b2c43ced4c964a11875cab70572fcd14 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 6 Dec 2023 09:56:57 +0300 Subject: [PATCH 14/71] Invoice Type param added in Labs & Rad --- lib/config/config.dart | 2 +- lib/config/localized_values.dart | 2 +- lib/core/model/labs/patient_lab_orders.dart | 16 +++++--- .../request_patient_lab_special_result.dart | 38 ++++++++++--------- .../labs/request_send_lab_report_email.dart | 4 ++ lib/core/model/radiology/final_radiology.dart | 18 +++++---- .../request_send_rad_report_email.dart | 4 ++ lib/core/service/client/base_app_client.dart | 2 +- lib/core/service/medical/labs_service.dart | 6 ++- .../service/medical/radiology_service.dart | 4 +- .../viewModels/medical/labs_view_model.dart | 3 +- .../medical/radiology_view_model.dart | 4 +- .../notification_details_page.dart | 28 +++++++++----- .../medical/labs/laboratory_result_page.dart | 1 + .../radiology/radiology_details_page.dart | 1 + 15 files changed, 86 insertions(+), 47 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 0eeacbad..4ae8f64d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -339,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.3; +var VERSION_ID = 11.4; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3f3074d3..ba17f2ec 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -791,7 +791,7 @@ const Map localizedValues = { "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, - "language-setting": {"en": "SMS and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة و الاتصال الآلي"}, + "language-setting": {"en": "SMS, WhatsApp and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة والواتس اب وتأكيد المكالمات"}, "alert": {"en": "Alerts", "ar": "التنبيهات"}, "email-alert": {"en": "Alert by Email", "ar": "استلام التنبيهات بالبريد الالكتروني"}, "sms-alert": {"en": "Alert by SMS", "ar": "استلام التنبيهات بالرسائل القصيرة"}, diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index c2908023..c58222e3 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -17,6 +17,7 @@ class PatientLabOrders { String genderDescription; String invoiceNo; String invoiceNo_VP; + String invoiceType; bool isActiveDoctorProfile; bool isDoctorAllowVedioCall; bool isExecludeDoctor; @@ -36,6 +37,7 @@ class PatientLabOrders { String setupID; List speciality; bool isLiveCareAppointment; + PatientLabOrders( {this.actualDoctorRate, this.clinicDescription, @@ -69,8 +71,10 @@ class PatientLabOrders { this.projectNameN, this.qR, this.setupID, - this.invoiceNo_VP, - this.speciality,this.isLiveCareAppointment}); + this.invoiceNo_VP, + this.invoiceType, + this.speciality, + this.isLiveCareAppointment}); PatientLabOrders.fromJson(Map json) { actualDoctorRate = json['ActualDoctorRate']; @@ -106,8 +110,9 @@ class PatientLabOrders { qR = json['QR']; setupID = json['SetupID']; invoiceNo_VP = json['invoiceNo_VP']; + invoiceType = json['InvoiceType']; isLiveCareAppointment = json['IsLiveCareAppointment']; - // speciality = json['Speciality'].cast(); + // speciality = json['Speciality'].cast(); } Map toJson() { @@ -146,7 +151,7 @@ class PatientLabOrders { data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; data['IsLiveCareAppointment'] = this.isLiveCareAppointment; - data['invoiceNo_VP'] =this.invoiceNo_VP; + data['invoiceNo_VP'] = this.invoiceNo_VP; return data; } } @@ -155,8 +160,7 @@ class PatientLabOrdersList { String filterName = ""; List patientLabOrdersList = List(); - PatientLabOrdersList( - {this.filterName, PatientLabOrders patientDoctorAppointment}) { + PatientLabOrdersList({this.filterName, PatientLabOrders patientDoctorAppointment}) { patientLabOrdersList.add(patientDoctorAppointment); } } diff --git a/lib/core/model/labs/request_patient_lab_special_result.dart b/lib/core/model/labs/request_patient_lab_special_result.dart index b3794e3c..795fa025 100644 --- a/lib/core/model/labs/request_patient_lab_special_result.dart +++ b/lib/core/model/labs/request_patient_lab_special_result.dart @@ -1,6 +1,7 @@ class RequestPatientLabSpecialResult { String invoiceNo; String invoiceNoVP; + String invoiceType; String orderNo; String setupID; String projectID; @@ -22,27 +23,29 @@ class RequestPatientLabSpecialResult { RequestPatientLabSpecialResult( {this.invoiceNo, this.invoiceNoVP, - this.orderNo, - this.setupID, - this.projectID, - this.clinicID, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.patientID, - this.tokenID, - this.patientTypeID, - this.patientType}); + this.invoiceType, + this.orderNo, + this.setupID, + this.projectID, + this.clinicID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); RequestPatientLabSpecialResult.fromJson(Map json) { invoiceNo = json['InvoiceNo']; invoiceNo = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; orderNo = json['OrderNo']; setupID = json['SetupID']; projectID = json['ProjectID']; @@ -66,6 +69,7 @@ class RequestPatientLabSpecialResult { final Map data = new Map(); data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNoVP; + data['InvoiceType'] = this.invoiceType; data['OrderNo'] = this.orderNo; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; diff --git a/lib/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart index 2188c500..41fa30f9 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -24,6 +24,7 @@ class RequestSendLabReportEmail { String projectID; String invoiceNo; String invoiceNoVP; + String invoiceType; String orderDate; String orderNo; bool isDownload; @@ -55,6 +56,7 @@ class RequestSendLabReportEmail { this.projectID, this.invoiceNo, this.invoiceNoVP, + this.invoiceType, this.orderDate, this.orderNo, this.isDownload, @@ -86,6 +88,7 @@ class RequestSendLabReportEmail { projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; invoiceNoVP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; orderDate = json['OrderDate']; orderNo = json['OrderNo']; isDownload = json['IsDownload']; @@ -119,6 +122,7 @@ class RequestSendLabReportEmail { data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNoVP; + data['InvoiceType'] = this.invoiceType; data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; data['IsDownload'] = this.isDownload; diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart index d92ffead..a600d0be 100644 --- a/lib/core/model/radiology/final_radiology.dart +++ b/lib/core/model/radiology/final_radiology.dart @@ -7,6 +7,7 @@ class FinalRadiology { int invoiceLineItemNo; int invoiceNo; dynamic invoiceNo_VP; + String invoiceType; int doctorID; int clinicID; DateTime orderDate; @@ -50,7 +51,8 @@ class FinalRadiology { this.patientID, this.invoiceLineItemNo, this.invoiceNo, - this.invoiceNo_VP, + this.invoiceNo_VP, + this.invoiceType, this.doctorID, this.clinicID, this.orderDate, @@ -85,7 +87,8 @@ class FinalRadiology { this.reportDataTextString, this.speciality, this.isCVI, - this.isRadMedicalReport,this.isLiveCareAppointment}); + this.isRadMedicalReport, + this.isLiveCareAppointment}); FinalRadiology.fromJson(Map json) { try { @@ -95,6 +98,7 @@ class FinalRadiology { invoiceLineItemNo = json['InvoiceLineItemNo']; invoiceNo = json['InvoiceNo']; invoiceNo_VP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; doctorID = json['DoctorID']; clinicID = json['ClinicID']; orderDate = DateUtil.convertStringToDate(json['OrderDate']); @@ -128,10 +132,9 @@ class FinalRadiology { isLiveCareAppointment = json['IsLiveCareAppointment']; reportDataHTML = json['ReportDataHTML']; reportDataTextString = json['ReportDataTextString']; - // speciality = json['Speciality'].cast(); + // speciality = json['Speciality'].cast(); isCVI = json['isCVI']; isRadMedicalReport = json['isRadMedicalReport']; - } catch (e) { print(e); } @@ -145,6 +148,7 @@ class FinalRadiology { data['InvoiceLineItemNo'] = this.invoiceLineItemNo; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNo_VP; + data['InvoiceType'] = this.invoiceType; data['DoctorID'] = this.doctorID; data['ClinicID'] = this.clinicID; data['OrderDate'] = this.orderDate; @@ -189,7 +193,7 @@ class FinalRadiologyList { List finalRadiologyList = List(); FinalRadiologyList({this.filterName, this.finalRadiologyList}); - // { - // finalRadiologyList.add(finalRadiology); - // } +// { +// finalRadiologyList.add(finalRadiology); +// } } diff --git a/lib/core/model/radiology/request_send_rad_report_email.dart b/lib/core/model/radiology/request_send_rad_report_email.dart index 6819de0d..1f3b7117 100644 --- a/lib/core/model/radiology/request_send_rad_report_email.dart +++ b/lib/core/model/radiology/request_send_rad_report_email.dart @@ -7,6 +7,7 @@ class RequestSendRadReportEmail { String generalid; int invoiceNo; int invoiceNo_VP; + String invoiceType; String iPAdress; bool isDentalAllowedBackend; int languageID; @@ -37,6 +38,7 @@ class RequestSendRadReportEmail { this.generalid, this.invoiceNo, this.invoiceNo_VP, + this.invoiceType, this.iPAdress, this.isDentalAllowedBackend, this.languageID, @@ -66,6 +68,7 @@ class RequestSendRadReportEmail { generalid = json['generalid']; invoiceNo = json['InvoiceNo']; invoiceNo_VP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; iPAdress = json['IPAdress']; isDentalAllowedBackend = json['isDentalAllowedBackend']; languageID = json['LanguageID']; @@ -98,6 +101,7 @@ class RequestSendRadReportEmail { data['generalid'] = this.generalid; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNo_VP; + data['InvoiceType'] = this.invoiceType; data['IPAdress'] = this.iPAdress; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['LanguageID'] = this.languageID; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 81fc2d6a..34a0a753 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -150,7 +150,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 3183712; //3844083 + // body['PatientID'] = 2941698; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index bee65b87..1d635c69 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -34,7 +34,7 @@ class LabsService extends BaseService { List labResultList = List(); List labOrdersResultsList = List(); - Future getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String orderNo, String setupID, bool isVidaPlus}) async { + Future getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String invoiceType, String orderNo, String setupID, bool isVidaPlus}) async { hasError = false; _requestPatientLabSpecialResult.projectID = projectID; _requestPatientLabSpecialResult.clinicID = clinicID; @@ -42,6 +42,8 @@ class LabsService extends BaseService { _requestPatientLabSpecialResult.invoiceNo = isVidaPlus ? "0" : invoiceNo; _requestPatientLabSpecialResult.invoiceNoVP = isVidaPlus ? invoiceNo : "0"; + _requestPatientLabSpecialResult.invoiceType = invoiceType; + _requestPatientLabSpecialResult.orderNo = orderNo; _requestPatientLabSpecialResult.setupID = setupID; @@ -61,6 +63,7 @@ class LabsService extends BaseService { Map body = Map(); body['InvoiceNo_VP'] = isVidaPlus ? patientLabOrder.invoiceNo : "0"; body['InvoiceNo'] = isVidaPlus ? "0" : patientLabOrder.invoiceNo; + body['InvoiceType'] = patientLabOrder.invoiceType; body['OrderNo'] = patientLabOrder.orderNo; body['isDentalAllowedBackend'] = false; body['SetupID'] = patientLabOrder.setupID; @@ -205,6 +208,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.projectID = patientLabOrder.projectID; _requestSendLabReportEmail.invoiceNo = isVidaPlus ? "0" : patientLabOrder.invoiceNo; _requestSendLabReportEmail.invoiceNoVP = isVidaPlus ? patientLabOrder.invoiceNo : "0"; + _requestSendLabReportEmail.invoiceType = patientLabOrder.invoiceType; _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; _requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription; _requestSendLabReportEmail.patientName = userObj.firstName + " " + userObj.lastName; diff --git a/lib/core/service/medical/radiology_service.dart b/lib/core/service/medical/radiology_service.dart index f2a54c0c..68822085 100644 --- a/lib/core/service/medical/radiology_service.dart +++ b/lib/core/service/medical/radiology_service.dart @@ -10,13 +10,14 @@ class RadiologyService extends BaseService { bool isRadiologyVIDAPlus = false; - Future getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus}) async { + Future getRadImageURL({int invoiceNo, String invoiceType, int lineItem, int projectId, bool isVidaPlus}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = isVidaPlus ? "0" : invoiceNo; body['InvoiceNo_VP'] = isVidaPlus ? invoiceNo : "0"; body['LineItemNo'] = lineItem; body['ProjectID'] = projectId; + body['InvoiceType'] = invoiceType; await baseAppClient.post(GET_RAD_IMAGE_URL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) { url = response['Data']; @@ -79,6 +80,7 @@ class RadiologyService extends BaseService { _requestSendRadReportEmail.radResult = finalRadiology.reportData; _requestSendRadReportEmail.to = userObj.emailAddress; _requestSendRadReportEmail.dateofBirth = userObj.dateofBirth; + _requestSendRadReportEmail.invoiceType = finalRadiology.invoiceType; hasError = false; await baseAppClient.post(SEND_RAD_REPORT_EMAIL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index ca577ac6..b75dafad 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -74,9 +74,10 @@ class LabsViewModel extends BaseViewModel { List labResultLists = List(); - getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String orderNo, String setupID, bool isVidaPlus}) async { + getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String invoiceType, String orderNo, String setupID, bool isVidaPlus}) async { setState(ViewState.Busy); await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, + invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, diff --git a/lib/core/viewModels/medical/radiology_view_model.dart b/lib/core/viewModels/medical/radiology_view_model.dart index 3ee6fedf..ddffd50b 100644 --- a/lib/core/viewModels/medical/radiology_view_model.dart +++ b/lib/core/viewModels/medical/radiology_view_model.dart @@ -48,9 +48,9 @@ class RadiologyViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL({int invoiceNo, int lineItem, int projectId, bool isVidaPlus}) async { + getRadImageURL({int invoiceNo, String invoiceType, int lineItem, int projectId, bool isVidaPlus}) async { setState(ViewState.Busy); - await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus); + await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, invoiceType: invoiceType, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 65547b39..e32a234c 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -79,6 +79,16 @@ class _NotificationsDetailsPageState extends State { letterSpacing: -0.64, ), ), + SizedBox(height: 18), + Text( + widget.notification.message.trim(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, + ), + ), if (widget.notification.notificationType == "2") Padding( padding: const EdgeInsets.only(top: 18), @@ -103,15 +113,15 @@ class _NotificationsDetailsPageState extends State { }, fit: BoxFit.fill), ), SizedBox(height: 18), - Text( - widget.notification.message.trim(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff575757), - letterSpacing: -0.48, - ), - ), + // Text( + // widget.notification.message.trim(), + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xff575757), + // letterSpacing: -0.48, + // ), + // ), ], ), ); diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index d5bb9035..43254265 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -35,6 +35,7 @@ class _LaboratoryResultPageState extends State { return BaseView( onModelReady: (model) => model.getLaboratoryResult( invoiceNo: widget.patientLabOrders.invoiceNo, + invoiceType: widget.patientLabOrders.invoiceType, clinicID: widget.patientLabOrders.clinicID, projectID: widget.patientLabOrders.projectID, orderNo: widget.patientLabOrders.orderNo, diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 7e609370..55f156cb 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -28,6 +28,7 @@ class RadiologyDetailsPage extends StatelessWidget { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getRadImageURL( + invoiceType: finalRadiology.invoiceType, projectId: finalRadiology.projectID, lineItem: finalRadiology.invoiceLineItemNo, invoiceNo: Utils.isVidaPlusProject(projectViewModel, finalRadiology.projectID) ? finalRadiology.invoiceNo_VP : finalRadiology.invoiceNo, From eef6f78fd6681c5588ad15334d4b2130f8d84423 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 6 Dec 2023 11:03:59 +0300 Subject: [PATCH 15/71] Updates --- lib/pages/MyAppointments/MyAppointments.dart | 22 +++++++++++++++++++- lib/pages/ToDoList/ToDo.dart | 15 ++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 533bd6e6..31b8f85b 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -5,8 +5,10 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -52,6 +54,8 @@ class _MyAppointmentsState extends State with SingleTickerProvid int _currentPage = 0; + ToDoCountProviderModel toDoProvider; + @override void initState() { filterType = FilterType.Clinic; @@ -72,6 +76,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid @override Widget build(BuildContext context) { + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).myAppointmentsList, isShowAppBar: true, @@ -168,6 +173,19 @@ class _MyAppointmentsState extends State with SingleTickerProvid print(err); AppToast.showErrorToast(message: err); }); + getToDoCount(); + } + + getToDoCount() { + toDoProvider.setState(0, true, "0"); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + } else {} + }).catchError((err) { + print(err); + }); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { @@ -379,7 +397,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate), isSortByClinic: _isSortByClinic, rating: _appointmentResult.actualDoctorRate + 0.0, - appointmentTime: _appointmentResult.isLiveCareAppointment ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime.substring(0, 5), + appointmentTime: _appointmentResult.isLiveCareAppointment + ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate).toString().split(" ")[1].substring(0, 5) + : _appointmentResult.startTime.substring(0, 5), // appointmentTime: _appointmentResult.startTime.substring(0, 5), remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) ? _appointmentResult.remaniningHoursTocanPay diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index c4e4bcb9..4253fcd8 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -20,6 +20,7 @@ import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.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/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -854,7 +855,19 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.hideDialog(context); err != null ?? AppToast.showErrorToast(message: err); }); - // getAncillaryOrders(); + getToDoCount(); + } + + getToDoCount() { + toDoProvider.setState(0, true, "0"); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + } else {} + }).catchError((err) { + print(err); + }); } checkPatientNphiesEligibility(context, AppoitmentAllHistoryResultList appo) { From 80167378d9f3fecd81f9061105731885bdeb4fc2 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 6 Dec 2023 15:42:21 +0300 Subject: [PATCH 16/71] lat long fixes --- lib/core/service/client/base_app_client.dart | 13 ++++++++++--- lib/splashPage.dart | 9 ++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 34a0a753..a397a928 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -79,8 +79,11 @@ class BaseAppClient { body['generalid'] = GENERAL_ID; // body['isVidaPlus'] = true; - body['Latitude'] = await AppSharedPreferences().getDouble(USER_LAT); - body['Longitude'] = await AppSharedPreferences().getDouble(USER_LONG); + double lat = await AppSharedPreferences().getDouble(USER_LAT); + double long = await AppSharedPreferences().getDouble(USER_LONG); + + body['Latitude'] = lat == null ? 0.0 : lat; + body['Longitude'] = long == null ? 0.0 : long; if (body.containsKey('isDentalAllowedBackend')) { body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') @@ -90,7 +93,11 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isIOS ? 1 : await Utils.isGoogleServicesAvailable() ? 2 : 3; + body['DeviceTypeID'] = Platform.isIOS + ? 1 + : await Utils.isGoogleServicesAvailable() + ? 2 + : 3; if (!body.containsKey('IsPublicRequest')) { // if (!body.containsKey('PatientType')) { diff --git a/lib/splashPage.dart b/lib/splashPage.dart index b8293e0f..290bbac0 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -43,11 +43,6 @@ class _SplashScreenState extends State { }); }, ); - - // AppSharedPreferences().getAll().then((value) { - // debugPrint("ALL SHARED PREFERENCES!!!!!"); - // debugPrint(jsonEncode(value)); - // }); } /// load the Privilege from service @@ -63,6 +58,10 @@ class _SplashScreenState extends State { var themeNotifier = Provider.of(context, listen: false); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); PushNotificationHandler(context).init(); // Asyncronously + AppSharedPreferences().getAll().then((value) { + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + }); } @override From 01db5408c945449152fad23951d232b4f1fa2b44 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 10 Dec 2023 11:48:40 +0300 Subject: [PATCH 17/71] fixes --- lib/config/config.dart | 4 ++-- lib/pages/ToDoList/ToDo.dart | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4ae8f64d..e604cdfd 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/'; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 4253fcd8..7e647fab 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -52,7 +52,6 @@ class ToDo extends StatefulWidget { List ancillaryLists = []; List obGyneAppoList = []; var languageID; - MyInAppBrowser browser; bool isShowAppBar = true; Function onBackClick; @@ -85,6 +84,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isInsured = false; bool isEligible = false; bool isCash = false; + MyInAppBrowser browser; @override void initState() { @@ -1051,9 +1051,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { - widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - widget.browser.openPaymentBrowser( + browser.openPaymentBrowser( amount, "Appointment check in", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), @@ -1064,7 +1064,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - widget.browser, + browser, appo.isLiveCareAppointment, "2", appo.isLiveCareAppointment ? widget.patientShareResponse.clinicID.toString() : "", @@ -1095,7 +1095,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { // if(selectedPaymentMethod != "TAMARA") { MyInAppBrowser.successURLS.forEach((element) { if (url.contains(element)) { - if (widget.browser.isOpened()) widget.browser.close(); + browser.close(); MyInAppBrowser.isPaymentDone = true; return; } @@ -1105,7 +1105,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { // if(selectedPaymentMethod != "TAMARA") { MyInAppBrowser.errorURLS.forEach((element) { if (url.contains(element)) { - if (widget.browser.isOpened()) widget.browser.close(); + browser.close(); MyInAppBrowser.isPaymentDone = false; return; } From 47779f6fa72c16d4ddb064d1a909157df3b57027 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 14 Dec 2023 10:47:43 +0300 Subject: [PATCH 18/71] last appointment rating fixed --- .../medical/ask_doctor/request_type.dart | 3 ++- .../rate_appointment_doctor.dart | 25 ++++++++++++++----- lib/uitl/push-notification-handler.dart | 8 +++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 4c21e826..bb868e7b 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -27,7 +27,8 @@ class _RequestTypePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getQuestionTypes(), + // onModelReady: (model) => model.getQuestionTypes(), + onModelReady: (model) => model.getCallRequestTypeLOVs(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 5127dfa6..aa49d15a 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class RateAppointmentDoctor extends StatefulWidget { @@ -30,9 +32,11 @@ class _RateAppointmentDoctorState extends State { final formKey = GlobalKey(); String note = ""; int rating = 0; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -189,12 +193,21 @@ class _RateAppointmentDoctorState extends State { }); dialog.showAlertDialog(context); } else { - Navigator.pop( - context, - // FadePage( - // page: LandingPage(), - // ), - ); + if(projectViewModel.isLoginChild) { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + } else { + Navigator.pop( + context, + // FadePage( + // page: LandingPage(), + // ), + ); + } } }, color: CustomColors.accentColor, diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 03e6ec29..c66a8215 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -303,9 +303,11 @@ class PushNotificationHandler { onToken(token); }); - FirebaseMessaging.instance.getAPNSToken().then((value) { - print("Push APNS getToken: " + value); - }); + if(Platform.isIOS) { + FirebaseMessaging.instance.getAPNSToken().then((value) { + print("Push APNS getToken: " + value); + }); + } FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); } From 165f3fb9f6bc2fae740db650ba728fd27ec4731b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Fri, 15 Dec 2023 15:36:21 +0300 Subject: [PATCH 19/71] NFC Check removed for appo checkin --- lib/pages/ToDoList/ToDo.dart | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 7e647fab..30c043e5 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -989,23 +989,23 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { patientShareResponse.projectID = appo.projectID; patientShareResponse.isFollowup = appo.isFollowup; - FlutterNfcKit.nfcAvailability.then((value) { - if (value == NFCAvailability.available) { - PatientShareResponse patientShareResponse = new PatientShareResponse(); - patientShareResponse.doctorNameObj = appo.doctorNameObj; - patientShareResponse.doctorSpeciality = appo.doctorSpeciality; - patientShareResponse.projectName = appo.projectName; - patientShareResponse.appointmentDate = appo.appointmentDate; - patientShareResponse.appointmentNo = appo.appointmentNo; - patientShareResponse.clinicID = appo.clinicID; - patientShareResponse.projectID = appo.projectID; - patientShareResponse.isFollowup = appo.isFollowup; - navigateToQR(context, "", patientShareResponse, appo); - projectViewModel.analytics.todoList.to_do_list_check_in(appo); - } else { - Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); - } - }); + // FlutterNfcKit.nfcAvailability.then((value) { + // if (value == NFCAvailability.available) { + // PatientShareResponse patientShareResponse = new PatientShareResponse(); + patientShareResponse.doctorNameObj = appo.doctorNameObj; + patientShareResponse.doctorSpeciality = appo.doctorSpeciality; + patientShareResponse.projectName = appo.projectName; + patientShareResponse.appointmentDate = appo.appointmentDate; + patientShareResponse.appointmentNo = appo.appointmentNo; + patientShareResponse.clinicID = appo.clinicID; + patientShareResponse.projectID = appo.projectID; + patientShareResponse.isFollowup = appo.isFollowup; + navigateToQR(context, "", patientShareResponse, appo); + projectViewModel.analytics.todoList.to_do_list_check_in(appo); + // } else { + // Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); + // } + // }); projectViewModel.analytics.todoList.to_do_list_check_in(appo); DoctorsListService service = new DoctorsListService(); From 264aed70a05f85346a6f986b1f92c5ef5bc11c67 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 17 Dec 2023 13:48:00 +0300 Subject: [PATCH 20/71] NFC Check added --- lib/pages/BookAppointment/QRCode.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 2c2cc83d..3b7e6300 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -62,13 +62,9 @@ class _QRCodeState extends State { // _bytes = base64.decode(widget.appoQR.split(',').last); widget.authUser = new AuthenticatedUser(); - FlutterNfcKit.nfcAvailability.then((value) { - _supportsNFC = (value == NFCAvailability.available); - }); - - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { // startNFCScan(); - }); + // }); super.initState(); } @@ -113,6 +109,9 @@ class _QRCodeState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); _context = context; + FlutterNfcKit.nfcAvailability.then((value) { + _supportsNFC = (value == NFCAvailability.available); + }); List checkInOptionsList = getCheckInOptionsList(context); return AppScaffold( appBarTitle: TranslationBase.of(context).onlineCheckIn, @@ -214,8 +213,10 @@ class _QRCodeState extends State { optionsList.add( InkWell( onTap: () { - if (projectViewModel.havePrivilege(80)) { + if (projectViewModel.havePrivilege(80) && _supportsNFC) { startNFCScan(); + } else { + Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); } }, child: MedicalProfileItem( From cfd8b5e8a5f9cb57b4e6219583034ffca490e02e Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 18 Dec 2023 09:26:40 +0300 Subject: [PATCH 21/71] Language ID Changes --- lib/core/service/client/base_app_client.dart | 10 +++++++++- lib/core/service/privilege_service.dart | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a397a928..3f1ce94c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -73,7 +73,15 @@ class BaseAppClient { body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; - body['LanguageID'] = (languageID == 'ar' ? 1 : 2); + + if (body.containsKey('LanguageID')) { + body['LanguageID'] = body['LanguageID']; + } else { + // body['LanguageID'] = (languageID.toString().toLowerCase() == 'ar' ? 1 : 2); + body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; + } + + // body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart index ab0cee97..799764f6 100644 --- a/lib/core/service/privilege_service.dart +++ b/lib/core/service/privilege_service.dart @@ -14,6 +14,7 @@ class PrivilegeService extends BaseService { Future getPrivilege() async { Map body = Map(); body['PatientType'] = 4; + body['LanguageID'] = 1; await baseAppClient.post(GET_PRIVILEGE, onSuccess: (dynamic response, int statusCode) { response['ServicePrivilegeList'].forEach((item) { privilegeModelList.add(PrivilegeModel.fromJson(item)); From bcfeff2661ea7ef58ec9ee39b7b1be861bc641fa Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 18 Dec 2023 09:51:51 +0300 Subject: [PATCH 22/71] updates --- lib/services/authentication/auth_provider.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index d61e8ef7..a629df89 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -155,6 +155,7 @@ class AuthProvider with ChangeNotifier { dynamic localRes; Map request = {}; request['IMEI'] = imei; + request['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; await new BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { localRes = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); }, onFailure: (String error, int statusCode) { From a9d4cb2fd8c2d8c4796d3c26ff1c9ace0dc8ea97 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 18 Dec 2023 10:47:08 +0300 Subject: [PATCH 23/71] InApp Browser Update --- lib/widgets/in_app_browser/InAppBrowser.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f38ad57c..f3a277fe 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -27,7 +27,12 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( ios: IOSInAppWebViewOptions(applePayAPIEnabled: true, isFraudulentWebsiteWarningEnabled: false)), crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), android: AndroidInAppBrowserOptions(), - ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); + ios: IOSInAppBrowserOptions( + hideToolbarBottom: true, + toolbarBottomBackgroundColor: Colors.white, + closeButtonColor: Colors.white, + closeButtonCaption: "Close", + presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; @@ -176,8 +181,8 @@ class MyInAppBrowser extends InAppBrowser { service.applePayInsertRequest(applePayInsertRequest, context).then((res) { if (context != null) GifLoaderDialogUtils.hideDialog(context); - String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod - // String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT + // String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod + String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT // safariBrowser.open(url: Uri.parse(url)); this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); }).catchError((err) { From 724a26ca682e90fe6b05186305ad3e4ac280cacd Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 18 Dec 2023 12:29:09 +0300 Subject: [PATCH 24/71] Updates --- lib/config/config.dart | 6 +++--- lib/core/service/client/base_app_client.dart | 8 ++++++-- .../Authentication/check_activation_code_request.dart | 8 ++++---- lib/services/appointment_services/GetDoctorsList.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e604cdfd..b399fa00 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,9 +19,9 @@ var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; 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 = 'http://10.20.200.111:1010/'; + // 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/'; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 3f1ce94c..8921d5f9 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -75,7 +75,11 @@ class BaseAppClient { body['Channel'] = CHANNEL; if (body.containsKey('LanguageID')) { - body['LanguageID'] = body['LanguageID']; + if(body['LanguageID'] != null) { + body['LanguageID'] = body['LanguageID']; + } else { + body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; + } } else { // body['LanguageID'] = (languageID.toString().toLowerCase() == 'ar' ? 1 : 2); body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; @@ -165,7 +169,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 2941698; //3844083 + // body['PatientID'] = 1231755; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/models/Authentication/check_activation_code_request.dart b/lib/models/Authentication/check_activation_code_request.dart index f6509f3b..7113dd6d 100644 --- a/lib/models/Authentication/check_activation_code_request.dart +++ b/lib/models/Authentication/check_activation_code_request.dart @@ -15,7 +15,7 @@ class CheckActivationCodeReq { bool isSilentLogin; double versionID; int channel; - int languageID; + // int languageID; String iPAdress; String generalid; int patientOutSA; @@ -41,7 +41,7 @@ class CheckActivationCodeReq { this.isSilentLogin, this.versionID, this.channel, - this.languageID, + // this.languageID, this.iPAdress, this.generalid, this.patientOutSA, @@ -68,7 +68,7 @@ class CheckActivationCodeReq { isSilentLogin = json['IsSilentLogin']; versionID = json['VersionID']; channel = json['Channel']; - languageID = json['LanguageID']; + // languageID = json['LanguageID']; iPAdress = json['IPAdress']; generalid = json['generalid']; patientOutSA = json['PatientOutSA']; @@ -96,7 +96,7 @@ class CheckActivationCodeReq { data['IsSilentLogin'] = this.isSilentLogin; data['VersionID'] = this.versionID; data['Channel'] = this.channel; - data['LanguageID'] = this.languageID; + // data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; data['PatientOutSA'] = this.patientOutSA; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index a7482eaa..224f36f2 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1165,6 +1165,7 @@ class DoctorsListService extends BaseService { "ProjectID": appo.projectID, "SetupID": appo.setupID, "DoctorID": appo.doctorID, + "ClinicID": appo.clinicID, "RequestType": requestType, "RequestTypeID": requestType, "PatientMobileNumber": authUser.mobileNumber, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f3a277fe..f6b54dac 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -284,7 +284,7 @@ class MyInAppBrowser extends InAppBrowser { Platform.isIOS ? form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)) - : form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + : form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN) ?? ""); // form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)); // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); From f7dffea2ebf4db277116a3ffe8c67694d5712fe8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 18 Dec 2023 13:59:52 +0300 Subject: [PATCH 25/71] Language ID fixes --- lib/config/config.dart | 2 +- .../GetAllSharedRecordsByStatusReq.dart | 8 ++++---- lib/pages/MyAppointments/AppointmentDetails.dart | 14 +++++++++----- .../clinic_services/get_clinic_service.dart | 5 +++++ lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index b399fa00..f0dd61b1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -339,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.4; +var VERSION_ID = 11.5; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart b/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart index ac0adc34..5313a7c7 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart @@ -1,7 +1,7 @@ class GetAllSharedRecordsByStatusReq { double versionID; int channel; - int languageID; + // int languageID; String iPAdress; String generalid; int patientOutSA; @@ -17,7 +17,7 @@ class GetAllSharedRecordsByStatusReq { GetAllSharedRecordsByStatusReq( {this.versionID, this.channel, - this.languageID, + // this.languageID, this.iPAdress, this.generalid, this.patientOutSA, @@ -33,7 +33,7 @@ class GetAllSharedRecordsByStatusReq { GetAllSharedRecordsByStatusReq.fromJson(Map json) { versionID = json['VersionID']; channel = json['Channel']; - languageID = json['LanguageID']; + // languageID = json['LanguageID']; iPAdress = json['IPAdress']; generalid = json['generalid']; patientOutSA = json['PatientOutSA']; @@ -51,7 +51,7 @@ class GetAllSharedRecordsByStatusReq { final Map data = new Map(); data['VersionID'] = this.versionID; data['Channel'] = this.channel; - data['LanguageID'] = this.languageID; + // data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; data['PatientOutSA'] = this.patientOutSA; diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 2a4c9386..ceee266b 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -592,12 +592,16 @@ class _AppointmentDetailsState extends State with SingleTick 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); + try { + 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); + }); }); - }); + } catch (ex) { + print(ex); + } } cancelAppointment() { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index ce9d511f..469ac404 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -36,6 +36,7 @@ class ClinicListService extends BaseService { request = { "IsActiveAppointment": true, + "LanguageID": 1 }; dynamic localRes; @@ -51,6 +52,10 @@ class ClinicListService extends BaseService { Future getProjectsList(context) async { Map request = {}; + request = { + "LanguageID": null + }; + dynamic localRes; await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f6b54dac..c9fecbf9 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -181,8 +181,8 @@ class MyInAppBrowser extends InAppBrowser { service.applePayInsertRequest(applePayInsertRequest, context).then((res) { if (context != null) GifLoaderDialogUtils.hideDialog(context); - // String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod - String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT + String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod + // String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT // safariBrowser.open(url: Uri.parse(url)); this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); }).catchError((err) { From b769959823db5efea6d37a52645a8cede28079ad Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Tue, 19 Dec 2023 10:10:05 +0300 Subject: [PATCH 26/71] Revert "changes to build app" This reverts commit 1492efde --- android/app/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/build.gradle | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 10 ++++----- pubspec.yaml | 22 +++++++++---------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index a1387dd3..965934fd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -75,7 +75,7 @@ android { buildTypes { debug { debuggable true - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } release { debuggable false diff --git a/android/app/gradle/wrapper/gradle-wrapper.properties b/android/app/gradle/wrapper/gradle-wrapper.properties index dd658e01..a2c20300 100644 --- a/android/app/gradle/wrapper/gradle-wrapper.properties +++ b/android/app/gradle/wrapper/gradle-wrapper.properties @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/android/build.gradle b/android/build.gradle index 4ee80e4c..e723adba 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.8.20' + ext.kotlin_version = '1.7.20' repositories { google() jcenter() diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index dad9e879..e71a4266 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -50,7 +50,7 @@ import 'package:flutter/services.dart'; // import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; import 'package:flutter_svg/flutter_svg.dart'; -// import 'package:in_app_review/in_app_review.dart'; +import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -64,7 +64,7 @@ class AppDrawer extends StatefulWidget { } class _AppDrawerState extends State { - // final InAppReview _inAppReview = InAppReview.instance; + final InAppReview _inAppReview = InAppReview.instance; @override void initState() { @@ -737,9 +737,9 @@ class _AppDrawerState extends State { } openAppReviewDialog() async { - // if (await _inAppReview.isAvailable()) { - // _inAppReview.requestReview(); - // } + if (await _inAppReview.isAvailable()) { + _inAppReview.requestReview(); + } } void setUserValues(value) async { diff --git a/pubspec.yaml b/pubspec.yaml index 2494a580..235254f9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.73+1 +version: 4.5.028+4050028 environment: sdk: ">=2.7.0 <3.0.0" @@ -57,8 +57,8 @@ dependencies: shared_preferences: ^2.0.0 # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 - firebase_messaging: 14.1.0 - firebase_analytics: 10.0.5 + firebase_messaging: ^14.1.0 + firebase_analytics: ^10.0.5 # Progress bar @@ -100,7 +100,7 @@ dependencies: location: ^4.3.0 # Qr code Scanner # barcode_scan_fix: ^1.0.2 - barcode_scan2: 4.2.2 + barcode_scan2: ^4.2.2 # Rating Stars rating_bar: ^0.2.0 @@ -132,17 +132,17 @@ dependencies: carousel_pro: ^1.0.0 #local_notifications - flutter_local_notifications: 10.0.0 + flutter_local_notifications: any #device_calendar device_calendar: ^4.2.0 # TEMPORAL FIX for https://github.com/builttoroam/device_calendar/issues/507 # device_calendar: ^4.3.1 - # device_calendar: - # git: - # url: https://github.com/builttoroam/device_calendar.git - # ref: develop +# device_calendar: +# git: +# url: https://github.com/builttoroam/device_calendar.git +# ref: develop #Handle Geolocation geolocator: ^9.0.2 @@ -178,7 +178,7 @@ dependencies: wifi: ^0.1.5 vibration: ^1.7.3 - flutter_nfc_kit: 3.3.1 + flutter_nfc_kit: ^3.3.1 geofencing: ^0.1.0 @@ -187,7 +187,7 @@ dependencies: in_app_update: ^3.0.0 - in_app_review: 2.0.3 + in_app_review: ^2.0.3 badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 From 2008ccf92c836681ce82b3fc7a3e75363b79a23b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 19 Dec 2023 10:41:19 +0300 Subject: [PATCH 27/71] updates --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 02d0d9b7..c3e46b58 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.63; + MARKETING_VERSION = 4.5.75; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.63; + MARKETING_VERSION = 4.5.75; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.63; + MARKETING_VERSION = 4.5.75; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/pubspec.yaml b/pubspec.yaml index 2494a580..2b657883 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.73+1 +version: 4.5.75+1 environment: sdk: ">=2.7.0 <3.0.0" From ccb9e93d629acf1c3b417c70d768145857c4479e Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Tue, 19 Dec 2023 10:41:28 +0300 Subject: [PATCH 28/71] Added InAppApple Pay with PayFort --- lib/config/config.dart | 9 ++ lib/core/enum/PayfortEnums.dart | 44 ++++++ lib/locator.dart | 4 + lib/main.dart | 8 +- lib/pages/landing/landing_page.dart | 4 + .../medical/balance/confirm_payment_page.dart | 82 +++++++++- .../payfort_project_details_resp_model.dart | 36 +++++ .../payfort_services/payfort_service.dart | 140 ++++++++++++++++++ .../payfort_services/payfort_view_model.dart | 68 +++++++++ .../sdk_token_response_model.dart | 55 +++++++ pubspec.yaml | 2 + 11 files changed, 443 insertions(+), 9 deletions(-) create mode 100644 lib/core/enum/PayfortEnums.dart create mode 100644 lib/services/payfort_services/payfort_project_details_resp_model.dart create mode 100644 lib/services/payfort_services/payfort_service.dart create mode 100644 lib/services/payfort_services/payfort_view_model.dart create mode 100644 lib/services/payfort_services/sdk_token_response_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index f0dd61b1..26dda9d2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:amazon_payfort/amazon_payfort.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -620,6 +621,14 @@ var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity'; var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany'; + + +//PAYFORT +var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; +var payFortEnvironment = FortEnvironment.test; +var applePayMerchantId = "merchant.com.hmgwebservices.uat"; + + class AppGlobal { static var context; diff --git a/lib/core/enum/PayfortEnums.dart b/lib/core/enum/PayfortEnums.dart new file mode 100644 index 00000000..2951eed8 --- /dev/null +++ b/lib/core/enum/PayfortEnums.dart @@ -0,0 +1,44 @@ +enum ServiceTypeEnum { + advancePayment, //3 + ancillaryOrder, //3 + appointmentPayment, //2 + covidPayment, //2 + erOnlineCheckIn, //3 + liveCareAppointment //4 +} + +extension ServiceTypeEnumExt on ServiceTypeEnum { + String value() { + switch (this) { + case ServiceTypeEnum.advancePayment: + return "Advance Payment"; + case ServiceTypeEnum.ancillaryOrder: + return "Ancillary Order"; + case ServiceTypeEnum.appointmentPayment: + return "Appointment Payment"; + case ServiceTypeEnum.covidPayment: + return "Covid Payment"; + case ServiceTypeEnum.erOnlineCheckIn: + return "ER Online Check In"; + case ServiceTypeEnum.liveCareAppointment: + return "LiveCare Appointment"; + } + } + + int getIdFromServiceEnum() { + switch (this) { + case ServiceTypeEnum.advancePayment: + return 3; + case ServiceTypeEnum.ancillaryOrder: + return 3; + case ServiceTypeEnum.appointmentPayment: + return 2; + case ServiceTypeEnum.covidPayment: + return 2; + case ServiceTypeEnum.erOnlineCheckIn: + return 3; + case ServiceTypeEnum.liveCareAppointment: + return 4; + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index ec696865..61ed983b 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -13,6 +13,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddr import 'package:diplomaticquarterapp/core/viewModels/product_categories_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_service.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; @@ -202,6 +204,7 @@ void setupLocator() { locator.registerLazySingleton(() => VaccinationTableService()); locator.registerLazySingleton(() => AncillaryOrdersService()); locator.registerLazySingleton(() => EdOnlineServices()); + locator.registerLazySingleton(() => PayfortService()); //pharmacy // locator.registerLazySingleton(() => PharmacyCategoriseService()); @@ -309,6 +312,7 @@ void setupLocator() { locator.registerFactory(() => BestSellerViewModel()); locator.registerFactory(() => LastVisitedViewModel()); locator.registerFactory(() => MostViewedViewModel()); + locator.registerFactory(() => PayfortViewModel()); // Offer And Packages //---------------------- diff --git a/lib/main.dart b/lib/main.dart index 4f6e43f6..4be8957b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; @@ -118,12 +119,15 @@ class _MyApp extends State { ), ChangeNotifierProvider(create: (context) => CompareList()), ChangeNotifierProvider(create: (context) => OrderPreviewViewModel()), + ChangeNotifierProvider(create: (context) => PayfortViewModel()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( - builder: (BuildContext context, Widget child) { + builder: (BuildContext context, Widget child) { return MediaQuery( - data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0,), //set desired text scale factor here + data: MediaQuery.of(context).copyWith( + textScaleFactor: 1.0, + ), //set desired text scale factor here child: child, ); }, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 47dab9ba..6c2b5f6e 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -24,6 +24,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; @@ -302,6 +303,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { } }); + PayfortViewModel payfortViewModel = context.read(); + payfortViewModel.initPayfort(); + // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] // for now commented to reduce this call will enable it when needed // HMGNetworkConnectivity(context).start(); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 0697ea75..d60b199c 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -1,5 +1,8 @@ +import 'dart:developer'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; @@ -7,11 +10,14 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; import 'package:diplomaticquarterapp/models/apple_pay_response.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -24,12 +30,10 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; - -// import 'package:pay/pay.dart'; import 'package:provider/provider.dart'; - import 'new_text_Field.dart'; + class ConfirmPaymentPage extends StatefulWidget { final AdvanceModel advanceModel; final PatientInfoAndMobileNumber patientInfoAndMobileNumber; @@ -214,9 +218,73 @@ class _ConfirmPaymentPageState extends State { padding: EdgeInsets.all(20), child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), - () { + () async { if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); + if (widget.selectedPaymentMethod == "ApplePay") { + transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = 0; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = 0; + applePayInsertRequest.projectID = widget.advanceModel.hospitalsModel.iD.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = null; + applePayInsertRequest.appointmentNo = 0; + applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = widget.advanceModel.amount.toString(); + applePayInsertRequest.isSchedule = "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + GifLoaderDialogUtils.hideDialog(context); + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Advance Payment", + orderAmount: double.parse(widget.advanceModel.amount), + merchantReference: transID, + onFailed: (failureResult) { + log("failureResult: ${failureResult.toString()}"); + + }, + onSuccess: (successResult) { + log("Payfort: ${successResult.responseMessage}"); + checkPaymentStatus(AppoitmentAllHistoryResultList()); + }, + projectId: widget.advanceModel.hospitalsModel.iD, + // projectId: 95, + serviceTypeEnum: ServiceTypeEnum.advancePayment, + ); + }).catchError((err) { + print(err); + if (context = null) GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } else { + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); + } } else { GifLoaderDialogUtils.showMyDialog(context); model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { @@ -231,7 +299,7 @@ class _ConfirmPaymentPageState extends State { // GifLoaderDialogUtils.showMyDialog(context); // model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { // GifLoaderDialogUtils.hideDialog(context); - // if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model); + // if (model.state = ViewState.ErrorLocal && model.state = ViewState.Error) showSMSDialog(model); // }); }, ), @@ -410,7 +478,7 @@ class _ConfirmPaymentPageState extends State { } onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { - print("onBrowserExit Called!!!!"); + print("onBrowserExit Called"); if (widget.selectedPaymentMethod == "TAMARA" && tamaraPaymentStatus != null && tamaraPaymentStatus == "approved") { var res = { "Amount": double.parse(widget.advanceModel.amount), diff --git a/lib/services/payfort_services/payfort_project_details_resp_model.dart b/lib/services/payfort_services/payfort_project_details_resp_model.dart new file mode 100644 index 00000000..18d501ea --- /dev/null +++ b/lib/services/payfort_services/payfort_project_details_resp_model.dart @@ -0,0 +1,36 @@ +class PayfortProjectDetailsRespModel { + String accessCode; + int integrationId; + String merchantIdentifier; + int projectID; + String projectName; + int servID; + String shaRequest; + String shaResponse; + + PayfortProjectDetailsRespModel({this.accessCode, this.integrationId, this.merchantIdentifier, this.projectID, this.projectName, this.servID, this.shaRequest, this.shaResponse}); + + PayfortProjectDetailsRespModel.fromJson(Map json) { + accessCode = json['AccessCode']; + integrationId = json['Integration_Id']; + merchantIdentifier = json['MerchantIdentifier']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + servID = json['ServID']; + shaRequest = json['Sha_Request']; + shaResponse = json['Sha_Response']; + } + + Map toJson() { + final Map data = new Map(); + data['AccessCode'] = this.accessCode; + data['Integration_Id'] = this.integrationId; + data['MerchantIdentifier'] = this.merchantIdentifier; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['ServID'] = this.servID; + data['Sha_Request'] = this.shaRequest; + data['Sha_Response'] = this.shaResponse; + return data; + } +} diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart new file mode 100644 index 00000000..cb6cb348 --- /dev/null +++ b/lib/services/payfort_services/payfort_service.dart @@ -0,0 +1,140 @@ +import 'dart:convert'; + +import 'package:amazon_payfort/amazon_payfort.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/sdk_token_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:http/http.dart'; +import 'package:network_info_plus/network_info_plus.dart'; + +class PayfortService extends BaseService { + final AmazonPayfort _payfort = AmazonPayfort.instance; + + final NetworkInfo _info = NetworkInfo(); + + Future initPayfortSDK() async { + await AmazonPayfort.initialize( + PayFortOptions(environment: payFortEnvironment), + ); + } + + Future getPayfortConfigurations({int serviceId, int projectId, int integrationId = 2}) async { + Map body = {"Integration_Id": integrationId, "ServID": serviceId, "ProjectID": projectId}; + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); + await baseAppClient.post( + getPayFortProjectDetails, + onSuccess: (response, statusCode) async { + payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel.fromJson(response.isNotEmpty ? response.first : response); + }, + onFailure: (String error, int statusCode) { + Utils.showErrorToast(error); + return null; + }, + body: body, + isAllowAny: true, + ); + return payfortProjectDetailsRespModel; + } + + Future generateSdkSignatureFromAPI(SdkTokenRequest request) async { + var response = await post( + Uri.parse(payFortEnvironment.paymentApi), + headers: {'Content-Type': 'application/json'}, + body: jsonEncode(request.asRequest()), + ); + if (response.statusCode == 200) { + var decodedResponse = jsonDecode(response.body); + return SdkTokenResponse.fromMap(decodedResponse); + } + return null; + } + + Future _generateSdkResponse({ + String applePayAccessCode, + String merchantIdentifier, + String applePayShaType, + String applePayShaRequestPhrase, + }) async { + try { + String deviceId = await _payfort.getDeviceId(); + + /// Step 2: Generate the Signature + SdkTokenRequest tokenRequest = SdkTokenRequest( + accessCode: applePayAccessCode, + deviceId: deviceId ?? '', + merchantIdentifier: merchantIdentifier, + ); + + String signature = await _payfort.generateSignature( + shaType: applePayShaType, + concatenatedString: tokenRequest.toConcatenatedString(applePayShaRequestPhrase), + ); + + tokenRequest = tokenRequest.copyWith(signature: signature); + + /// Step 3: Generate the SDK Token + return await generateSdkSignatureFromAPI(tokenRequest); + } catch (e) { + print("Error here: ${e.toString()}"); + } + return null; + } + + Future paymentWithApplePay({ + SucceededCallback onSucceeded, + FailedCallback onFailed, + String customerName, + String customerEmail, + String orderDescription, + double orderAmount, + String merchantIdentifier, + String applePayAccessCode, + String applePayShaRequestPhrase, + String merchantReference, + String currency = "SAR", + String applePayShaType = "SHA-256", + String countryIsoCode = "SA", + }) async { + try { + SdkTokenResponse sdkTokenResponse = await _generateSdkResponse( + applePayAccessCode: applePayAccessCode, + merchantIdentifier: merchantIdentifier, + applePayShaType: applePayShaType, + applePayShaRequestPhrase: applePayShaRequestPhrase, + ); + + if (sdkTokenResponse != null && sdkTokenResponse.sdkToken == null) { + onFailed(sdkTokenResponse.responseMessage ?? ''); + return; + } + + /// Step 4: Processing Payment [Don't multiply with 100] + /// Amount value send always round ex. [100] not [100.00, 100.21] + FortRequest request = FortRequest( + amount: orderAmount, + customerName: customerName, + customerEmail: customerEmail, + orderDescription: orderDescription, + sdkToken: sdkTokenResponse?.sdkToken ?? '', + merchantReference: merchantReference, + currency: currency, + customerIp: (await _info.getWifiIP() ?? ''), + ); + + _payfort.callPayFortForApplePay( + request: request, + countryIsoCode: countryIsoCode, + applePayMerchantId: applePayMerchantId, + callback: ApplePayResultCallback( + onSucceeded: onSucceeded, + onFailed: onFailed, + ), + ); + } catch (e) { + onFailed(e.toString()); + } + } +} diff --git a/lib/services/payfort_services/payfort_view_model.dart b/lib/services/payfort_services/payfort_view_model.dart new file mode 100644 index 00000000..4ad6f8b9 --- /dev/null +++ b/lib/services/payfort_services/payfort_view_model.dart @@ -0,0 +1,68 @@ +import 'package:amazon_payfort/amazon_payfort.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_service.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:flutter/cupertino.dart'; + +class PayfortViewModel extends ChangeNotifier { + PayfortService _payfortService = locator(); + + Future initPayfort() async { + await _payfortService.initPayfortSDK(); + } + + Future getProjectDetailsForPayfort({ int serviceId, int projectId}) async { + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); + try { + payfortProjectDetailsRespModel = await _payfortService.getPayfortConfigurations(serviceId: serviceId, projectId: projectId); + return payfortProjectDetailsRespModel; + } on Exception catch (e, s) { + print(s); + return null; + } + } + + Future initiateApplePayWithPayfort({ + String customerName, + String customerEmail, + String orderDescription, + String merchantReference, + double orderAmount, + SucceededCallback onSuccess, + FailedCallback onFailed, + ServiceTypeEnum serviceTypeEnum, + int projectId, + }) async { + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = await getProjectDetailsForPayfort(projectId: projectId, serviceId: serviceTypeEnum.getIdFromServiceEnum()); + + if (payfortProjectDetailsRespModel == null) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + return; + } + + try { + await _payfortService.paymentWithApplePay( + onSucceeded: onSuccess, + onFailed: onFailed, + customerName: customerName, + customerEmail: customerEmail, + orderDescription: orderDescription, + orderAmount: orderAmount, + merchantReference: merchantReference, + merchantIdentifier: payfortProjectDetailsRespModel.merchantIdentifier ?? "", + applePayAccessCode: payfortProjectDetailsRespModel.accessCode ?? "", + applePayShaRequestPhrase: payfortProjectDetailsRespModel.shaRequest ?? "", + ); + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + } catch (e) { + Utils.showErrorToast(e.toString()); + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + throw e; + } + } +} diff --git a/lib/services/payfort_services/sdk_token_response_model.dart b/lib/services/payfort_services/sdk_token_response_model.dart new file mode 100644 index 00000000..75326608 --- /dev/null +++ b/lib/services/payfort_services/sdk_token_response_model.dart @@ -0,0 +1,55 @@ +class SdkTokenResponse { + SdkTokenResponse({ + this.responseCode, + this.deviceId, + this.responseMessage, + this.serviceCommand, + this.sdkToken, + this.signature, + this.merchantIdentifier, + this.accessCode, + this.language, + this.status, + }); + + String responseCode; + String deviceId; + String responseMessage; + String serviceCommand; + String sdkToken; + String signature; + String merchantIdentifier; + String accessCode; + String language; + String status; + + factory SdkTokenResponse.fromMap(Map data) { + return SdkTokenResponse( + responseCode: data['response_code'], + deviceId: data['device_id'], + responseMessage: data['response_message'], + serviceCommand: data['service_command'], + sdkToken: data['sdk_token'], + signature: data['signature'], + merchantIdentifier: data['merchant_identifier'], + accessCode: data['access_code'], + language: data['language'], + status: data['status'], + ); + } + + Map toMap() { + return { + 'response_code': responseCode, + 'device_id': deviceId, + 'response_message': responseMessage, + 'service_command': serviceCommand, + 'sdk_token': sdkToken, + 'signature': signature, + 'merchant_identifier': merchantIdentifier, + 'access_code': accessCode, + 'language': language, + 'status': status, + }; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 235254f9..b465d1da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -218,6 +218,8 @@ dependencies: # open_file: ^3.2.1 open_filex: ^4.3.2 path_provider: ^2.0.8 + amazon_payfort: ^1.0.5 + network_info_plus: ^3.0.5 # flutter_callkit_incoming: ^1.0.3+3 # firebase_core: 1.12.0 From 512db615befb1dba89a104f2bb56df3518c745ab Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 20 Dec 2023 09:39:52 +0300 Subject: [PATCH 29/71] Language ID fixes & app update to stores, VersionID 11.5 --- .../service/appointment_rate_service.dart | 6 +- .../appointment_rate_view_model.dart | 4 +- .../components/DocAvailableAppointments.dart | 9 +- lib/pages/DrawerPages/family/my-family.dart | 30 ++--- .../widgets/AppointmentActions.dart | 15 ++- lib/pages/landing/landing_page.dart | 6 +- lib/pages/livecare/widgets/clinic_list.dart | 15 ++- lib/pages/login/confirm-login.dart | 1 + lib/pages/login/register-info.dart | 3 +- .../appointment_services/GetDoctorsList.dart | 123 +++++------------- .../authentication/auth_provider.dart | 8 +- .../family_files/family_files_provider.dart | 12 +- .../livecare_services/livecare_provider.dart | 15 ++- .../my_invoice_services.dart | 38 ++---- .../SmartWatchIntegrationService.dart | 2 - lib/widgets/drawer/app_drawer_widget.dart | 12 +- pubspec.yaml | 2 +- 17 files changed, 127 insertions(+), 174 deletions(-) diff --git a/lib/core/service/appointment_rate_service.dart b/lib/core/service/appointment_rate_service.dart index 16355e9a..848aeb48 100644 --- a/lib/core/service/appointment_rate_service.dart +++ b/lib/core/service/appointment_rate_service.dart @@ -8,8 +8,10 @@ class AppointmentRateService extends BaseService { List appointmentRatedList = List(); AppointmentDetails appointmentDetails; - Future getIsLastAppointmentRatedList() async { + Future getIsLastAppointmentRatedList(int languageID) async { hasError = false; + Map bodyData = Map(); + bodyData['LanguageID'] = languageID; await baseAppClient.post(IS_LAST_APPOITMENT_RATED, onSuccess: (dynamic response, int statusCode) { appointmentRatedList.clear(); response['IsLastAppoitmentRatedList'].forEach((appoint) { @@ -18,7 +20,7 @@ class AppointmentRateService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: bodyData); } Future getAppointmentDetails() async { diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index 9e0d338b..9396c2f5 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -12,10 +12,10 @@ class AppointmentRateViewModel extends BaseViewModel { AppointmentDetails get appointmentDetails => _appointmentRateService.appointmentDetails; - Future getIsLastAppointmentRatedList() async { + Future getIsLastAppointmentRatedList(int languageID) async { isHaveAppointmentNotRate = false; setState(ViewState.Busy); - await _appointmentRateService.getIsLastAppointmentRatedList(); + await _appointmentRateService.getIsLastAppointmentRatedList(languageID); if (_appointmentRateService.hasError) { error = _appointmentRateService.error; setState(ViewState.Error); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 04f6d1b0..61e697f4 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -376,10 +376,11 @@ class _DocAvailableAppointmentsState extends State wit } getCurrentLanguage() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - this.language = languageID; - }); + this.language = projectViewModel.isArabic ? "ar" : "en"; + // var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // setState(() { + // this.language = languageID; + // }); } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index fa7d4a6a..d88c86e3 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -447,20 +447,20 @@ class _MyFamily extends State with TickerProviderStateMixin { } refreshFamily(context) async { - - await sharedPref.remove(FAMILY_FILE); - await checkUserData(); + await sharedPref.remove(FAMILY_FILE); + await checkUserData(); } switchUser(user, context) { GifLoaderDialogUtils.showMyDialog(context); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; // this // .familyFileProvider // .silentLoggin(user) // .then((value) => loginAfter(value, context)); // Utils.showProgressDialog(context); - this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { + this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, languageID, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { print("err:$err"); AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); @@ -524,9 +524,8 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.acceptRejectFamily(request).then((value) async{ - - await refreshFamily(context); + this.familyFileProvider.acceptRejectFamily(request).then((value) async { + await refreshFamily(context); GifLoaderDialogUtils.hideDialog(context); }); } @@ -537,10 +536,8 @@ class _MyFamily extends State with TickerProviderStateMixin { // var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); await getFamilyFiles(); - this.user = data; - setState(() { - - }); + this.user = data; + setState(() {}); } } @@ -557,18 +554,18 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { - - familySharedRecords = await familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + familySharedRecords = await familyFileProvider.getSharedRecordByStatus(languageID); } - sentRecordsList =[]; + sentRecordsList = []; familySharedRecords.getAllSharedRecordsByStatusList.forEach((element) { if (element.status == 3) { familySharedRecordsList.add(element); } sentRecordsList.add(element); }); - approvedRecordsList =[]; - pendingRecordsList =[]; + approvedRecordsList = []; + pendingRecordsList = []; GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(); pendingAndApprovedRecords.getAllSharedRecordsByStatusList.forEach((element) { @@ -580,7 +577,6 @@ class _MyFamily extends State with TickerProviderStateMixin { } }); } catch (ex) { - familySharedRecords = GetAllSharedRecordsByStatusResponse(getAllSharedRecordsByStatusList: []); } GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 76d89f82..b7083b7c 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -467,7 +467,8 @@ class _AppointmentActionsState extends State { askYourDoc() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + service.isAllowedToAskDoctor(widget.appo.doctorID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['PatientDoctorAppointmentResultList']); if (res['PatientDoctorAppointmentResultList'].length != 0) { @@ -483,9 +484,10 @@ class _AppointmentActionsState extends State { } getCallRequestType() { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getCallRequestType(context).then((res) { + service.getCallRequestType(languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); List requestData = new List(); res['ListReqTypes'].forEach((element) { @@ -528,9 +530,11 @@ class _AppointmentActionsState extends State { } sendAskDocRequest(int requestType) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.sendAskDocCallRequest(widget.appo, requestType.toString(), context).then((res) { + + service.sendAskDocCallRequest(widget.appo, requestType.toString(), languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Request Sent Successfully"); @@ -589,7 +593,7 @@ class _AppointmentActionsState extends State { navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { if (widget.projectViewModel.isLogin) { // if (model.count != 0) { - getPatientAppointmentHistoryWithAppo(); + getPatientAppointmentHistoryWithAppo(); // } else { // AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); // } @@ -608,7 +612,8 @@ class _AppointmentActionsState extends State { getPatientAppointmentHistoryWithAppo() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getPatientAppointmentHistoryWithAppoNo(widget.appo.appointmentNo).then((res) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + service.getPatientAppointmentHistoryWithAppoNo(widget.appo.appointmentNo, languageID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList.fromJson(res['AppoimentAllHistoryResultList'][0]); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 47dab9ba..7e56896f 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -298,7 +298,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { - familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + familyFileProvider.getSharedRecordByStatus(languageID); } }); @@ -655,7 +656,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { } }); if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) { - appointmentRateViewModel.getIsLastAppointmentRatedList().then((value) async { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + appointmentRateViewModel.getIsLastAppointmentRatedList(languageID).then((value) async { if (appointmentRateViewModel.isHaveAppointmentNotRate) { await AppSharedPreferences().setBool(IS_LAST_APPOINTMENT_RATE_SHOWN, true); Navigator.push( diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 361d2381..bbf7a159 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -102,25 +102,25 @@ class _clinic_listState extends State { }); } }); - - getLanguageID(); super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + getLanguageID(); return Container( child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), ); } void startLiveCare() { + int languageID = projectViewModel.isArabic ? 1 : 2; bool isError = false; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); - service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) { + service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['HasAppointment'] == true) { isError = true; @@ -183,9 +183,10 @@ class _clinic_listState extends State { } getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) { + int languageID = projectViewModel.isArabic ? 1 : 2; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) { + service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { @@ -504,7 +505,8 @@ class _clinic_listState extends State { } getLanguageID() async { - languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + languageID = projectViewModel.isArabic ? "ar" : "en"; + // languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); } getLiveCareClinicsList() { @@ -757,11 +759,12 @@ class _clinic_listState extends State { } void startScheduleLiveCare() { + int languageID = projectViewModel.isArabic ? 1 : 2; List doctorsList = []; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); List _patientDoctorAppointmentListHospital = List(); - service.getLiveCareScheduledDoctorList(context, selectedClinicID).then((res) { + service.getLiveCareScheduledDoctorList(context, selectedClinicID, languageID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 12ee9ecb..b99e7c07 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -705,6 +705,7 @@ class _ConfirmLogin extends State { page: LandingPage(), ), (r) => false); + insertIMEI(); } loading(flag) { diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 0f8e031f..e004663e 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -705,7 +705,8 @@ class _RegisterInfo extends State { projectViewModel.isLogin = true; projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - appointmentRateViewModel.getIsLastAppointmentRatedList().then((value) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + appointmentRateViewModel.getIsLastAppointmentRatedList(languageID).then((value) { getToDoCount(); GifLoaderDialogUtils.hideDialog(AppGlobal.context); if (appointmentRateViewModel.isHaveAppointmentNotRate) { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 224f36f2..f3b7670c 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -47,10 +47,9 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - 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, @@ -105,10 +104,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - 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, @@ -144,10 +141,9 @@ class DoctorsListService extends BaseService { Future getDoctorsProfile(int docID, int clinicID, int projectID, 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, @@ -177,10 +173,9 @@ class DoctorsListService extends BaseService { Future getDoctorsRating(int docID, 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, @@ -228,10 +223,9 @@ class DoctorsListService extends BaseService { Future getDoctorsRatingDetails(int docID, 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, @@ -259,7 +253,7 @@ class DoctorsListService extends BaseService { Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel projectViewModel]) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -271,7 +265,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, @@ -302,7 +295,7 @@ class DoctorsListService extends BaseService { Future getDoctorScheduledFreeSlots(int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -315,7 +308,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authUser.outSA, @@ -343,7 +335,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": false, @@ -367,7 +358,6 @@ class DoctorsListService extends BaseService { "Age": authUser.age != null ? authUser.age : 0, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -407,7 +397,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": true, @@ -430,7 +419,6 @@ class DoctorsListService extends BaseService { "GenderID": authUser.gender, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -460,7 +448,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -470,7 +457,6 @@ class DoctorsListService extends BaseService { "IsActiveAppointment": true, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -519,7 +505,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -530,7 +515,6 @@ class DoctorsListService extends BaseService { "IsForLiveCare": true, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -560,17 +544,9 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientID": authUser.patientID, - "PatientTypeID": authUser.patientType, - "PatientType": authUser.patientType - }; + request = {"ProjectID": 15, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType}; dynamic localRes; @@ -590,11 +566,9 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "ProjectID": projectID, "SetupID": setupID, "isDentalAllowedBackend": false, @@ -614,9 +588,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentHistoryWithAppoNo(int appoNo) async { + Future getPatientAppointmentHistoryWithAppoNo(int appoNo, int languageID) async { Map request; - request = {"IsActiveAppointment": true, "AppointmentNo": appoNo, "IsComingFromCOC": false}; + request = {"IsActiveAppointment": true, "AppointmentNo": appoNo, "IsComingFromCOC": false, "LanguageID": languageID}; dynamic localRes; await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { localRes = response; @@ -635,14 +609,12 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsActiveAppointment": isActiveAppointment, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -666,14 +638,13 @@ class DoctorsListService extends BaseService { Future getPatientAppointmentCurfewHistory(bool isActiveAppointment) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "IsActiveAppointment": isActiveAppointment, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -702,7 +673,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -713,7 +683,6 @@ class DoctorsListService extends BaseService { "ConfirmationBy": 102, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -749,7 +718,6 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -767,7 +735,6 @@ class DoctorsListService extends BaseService { "DeviceType": req.DeviceType, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -798,7 +765,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -815,7 +781,6 @@ class DoctorsListService extends BaseService { "StrAppointmentDate": DateUtil.getDateFormatted(appo.appointmentDate), "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -845,7 +810,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -855,7 +819,6 @@ class DoctorsListService extends BaseService { "IsFollowup": patientShareResponse.isFollowup, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -885,7 +848,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -898,7 +860,6 @@ class DoctorsListService extends BaseService { "To": to, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -926,14 +887,13 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "ClientRequestID": transactionID, "IsPharmacy": isPharma, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -971,7 +931,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -980,7 +940,6 @@ class DoctorsListService extends BaseService { "AppointmentID": appointmentID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1006,7 +965,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -1021,7 +980,6 @@ class DoctorsListService extends BaseService { "DeviceType": Platform.isIOS ? "iOS" : "Android", "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1083,13 +1041,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future isAllowedToAskDoctor(int docID, BuildContext context) async { + Future isAllowedToAskDoctor(int docID, int languageID, 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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "IsForAskYourDoctor": true, @@ -1097,9 +1055,9 @@ class DoctorsListService extends BaseService { "Top": 25, "beforeDays": 15, "exludType": 4, + "LanguageID": languageID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1120,18 +1078,17 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getCallRequestType(BuildContext context) async { + Future getCallRequestType(int languageID, 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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1140,6 +1097,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1152,13 +1110,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, BuildContext context) async { + Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, int languageID, 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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { @@ -1180,7 +1138,6 @@ class DoctorsListService extends BaseService { "EditedOn": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[0], "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1189,6 +1146,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1207,13 +1165,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1240,7 +1197,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1248,7 +1205,6 @@ class DoctorsListService extends BaseService { "ClinicID": clinicID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1275,7 +1231,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appo.appointmentNo, @@ -1285,7 +1241,6 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "SetupID": appo.setupID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1312,7 +1267,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentDate": appoDate, @@ -1325,7 +1280,6 @@ class DoctorsListService extends BaseService { "SetupID": setupId, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1352,7 +1306,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "ProjectID": projectID, @@ -1370,7 +1324,6 @@ class DoctorsListService extends BaseService { }, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1397,7 +1350,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { @@ -1416,7 +1369,7 @@ class DoctorsListService extends BaseService { "PaymentMethod": paymentMethodName, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1442,13 +1395,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1483,13 +1435,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1527,14 +1478,13 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "MedCategoryID": medCategoryId, "MedGetStsID": medCategoryStsId, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1557,12 +1507,7 @@ class DoctorsListService extends BaseService { Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, int checkInBy, BuildContext context) async { Map request; - request = { - "AppointmentNo": appointmentNo, - "NFC_Code": nfcCode, - "ProjectID": projectId, - "CheckinBy": checkInBy - }; + request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy}; dynamic localRes; await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { localRes = response; @@ -1827,7 +1772,6 @@ class DoctorsListService extends BaseService { Map requestFreeSlots; Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); requestFreeSlots = { "DoctorID": docID, @@ -1839,7 +1783,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index a629df89..ff8abbdc 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -248,7 +248,7 @@ class AuthProvider with ChangeNotifier { return Future.value(localRes); } - Future checkActivationCode(request, [value]) async { + Future checkActivationCode(request, [value]) async { var neRequest = CheckActivationCodeReq.fromJson(request); neRequest.activationCode = value ?? "0000"; @@ -377,16 +377,14 @@ class AuthProvider with ChangeNotifier { requestN.patientOutSA = requestN.patientobject.patientOutSA; final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); - if(nhic !=null) { - requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format( - dateFormat.parse(nhic['DateOfBirth'])); + if (nhic != null) { + requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); requestN.isHijri = nhic['IsHijri'] ? 1 : 0; requestN.healthId = requestN.patientobject.eHealthIDField; } requestN.zipCode = requestN.patientOutSA == 1 ? '971' : '966'; - await sharedPref.remove(USER_PROFILE); dynamic localRes; diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 7a41f6b9..7d07e2e5 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart'; import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; @@ -9,6 +11,7 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsBySta import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; // SharedPreferences sharedPref = new SharedPreferences(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } @@ -36,7 +39,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic authenticatedUser; GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse; - Future getSharedRecordByStatus() async { + Future getSharedRecordByStatus(int languageID) async { dynamic localRes; try { var request = GetAllSharedRecordsByStatusReq(); @@ -233,7 +236,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, {onSuccess, mainUser}) async { + Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, int languageID, {onSuccess, mainUser}) async { Map request = {}; if (mainUser == true) { var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); @@ -251,6 +254,7 @@ class FamilyFilesProvider with ChangeNotifier { request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; + request['LanguageID'] = languageID; } else { var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); //const request = new SwitchUserRequest(); @@ -268,6 +272,7 @@ class FamilyFilesProvider with ChangeNotifier { // request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; + request['LanguageID'] = languageID; } try { dynamic localRes; @@ -280,7 +285,8 @@ class FamilyFilesProvider with ChangeNotifier { }, body: request); sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); - } catch (error) { + } + catch (error) { print(error); throw error; } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 2a18c79c..126f5a73 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -57,7 +57,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID) async { + Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID, int languageID) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -69,7 +69,8 @@ class LiveCareService extends BaseService { "ServiceID": serviceID, "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; @@ -146,7 +147,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getERAppointmentFees(int serviceID, bool isPharmaLiveCare, BuildContext context) async { + Future getERAppointmentFees(int serviceID, bool isPharmaLiveCare, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -160,7 +161,8 @@ class LiveCareService extends BaseService { "ProjectID": 12, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Age": authUser.age != null ? authUser.age : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; @@ -173,7 +175,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getERAppointmentTime(int serviceID, bool isPharmaLiveCare, BuildContext context) async { + Future getERAppointmentTime(int serviceID, bool isPharmaLiveCare, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -187,7 +189,8 @@ class LiveCareService extends BaseService { "ProjectID": 12, "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; diff --git a/lib/services/my_invoice_service/my_invoice_services.dart b/lib/services/my_invoice_service/my_invoice_services.dart index 561f0da1..75807506 100644 --- a/lib/services/my_invoice_service/my_invoice_services.dart +++ b/lib/services/my_invoice_service/my_invoice_services.dart @@ -15,11 +15,9 @@ class MyInvoicesService extends BaseService { Future getAllDentalAppointments(int projectID, 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, @@ -38,8 +36,7 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -49,11 +46,9 @@ class MyInvoicesService extends BaseService { Future getDentalAppointmentInvoice(int projectID, int appoNo, int invoiceNo, 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, @@ -74,22 +69,19 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } Future sendDentalAppointmentInvoiceEmail(int projectID, int appoNo, 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, @@ -110,13 +102,11 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - } diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart index 459c0e83..6c316f7f 100644 --- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -23,11 +23,9 @@ class SmartWatchIntegrationService extends BaseService { authUser = data; } - 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, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index e71a4266..408b0afc 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -650,15 +650,17 @@ class _AppDrawerState extends State { // print(await sharedPref.getObject(FAMILY_FILE)); return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE))); } else { - return familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + return familyFileProvider.getSharedRecordByStatus(languageID); } } } switchUser(user, context) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); sharedPref.remove(BLOOD_TYPE); - this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) { + this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, languageID, mainUser: user is AuthenticatedUser).then((value) { // GifLoaderDialogUtils.hideDialog(context); // Navigator.of(context).pop(); loginAfter(value, context, user is AuthenticatedUser); @@ -666,7 +668,7 @@ class _AppDrawerState extends State { }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); }); } @@ -705,8 +707,10 @@ class _AppDrawerState extends State { if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + appointmentRateViewModel - .getIsLastAppointmentRatedList() + .getIsLastAppointmentRatedList(languageID) .then((value) => { getToDoCount(), //Utils.hideProgressDialog(), diff --git a/pubspec.yaml b/pubspec.yaml index 2b657883..4e49ef9d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.75+1 +version: 4.5.035+4050035 environment: sdk: ">=2.7.0 <3.0.0" From 52b3c196d6c9e5e2bcd2c198ad4ac4d191546b89 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 20 Dec 2023 15:37:52 +0300 Subject: [PATCH 30/71] updates --- ios/Runner/Runner.entitlements | 6 + lib/config/config.dart | 5 +- .../LiveCare/ApplePayInsertRequest.dart | 42 +++++- .../medical/balance/confirm_payment_page.dart | 129 ++++++------------ .../payfort_project_details_resp_model.dart | 3 +- .../payfort_services/payfort_service.dart | 58 ++++++++ .../payfort_services/payfort_view_model.dart | 49 ++++--- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- 8 files changed, 185 insertions(+), 111 deletions(-) diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 0821ccf0..44ce1b68 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -8,6 +8,12 @@ com.apple.developer.healthkit.access + com.apple.developer.in-app-payments + + merchant.com.hmgwebsersives + merchant.com.hmgwebservices.uat + merchant.com.hmgwebservices + com.apple.developer.networking.HotspotConfiguration com.apple.developer.networking.wifi-info diff --git a/lib/config/config.dart b/lib/config/config.dart index 26dda9d2..4831aeb6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.20.200.111:1010/'; - // 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/'; @@ -625,6 +625,7 @@ var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceComp //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; +var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; var payFortEnvironment = FortEnvironment.test; var applePayMerchantId = "merchant.com.hmgwebservices.uat"; diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart index 2e091f65..aa4e316b 100644 --- a/lib/models/LiveCare/ApplePayInsertRequest.dart +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -35,6 +35,24 @@ class ApplePayInsertRequest { String sessionID; bool isDentalAllowedBackend; int deviceTypeID; + bool isMobSDK; + String merchantReference; + String merchantIdentifier; + String commandType; + String signature; + String accessCode; + String shaRequestPhrase; + String shaResponsePhrase; + String returnURL; + + // IsMobSDK ==> bool + // Merchant_Reference ==> string + // Merchant_Identifier ==> string + // CommandType ==> string + // Signature ==> string + // Access_code ==> string + // SHA_RequestPhase ==> string + // SHA_ResponsePhase ==> string ApplePayInsertRequest( {this.clientRequestID, @@ -72,7 +90,18 @@ class ApplePayInsertRequest { this.generalid, this.sessionID, this.isDentalAllowedBackend, - this.deviceTypeID}); + this.deviceTypeID, + + this.isMobSDK, + this.merchantReference, + this.merchantIdentifier, + this.commandType, + this.signature, + this.accessCode, + this.shaRequestPhrase, + this.shaResponsePhrase, + this.returnURL, + }); ApplePayInsertRequest.fromJson(Map json) { clientRequestID = json['ClientRequestID']; @@ -151,6 +180,17 @@ class ApplePayInsertRequest { data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; + + data['IsMobSDK'] = this.isMobSDK; + data['Merchant_Reference'] = this.merchantReference; + data['Merchant_Identifier'] = this.merchantIdentifier; + data['CommandType'] = this.commandType; + data['Signature'] = this.signature; + data['Access_code'] = this.accessCode; + data['SHA_RequestPhase'] = this.shaRequestPhrase; + data['SHA_ResponsePhase'] = this.shaResponsePhrase; + data['ReturnURL'] = this.returnURL; + return data; } } diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index d60b199c..da9f79e1 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -33,7 +34,6 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'new_text_Field.dart'; - class ConfirmPaymentPage extends StatefulWidget { final AdvanceModel advanceModel; final PatientInfoAndMobileNumber patientInfoAndMobileNumber; @@ -218,7 +218,7 @@ class _ConfirmPaymentPageState extends State { padding: EdgeInsets.all(20), child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), - () async { + () async { if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { if (widget.selectedPaymentMethod == "ApplePay") { transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); @@ -228,6 +228,14 @@ class _ConfirmPaymentPageState extends State { LiveCareService service = new LiveCareService(); ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context + .read() + .getProjectDetailsForPayfort(projectId: widget.advanceModel.hospitalsModel.iD, serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum()) + .then((value) { + payfortProjectDetailsRespModel = value; + }); + applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; @@ -257,29 +265,39 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { - GifLoaderDialogUtils.hideDialog(context); - await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - orderDescription: "Advance Payment", - orderAmount: double.parse(widget.advanceModel.amount), - merchantReference: transID, - onFailed: (failureResult) { - log("failureResult: ${failureResult.toString()}"); - - }, - onSuccess: (successResult) { - log("Payfort: ${successResult.responseMessage}"); - checkPaymentStatus(AppoitmentAllHistoryResultList()); - }, - projectId: widget.advanceModel.hospitalsModel.iD, - // projectId: 95, - serviceTypeEnum: ServiceTypeEnum.advancePayment, - ); + // GifLoaderDialogUtils.hideDialog(context); + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Advance Payment", + orderAmount: double.parse(widget.advanceModel.amount), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(AppoitmentAllHistoryResultList()); + }, + projectId: widget.advanceModel.hospitalsModel.iD, + serviceTypeEnum: ServiceTypeEnum.advancePayment, + ); }).catchError((err) { print(err); - if (context = null) GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); }); } else { @@ -309,72 +327,7 @@ class _ConfirmPaymentPageState extends State { ); } - // startApplePay() { - // ApplePayResponse applePayResponse; - // var _paymentItems = [ - // PaymentItem( - // label: 'Total', - // amount: widget.advanceModel.amount, - // status: PaymentItemStatus.final_price, - // ) - // ]; - // - // _payClient.userCanPay(PayProvider.apple_pay).then((value) async { - // print(value); - // final result = await _payClient.showPaymentSelector( - // provider: PayProvider.apple_pay, - // paymentItems: _paymentItems, - // ); - // print(result); - // applePayResponse = ApplePayResponse.fromJson(result); - // callPayfortApplePayAPI(applePayResponse); - // }).catchError((err) { - // print(err); - // }); - // } - - callPayfortApplePayAPI(ApplePayResponse applePayResponse) async { - DoctorsListService service = new DoctorsListService(); - ApplePayRequest applePayRequest = new ApplePayRequest(); - AppleHeader appleHeader = new AppleHeader(); - ApplePaymentMethod applePaymentMethod = new ApplePaymentMethod(); - - applePayRequest.amount = widget.advanceModel.amount; - applePayRequest.currency = "SAR"; - applePayRequest.language = projectViewModel.isArabic ? "ar" : "en"; - applePayRequest.customername = projectViewModel.user.firstName; - applePayRequest.customerEmail = projectViewModel.user.emailAddress; - applePayRequest.orderdescription = "Advance Payment"; - applePayRequest.liveServiceid = ""; - applePayRequest.latitude = await this.sharedPref.getDouble(USER_LAT); - applePayRequest.longitude = await this.sharedPref.getDouble(USER_LONG); - applePayRequest.devicetoken = await sharedPref.getString(PUSH_TOKEN); - applePayRequest.clientrequestid = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); - applePayRequest.projectid = widget.advanceModel.hospitalsModel.iD.toString(); - applePayRequest.serviceid = "3"; - applePayRequest.patientid = projectViewModel.user.patientID.toString(); - applePayRequest.appleData = applePayResponse.token.data; - applePayRequest.appleSignature = applePayResponse.token.signature; - - appleHeader.appleEphemeralPublicKey = applePayResponse.token.header.ephemeralPublicKey; - appleHeader.appleTransactionId = applePayResponse.token.header.transactionId; - appleHeader.applePublicKeyHash = applePayResponse.token.header.publicKeyHash; - applePaymentMethod.appleType = getApplePayPaymentType(applePayResponse.paymentMethod.type); - applePaymentMethod.appleNetwork = applePayResponse.paymentMethod.network; - applePaymentMethod.appleDisplayName = applePayResponse.paymentMethod.displayName; - - applePayRequest.appleHeader = appleHeader; - applePayRequest.applePaymentMethod = applePaymentMethod; - - service.callPayfortApplePayAPI(applePayRequest, context).then((res) { - print(res); - GifLoaderDialogUtils.hideDialog(context); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - print(err); - // _showMyDialog(err, this.context); - }); - } + void addPayFortApplePayResponse() {} String getApplePayPaymentType(dynamic paymentMethod) { switch (paymentMethod) { diff --git a/lib/services/payfort_services/payfort_project_details_resp_model.dart b/lib/services/payfort_services/payfort_project_details_resp_model.dart index 18d501ea..2bf9a1e5 100644 --- a/lib/services/payfort_services/payfort_project_details_resp_model.dart +++ b/lib/services/payfort_services/payfort_project_details_resp_model.dart @@ -7,8 +7,9 @@ class PayfortProjectDetailsRespModel { int servID; String shaRequest; String shaResponse; + String signature; - PayfortProjectDetailsRespModel({this.accessCode, this.integrationId, this.merchantIdentifier, this.projectID, this.projectName, this.servID, this.shaRequest, this.shaResponse}); + PayfortProjectDetailsRespModel({this.accessCode, this.integrationId, this.merchantIdentifier, this.projectID, this.projectName, this.servID, this.shaRequest, this.shaResponse, this.signature}); PayfortProjectDetailsRespModel.fromJson(Map json) { accessCode = json['AccessCode']; diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index cb6cb348..45e1c2c6 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -39,6 +39,44 @@ class PayfortService extends BaseService { return payfortProjectDetailsRespModel; } + Future addPayfortApplePayResponse({PayFortResult result}) async { + Map body = { + "Fort_id": result.fortId, + "CommandType": result.command, + "Amount": (num.parse(result.amount) / 100).toString(), + "Payment_Option": result.paymentOption, + "Customer_IP": result.customerIp, + "ECI": result.eci, + "Response_Message": result.responseMessage, + "Card_Number": result.cardNumber, + // "Card_Bin": result.ca, + "Status": result.status, + "Merchant_Ref": result.merchantReference, + // Installments_Number + // plan_code + // issuer_code + "Pat_Token": result.tokenName, + "IsRefund": false, + "RemmeberMe": false, + "Reconciliation_Reference": result.reconcilationReference, + "LanguageID": 1, + }; + + // PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); + await baseAppClient.post( + addPayFortApplePayResponse, + onSuccess: (response, statusCode) async { + // payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel.fromJson(response.isNotEmpty ? response.first : response); + }, + onFailure: (String error, int statusCode) { + Utils.showErrorToast(error); + return null; + }, + body: body, + isAllowAny: true, + ); + } + Future generateSdkSignatureFromAPI(SdkTokenRequest request) async { var response = await post( Uri.parse(payFortEnvironment.paymentApi), @@ -83,6 +121,26 @@ class PayfortService extends BaseService { return null; } + Future getPayfortSignature( + String applePayAccessCode, + String merchantIdentifier, + String applePayShaRequestPhrase, + ) async { + String deviceId = await _payfort.getDeviceId(); + SdkTokenRequest tokenRequest = SdkTokenRequest( + accessCode: applePayAccessCode, + deviceId: deviceId ?? '', + merchantIdentifier: merchantIdentifier, + ); + + String signature = await _payfort.generateSignature( + shaType: "SHA-256", + concatenatedString: tokenRequest.toConcatenatedString(applePayShaRequestPhrase), + ); + + return signature; + } + Future paymentWithApplePay({ SucceededCallback onSucceeded, FailedCallback onFailed, diff --git a/lib/services/payfort_services/payfort_view_model.dart b/lib/services/payfort_services/payfort_view_model.dart index 4ad6f8b9..4a9038b0 100644 --- a/lib/services/payfort_services/payfort_view_model.dart +++ b/lib/services/payfort_services/payfort_view_model.dart @@ -15,10 +15,15 @@ class PayfortViewModel extends ChangeNotifier { await _payfortService.initPayfortSDK(); } - Future getProjectDetailsForPayfort({ int serviceId, int projectId}) async { + Future getProjectDetailsForPayfort({int serviceId, int projectId}) async { PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); try { payfortProjectDetailsRespModel = await _payfortService.getPayfortConfigurations(serviceId: serviceId, projectId: projectId); + + String signature = + await _payfortService.getPayfortSignature(payfortProjectDetailsRespModel.accessCode, payfortProjectDetailsRespModel.merchantIdentifier, payfortProjectDetailsRespModel.shaRequest); + payfortProjectDetailsRespModel.signature = signature; + return payfortProjectDetailsRespModel; } on Exception catch (e, s) { print(s); @@ -26,24 +31,34 @@ class PayfortViewModel extends ChangeNotifier { } } + Future addPayfortApplePayResponse({PayFortResult result}) async { + try { + await _payfortService.addPayfortApplePayResponse(result: result); + } on Exception catch (e, s) { + print(s); + return null; + } + } + Future initiateApplePayWithPayfort({ - String customerName, - String customerEmail, - String orderDescription, - String merchantReference, - double orderAmount, - SucceededCallback onSuccess, - FailedCallback onFailed, - ServiceTypeEnum serviceTypeEnum, - int projectId, + String customerName, + String customerEmail, + String orderDescription, + String merchantReference, + double orderAmount, + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel, + SucceededCallback onSuccess, + FailedCallback onFailed, + ServiceTypeEnum serviceTypeEnum, + int projectId, }) async { - GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = await getProjectDetailsForPayfort(projectId: projectId, serviceId: serviceTypeEnum.getIdFromServiceEnum()); - - if (payfortProjectDetailsRespModel == null) { - GifLoaderDialogUtils.hideDialog(AppGlobal.context); - return; - } + // GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + // PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = await getProjectDetailsForPayfort(projectId: projectId, serviceId: serviceTypeEnum.getIdFromServiceEnum()); + // + // if (payfortProjectDetailsRespModel == null) { + // GifLoaderDialogUtils.hideDialog(AppGlobal.context); + // return; + // } try { await _payfortService.paymentWithApplePay( diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c9fecbf9..c71b206b 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,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 e4ce158277426559e7933e3888f7635ffb0068e8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 20 Dec 2023 22:42:37 +0300 Subject: [PATCH 31/71] updates --- lib/services/payfort_services/payfort_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index 45e1c2c6..e684d1bd 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -43,7 +43,7 @@ class PayfortService extends BaseService { Map body = { "Fort_id": result.fortId, "CommandType": result.command, - "Amount": (num.parse(result.amount) / 100).toString(), + "Amount": (num.parse(result.amount) / 100), "Payment_Option": result.paymentOption, "Customer_IP": result.customerIp, "ECI": result.eci, From 4ac11b21697314c1ca5df4ce8013214f3600b8ee Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 20 Dec 2023 23:23:31 +0300 Subject: [PATCH 32/71] LanguageID Fixes --- lib/config/config.dart | 2 +- lib/core/service/hospital_service.dart | 3 +- lib/core/viewModels/er/EdOnlineViewModel.dart | 4 +- .../viewModels/er/am_request_view_model.dart | 8 +- lib/core/viewModels/hospital_view_model.dart | 4 +- .../medical/my_balance_view_model.dart | 4 +- .../NewCMC/new_cmc_step_three_page.dart | 6 +- .../new_e_referral_step_three_page.dart | 5 +- .../bmi_calculator/bariatrics-screen.dart | 6 +- .../bmi_calculator/result_page.dart | 6 +- .../BookAppointment/DentalComplaints.dart | 16 +- .../components/LaserClinic.dart | 3 +- .../components/SearchByClinic.dart | 6 +- .../components/SearchByDoctor.dart | 3 +- .../widgets/DentalComplaintCard.dart | 5 +- .../BookAppointment/widgets/DoctorView.dart | 3 +- lib/pages/ErService/AmbulanceReq.dart | 2 +- .../EdOnlineSelectedHospitalPage.dart | 2 +- .../medical/balance/advance_payment_page.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 11 +- .../clinic_services/get_clinic_service.dart | 36 ++--- lib/widgets/others/bottom_bar.dart | 140 +++++++----------- .../others/floating_button_search.dart | 6 +- pubspec.yaml | 2 +- 24 files changed, 138 insertions(+), 147 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f0dd61b1..f9296273 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -339,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.5; +var VERSION_ID = 11.6; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index be0024ab..e6dc7727 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -51,13 +51,14 @@ class HospitalService extends BaseService { } } - Future getHospitals({bool isResBasedOnLoc = true, bool isAdvancePayment = false}) async { + Future getHospitals(int languageID, {bool isResBasedOnLoc = true, bool isAdvancePayment = false}) async { if (isResBasedOnLoc) await _getCurrentLocation(); Map body = Map(); body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); body['IsOnlineCheckIn'] = isResBasedOnLoc; body['IsAdvancePayment'] = isAdvancePayment; + body['LanguageID'] = languageID; await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { _hospitals.clear(); diff --git a/lib/core/viewModels/er/EdOnlineViewModel.dart b/lib/core/viewModels/er/EdOnlineViewModel.dart index 1970a965..00be41b2 100644 --- a/lib/core/viewModels/er/EdOnlineViewModel.dart +++ b/lib/core/viewModels/er/EdOnlineViewModel.dart @@ -20,10 +20,10 @@ class EdOnlineViewModel extends BaseViewModel { ErPatientShareModel get erPatientShareModel => _edOnlineServices.erPatientShareModel; - Future getHospitals() async { + Future getHospitals(int languageID) async { if(_hospitalService.hospitals.isEmpty){ setState(ViewState.Busy); - await _hospitalService.getHospitals(); + await _hospitalService.getHospitals(languageID); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index aff532d7..53eb477a 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -50,19 +50,19 @@ class AmRequestViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getAmRequestOrders() async { + Future getAmRequestOrders(int languageID) async { setState(ViewState.Busy); await _amService.getAllTransportationOrders(); if (_amService.hasError) { error = _amService.error; setState(ViewState.Error); } else - getHospitals(); + getHospitals(languageID); } - Future getHospitals() async { + Future getHospitals(int languageID) async { setState(ViewState.Busy); - await _hospitalService.getHospitals(isResBasedOnLoc: false); + await _hospitalService.getHospitals(languageID, isResBasedOnLoc: false); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/hospital_view_model.dart b/lib/core/viewModels/hospital_view_model.dart index 66ad4b01..c406c3dc 100644 --- a/lib/core/viewModels/hospital_view_model.dart +++ b/lib/core/viewModels/hospital_view_model.dart @@ -10,9 +10,9 @@ class HospitalViewModel extends BaseViewModel { List get hospitals => _hospitalService.hospitals; - Future getHospitals() async { + Future getHospitals(int languageID) async { setState(ViewState.Busy); - await _hospitalService.getHospitals(); + await _hospitalService.getHospitals(languageID); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index 4166a4b3..47289b81 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -70,9 +70,9 @@ class MyBalanceViewModel extends BaseViewModel { } } - Future getHospitals({bool isAdvancePayment = false}) async { + Future getHospitals(int languageID, {bool isAdvancePayment = false}) async { setState(ViewState.Busy); - await _hospitalService.getHospitals(isAdvancePayment: isAdvancePayment); + await _hospitalService.getHospitals(languageID, isAdvancePayment: isAdvancePayment); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index ec020f49..154dbe19 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -41,6 +41,7 @@ class _NewCMCStepThreePageState extends State { HospitalsModel selectedHospital; final GlobalKey projectDropdownKey = GlobalKey(); bool isLocationSelected = false; + ProjectViewModel projectViewModel; static CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), @@ -74,7 +75,7 @@ class _NewCMCStepThreePageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, description: TranslationBase.of(context).infoCMC, @@ -360,10 +361,11 @@ class _NewCMCStepThreePageState extends State { } getProjectsList() { + int languageID = projectViewModel.isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); GifLoaderDialogUtils.showMyDialog(context); List projectsListLocal = []; - service.getProjectsList(context).then((res) { + service.getProjectsList(languageID, context).then((res) { if (res['MessageStatus'] == 1) { setState(() { res['ListProject'].forEach((v) { diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index 7bacad65..e5ed6ff4 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; @@ -22,6 +23,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../dialogs/select_city_dialog.dart'; @@ -436,9 +438,10 @@ class _NewEReferralStepThreePageState extends State { } void getAllProjects() { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; - service.getProjectsList(context).then((res) { + service.getProjectsList(languageID, context).then((res) { if (res['MessageStatus'] == 1) { setState(() { res['ListProject'].forEach((v) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart index 13de0140..48ef57ff 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart @@ -32,10 +32,11 @@ class BariatricsPage extends StatefulWidget { class _BariatricsPageState extends State { DiseasesByClinic _selectedDisease; + ProjectViewModel projectProvider; @override Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); + projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getClinicCategory(), @@ -139,6 +140,7 @@ class _BariatricsPageState extends State { } callDoctorsSearchAPI() { + int languageID = projectProvider.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -148,7 +150,7 @@ class _BariatricsPageState extends State { List _patientDoctorAppointmentListHospital = List(); DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(108, 0, false, context).then((res) { + service.getDoctorsList(108, 0, false, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart index fa12a9fe..d4a4f5fc 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -1,8 +1,8 @@ import 'dart:collection'; import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:provider/provider.dart'; class ResultPage extends StatefulWidget { final double finalResult; @@ -137,6 +138,7 @@ class _ResultPageState extends State { } callDoctorsSearchAPI() { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -146,7 +148,7 @@ class _ResultPageState extends State { List _patientDoctorAppointmentListHospital = List(); DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(108, 0, false, context).then((res) { + service.getDoctorsList(108, 0, false, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 27cb951e..487fbab4 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -75,10 +75,12 @@ class _DentalComplaintsState extends State { languageID: languageID, isDoctorNameSearch: widget.isDoctorNameSearch, onSelectedMethod: widget.onSelectedMethod, - )..logAnalytics = (){ - final info = widget.searchInfo; - locator().appointment.book_appointment_chief_complaints(appointment_type: 'regular', hospital: info.hospital, clinic: info.clinic, treatment: complaintsList[index]); - }, + )..logAnalytics = () { + final info = widget.searchInfo; + locator() + .appointment + .book_appointment_chief_complaints(appointment_type: 'regular', hospital: info.hospital, clinic: info.clinic, treatment: complaintsList[index]); + }, ); }, separatorBuilder: (BuildContext context, int index) { @@ -207,11 +209,12 @@ class _DentalComplaintsState extends State { } continueDentalPlan() { + int languageID = projectViewModel.isArabic ? 1 : 2; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); int appoTime = 0; - service.getDoctorsList(int.parse("17"), widget.searchInfo.ProjectID, false, context, isContinueDentalPlan: true).then((res) { + service.getDoctorsList(int.parse("17"), widget.searchInfo.ProjectID, false, languageID, context, isContinueDentalPlan: true).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { dentalProceduresModel = DentalProceduresModel.fromJson(res); @@ -254,10 +257,11 @@ class _DentalComplaintsState extends State { } getChiefComplaintsList() { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); getLanguageID(); ClinicListService service = new ClinicListService(); - service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context).then((res) { + service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index 918ca9ad..c7e32565 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -204,6 +204,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat } callDoctorsSearchAPI() { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -214,7 +215,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat DoctorsListService service = new DoctorsListService(); projectViewModel.selectedBodyPartList = _selectedBodyPartList; - service.getDoctorsList(253, 0, false, context).then((res) { + service.getDoctorsList(253, 0, false, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 26deb0f8..a0fed504 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -499,10 +499,11 @@ class _SearchByClinicState extends State { } getProjectsList() { + int languageID = projectViewModel.isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; service - .getProjectsList(context) + .getProjectsList(languageID, context) .then((res) { if (res['MessageStatus'] == 1) { setState(() { @@ -572,6 +573,7 @@ class _SearchByClinicState extends State { } callDoctorsSearchAPI(int clinicID) { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -581,7 +583,7 @@ class _SearchByClinicState extends State { List _patientDoctorAppointmentListHospital = List(); DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, context).then((res) { + service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 4425d926..a37f45e1 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -90,13 +90,14 @@ class _SearchByDoctorState extends State { } getDoctorsList(BuildContext context) { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; DoctorsListService service = new DoctorsListService(); List _patientDoctorAppointmentListHospital = List(); - service.getDoctorsListByName(doctorNameController.text, context).then((res) { + service.getDoctorsListByName(doctorNameController.text, languageID, context).then((res) { // GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index 83b298f2..7e93dc9f 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; @@ -6,6 +7,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; // ignore: must_be_immutable class DentalComplaintCard extends StatefulWidget { @@ -60,12 +62,13 @@ class _DentalComplaintCardState extends State { } getChiefComplaintsList() { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; List doctorsList = []; List _patientDoctorAppointmentListHospital = List(); GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); - service.getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, widget.listDentalChiefComplain.projectID, context).then((res) { + service.getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, widget.listDentalChiefComplain.projectID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['List_DentalDoctorChiefComplaintMapping']); diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 32aff5ac..6969302f 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -183,10 +183,11 @@ class DoctorView extends StatelessWidget { } getDoctorsProfile(context, DoctorList docObject, {isAppo}) { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List docProfileList = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsProfile(docObject.doctorID, docObject.clinicID, docObject.projectID, context).then((res) { + service.getDoctorsProfile(docObject.doctorID, docObject.clinicID, docObject.projectID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['DoctorProfileList'].length != 0) { diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 3803bcd4..29abc3fc 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -40,7 +40,7 @@ class _AmbulanceReqState extends State with SingleTickerProviderSt imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/Ambulance/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/Ambulance/ar/0.png')); return BaseView( - onModelReady: (model) => model.getAmRequestOrders(), + onModelReady: (model) => model.getAmRequestOrders(projectViewModel.isArabic ? 1 : 2), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, showNewAppBarTitle: true, diff --git a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart index 76eace88..ca933f42 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart @@ -33,7 +33,7 @@ class _EdOnlineSelectedHospitalPageState extends State( - onModelReady: (model) => model.getHospitals(), + onModelReady: (model) => model.getHospitals(projectViewModel.isArabic ? 1 : 2), builder: (_, model, w) => AppScaffold( baseViewModel: model, body: SingleChildScrollView( diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index a07944f1..f2a9c79a 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -67,7 +67,7 @@ class _AdvancePaymentPageState extends State { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { - model.getHospitals(isAdvancePayment: true); + model.getHospitals(projectViewModel.isArabic ? 1 : 2, isAdvancePayment: true); model.getFamilyFiles(); }, builder: (_, model, w) => AppScaffold( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index f3b7670c..94766e3c 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -34,7 +34,7 @@ class DoctorsListService extends BaseService { String tokenID; List selectedBodyPartList = []; - Future getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { + Future getDoctorsList(int clinicID, int projectID, bool isNearest, int languageID, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -74,6 +74,7 @@ class DoctorsListService extends BaseService { "Longitude": long != null ? long.toString() : 0, "isDentalAllowedBackend": clinicID == 17 ? true : isContinueDentalPlan, "IsGetNearAppointment": isNearest, + "LanguageID": languageID, if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()), "License": true }; @@ -88,7 +89,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsListByName(String docName, BuildContext context) async { + Future getDoctorsListByName(String docName, int languageID, BuildContext context) async { Map request; double lat; @@ -126,6 +127,7 @@ class DoctorsListService extends BaseService { "IsGetNearAppointment": false, "Latitude": lat == null ? 0.0 : lat, "Longitude": long == null ? 0.0 : long, + "LanguageID": languageID, "License": true }; @@ -139,7 +141,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsProfile(int docID, int clinicID, int projectID, context) async { + Future getDoctorsProfile(int docID, int clinicID, int projectID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -158,7 +160,8 @@ class DoctorsListService extends BaseService { "License": true, "IsRegistered": true, "ProjectID": projectID, - "isDentalAllowedBackend": false + "isDentalAllowedBackend": false, + "LanguageID": languageID, }; dynamic localRes; diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 469ac404..80032015 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -34,10 +34,7 @@ class ClinicListService extends BaseService { Future getActiveAppointmentNo(context) async { Map request = {}; - request = { - "IsActiveAppointment": true, - "LanguageID": 1 - }; + request = {"IsActiveAppointment": true, "LanguageID": 1}; dynamic localRes; @@ -49,12 +46,10 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future getProjectsList(context) async { + Future getProjectsList(int languageID, context) async { Map request = {}; - request = { - "LanguageID": null - }; + request = {"LanguageID": languageID}; dynamic localRes; @@ -66,7 +61,7 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future getChiefComplaintsList(int clinicID, int projectID, BuildContext context, {doctorId}) async { + Future getChiefComplaintsList(int clinicID, int projectID, int languageID, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -85,7 +80,7 @@ class ClinicListService extends BaseService { "License": true, // "VersionID": 5.6, // "Channel": 3, - // "LanguageID": languageID == 'ar' ? 1 : 2, + "LanguageID": languageID, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "SessionID": null, @@ -107,7 +102,7 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future getChiefComplaintDoctorList(int chiefComplaintID, int projectID, BuildContext context, {doctorId}) async { + Future getChiefComplaintDoctorList(int chiefComplaintID, int projectID, int languageID, BuildContext context, {doctorId}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -127,7 +122,7 @@ class ClinicListService extends BaseService { "ProjectID": projectID, // "VersionID": 5.6, // "Channel": 3, - // "LanguageID": languageID == 'ar' ? 1 : 2, + "LanguageID": languageID, // "IPAdress": req.IPAdress, // "generalid": req.generalid, "SessionID": null, @@ -147,14 +142,15 @@ class ClinicListService extends BaseService { }, body: request); return Future.value(localRes); } + Future getCountries() async { - Map request ={}; + Map request = {}; dynamic localRes; - await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); - return Future.value(localRes); -} + await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index 04f4f851..ab747e64 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -2,6 +2,7 @@ import 'dart:collection'; import 'dart:math'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DoctorProfile.dart'; @@ -33,6 +34,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; 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_recognition_result.dart'; // import 'package:speech_to_text/speech_to_text.dart'; @@ -44,9 +47,10 @@ class BottomBarSearch extends StatefulWidget { class _SearchBot extends State { SearchProvider searchProvider = new SearchProvider(); - RobotProvider Provider = RobotProvider(); + RobotProvider robotProvider = RobotProvider(); bool isLoading = false; bool isError = false; + // final SpeechToText speech = SpeechToText(); String error = ''; String _currentLocaleId = ""; @@ -64,6 +68,7 @@ class _SearchBot extends State { bool _isInit = true; TextEditingController searchController = TextEditingController(); + ProjectViewModel projectProvider; @override void initState() { @@ -74,40 +79,37 @@ class _SearchBot extends State { @override Widget build(BuildContext context) { + projectProvider = Provider.of(context); return BottomAppBar( - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: SizedBox( - height: 64, - child: Material( - type: MaterialType.transparency, - child: TextField( - keyboardType: TextInputType.multiline, - maxLines: null, - controller: searchController, - decoration: InputDecoration( - hintText: TranslationBase.of(context).textToSpeech, - suffixIcon: IconButton( - icon: Icon(Icons.mic), - onPressed: () async { - setState(() { - searchController.text = ''; - }); - // await flutterTts.speak("Hello!"); - //Future.delayed(const Duration(seconds: 1), () { - initSpeechState() - .then((value) => startVoiceSearch()); - //}); - }, - )), - ), - ), + child: Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + Expanded( + child: SizedBox( + height: 64, + child: Material( + type: MaterialType.transparency, + child: TextField( + keyboardType: TextInputType.multiline, + maxLines: null, + controller: searchController, + decoration: InputDecoration( + hintText: TranslationBase.of(context).textToSpeech, + suffixIcon: IconButton( + icon: Icon(Icons.mic), + onPressed: () async { + setState(() { + searchController.text = ''; + }); + // await flutterTts.speak("Hello!"); + //Future.delayed(const Duration(seconds: 1), () { + initSpeechState().then((value) => startVoiceSearch()); + //}); + }, + )), ), ), - ]), + ), + ), + ]), ); } @@ -164,10 +166,7 @@ class _SearchBot extends State { Future initSpeechState() async { // await speech.initialize(onError: errorListener, onStatus: statusListener); - _currentLocaleId = - TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' - ? 'en-GB' - : 'ar-SA'; // systemLocale.localeId; + _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' ? 'en-GB' : 'ar-SA'; // systemLocale.localeId; flutterTts.setLanguage(_currentLocaleId); // if (!mounted) return; @@ -187,16 +186,9 @@ class _SearchBot extends State { } getPages(text) { - var request = { - 'VoiceMessage': text, - 'Lang': TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' - ? 'En' - : 'Ar' - }; - - searchProvider - .getBotPages(request) - .then((value) => {getCommands(value['Understand'])}); + var request = {'VoiceMessage': text, 'Lang': TranslationBase.of(AppGlobal.context).locale.languageCode == 'en' ? 'En' : 'Ar'}; + + searchProvider.getBotPages(request).then((value) => {getCommands(value['Understand'])}); } getCommands(result) async { @@ -207,9 +199,7 @@ class _SearchBot extends State { case '100': { List clnicID = unique(result['ClinicId']); - if (result['ProjectId'] != 0 && - clnicID.length > 0 && - result['DoctorId'].length > 0) { + if (result['ProjectId'] != 0 && clnicID.length > 0 && result['DoctorId'].length > 0) { if (clnicID.length == 1) { getDoctorsList( result['ProjectId'], @@ -221,9 +211,7 @@ class _SearchBot extends State { } else { goToClinic(clnicID); } - } else if (result['ProjectId'] != 0 && - clnicID.length > 0 && - result['DoctorId'].length == 0) { + } else if (result['ProjectId'] != 0 && clnicID.length > 0 && result['DoctorId'].length == 0) { if (clnicID.length == 1) { getDoctorsList( result['ProjectId'], @@ -233,9 +221,7 @@ class _SearchBot extends State { } else { goToClinic(clnicID); } - } else if (result['ProjectId'] == 0 && - clnicID.length > 0 && - result['DoctorId'].length == 0) { + } else if (result['ProjectId'] == 0 && clnicID.length > 0 && result['DoctorId'].length == 0) { if (clnicID.length == 1) { getDoctorsList( result['ProjectId'], @@ -245,9 +231,7 @@ class _SearchBot extends State { } else { goToClinic(clnicID); } - } else if (result['ProjectId'] == 0 && - clnicID.length > 0 && - result['DoctorId'].length > 0) { + } else if (result['ProjectId'] == 0 && clnicID.length > 0 && result['DoctorId'].length > 0) { if (clnicID.length == 1) { getDoctorsList( result['ProjectId'], @@ -394,12 +378,11 @@ class _SearchBot extends State { } getDoctorProfile(projectId, clinicId, doctorId, context, doctorData) { + int languageID = projectProvider.isArabic ? 1 : 2; List docProfileList = []; DoctorsListService service = new DoctorsListService(); - service - .getDoctorsProfile(doctorId, clinicId, projectId, context) - .then((res) { + service.getDoctorsProfile(doctorId, clinicId, projectId, languageID, context).then((res) { if (res['MessageStatus'] == 1) { if (res['DoctorProfileList'].length != 0) { res['DoctorProfileList'].forEach((v) { @@ -407,8 +390,7 @@ class _SearchBot extends State { }); } - navigateToDoctorProfile(context, doctorData[0], docProfileList[0], - isAppo: true); + navigateToDoctorProfile(context, doctorData[0], docProfileList[0], isAppo: true); //speak(); } }).catchError((err) { @@ -417,33 +399,27 @@ class _SearchBot extends State { } getDoctorsList(projectId, clinicId, context, {doctorId, doctorName}) { + int languageID = projectProvider.isArabic ? 1 : 2; List doctorsList = []; List arr = []; List arrDistance = []; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getDoctorsList(clinicId, projectId, false, context, - doctorId: doctorId, doctorName: doctorName) - .then((res) { + service.getDoctorsList(clinicId, projectId, false, languageID, context, doctorId: doctorId, doctorName: doctorName).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - if (res['SearchDoctorsByTime_IsVoiceCommandList'] != null && - res['SearchDoctorsByTime_IsVoiceCommandList'].length != 0) { + if (res['SearchDoctorsByTime_IsVoiceCommandList'] != null && res['SearchDoctorsByTime_IsVoiceCommandList'].length != 0) { doctorsList.clear(); res['SearchDoctorsByTime_IsVoiceCommandList'].forEach((v1) { v1['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); arr.add(new DoctorList.fromJson(v).projectName); - arrDistance.add(new DoctorList.fromJson(v) - .projectDistanceInKiloMeters - .toString()); + arrDistance.add(new DoctorList.fromJson(v).projectDistanceInKiloMeters.toString()); }); }); if (doctorsList.length == 1) { - getDoctorProfile( - projectId, clinicId, doctorId[0], context, doctorsList); + getDoctorProfile(projectId, clinicId, doctorId[0], context, doctorsList); //speak(); } else { @@ -455,14 +431,11 @@ class _SearchBot extends State { res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); arr.add(new DoctorList.fromJson(v).projectName); - arrDistance.add(new DoctorList.fromJson(v) - .projectDistanceInKiloMeters - .toString()); + arrDistance.add(new DoctorList.fromJson(v).projectDistanceInKiloMeters.toString()); }); if (doctorsList.length == 1) { - getDoctorProfile( - projectId, clinicId, doctorId[0], context, doctorsList); + getDoctorProfile(projectId, clinicId, doctorId[0], context, doctorsList); //speak(); } else { @@ -479,8 +452,7 @@ class _SearchBot extends State { }); } - Future navigateToDoctorProfile(context, docObject, docProfile, - {isAppo}) async { + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { Navigator.push( context, FadePage( @@ -497,11 +469,7 @@ class _SearchBot extends State { Navigator.push( context, FadePage( - page: BranchView( - doctorsList: docList, - result: result, - num: numAll, - resultDistance: arrDistance), + page: BranchView(doctorsList: docList, result: result, num: numAll, resultDistance: arrDistance), ), ); } diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 8e5c16b5..41f6f6cb 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -729,10 +729,11 @@ class _FloatingSearchButton extends State with TickerProvi } getDoctorProfile(projectId, clinicId, doctorId, context, doctorData) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; List docProfileList = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsProfile(doctorId, clinicId, projectId, context).then((res) { + service.getDoctorsProfile(doctorId, clinicId, projectId, languageID, context).then((res) { if (res['MessageStatus'] == 1) { if (res['DoctorProfileList'].length != 0) { res['DoctorProfileList'].forEach((v) { @@ -749,12 +750,13 @@ class _FloatingSearchButton extends State with TickerProvi } getDoctorsList(projectId, clinicId, context, {doctorId, doctorName, isNearest = false}) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; List doctorsList = []; List arr = []; List arrDistance = []; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.getDoctorsList(clinicId, projectId, isNearest, context, doctorId: doctorId, doctorName: doctorName).then((res) { + service.getDoctorsList(clinicId, projectId, isNearest, languageID, context, doctorId: doctorId, doctorName: doctorName).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/pubspec.yaml b/pubspec.yaml index 4e49ef9d..58c83fe0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.035+4050035 +version: 4.5.037+4050037 environment: sdk: ">=2.7.0 <3.0.0" From cfa341aba5a4e25989af73bcdfdf0864323ca2f6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Fri, 22 Dec 2023 14:35:59 +0300 Subject: [PATCH 33/71] Apple Pay Updates --- .../LiveCare/ApplePayInsertRequest.dart | 1 + lib/pages/ToDoList/ToDo.dart | 92 +++++++++- .../medical/balance/confirm_payment_page.dart | 169 +++++++++--------- 3 files changed, 173 insertions(+), 89 deletions(-) diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart index aa4e316b..0272bd9e 100644 --- a/lib/models/LiveCare/ApplePayInsertRequest.dart +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -157,6 +157,7 @@ class ApplePayInsertRequest { data['Service_ID'] = this.serviceID; data['Channel_ID'] = this.channelID; data['PatientID'] = this.patientID; + data['PatientId'] = this.patientID; data['PatientTypeID'] = this.patientTypeID; data['PatientOutSA'] = this.patientOutSA; data['AppointmentDate'] = this.appointmentDate; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 30c043e5..2ba88f10 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,7 +1,9 @@ +import 'dart:developer'; import 'dart:io'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -10,6 +12,7 @@ import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResp import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_list_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; @@ -21,6 +24,9 @@ import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dar import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -1299,12 +1305,96 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (value != null) { final appType = appo.isLiveCareAppointment ? 'livecare' : 'regular'; - openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + if (selectedPaymentMethod == "ApplePay") { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } projectViewModel.analytics.appointment.payment_method(appointment_type: appType, clinic: appo.clinicName, payment_method: value[0], payment_type: 'appointment'); } }); } + void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { + String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context.read().getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum()).then((value) { + payfortProjectDetailsRespModel = value; + }); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = appo.clinicID; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = appo.doctorID; + applePayInsertRequest.projectID = appo.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = appo.appointmentDate; + applePayInsertRequest.appointmentNo = appo.appointmentNo; + applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = patientShareResponse.patientShareWithTax.toString(); + applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Appointment Payment", + orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + // GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } + confirmAppointment(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index da9f79e1..b754b987 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -221,85 +221,7 @@ class _ConfirmPaymentPageState extends State { () async { if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { if (widget.selectedPaymentMethod == "ApplePay") { - transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); - print("TransactionID: $transID"); - GifLoaderDialogUtils.showMyDialog(context); - - LiveCareService service = new LiveCareService(); - ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); - - PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; - await context - .read() - .getProjectDetailsForPayfort(projectId: widget.advanceModel.hospitalsModel.iD, serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum()) - .then((value) { - payfortProjectDetailsRespModel = value; - }); - - applePayInsertRequest.clientRequestID = transID; - applePayInsertRequest.clinicID = 0; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; - applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); - applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); - applePayInsertRequest.doctorID = 0; - applePayInsertRequest.projectID = widget.advanceModel.hospitalsModel.iD.toString(); - applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); - applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; - applePayInsertRequest.appointmentDate = null; - applePayInsertRequest.appointmentNo = 0; - applePayInsertRequest.orderDescription = "Advance Payment"; - applePayInsertRequest.liveServiceID = "0"; - applePayInsertRequest.latitude = "0.0"; - applePayInsertRequest.longitude = "0.0"; - applePayInsertRequest.amount = widget.advanceModel.amount.toString(); - applePayInsertRequest.isSchedule = "0"; - applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; - applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; - applePayInsertRequest.paymentOption = "ApplePay"; - - applePayInsertRequest.isMobSDK = true; - applePayInsertRequest.merchantReference = transID; - applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; - applePayInsertRequest.commandType = "PURCHASE"; - applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; - applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; - applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; - applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; - applePayInsertRequest.returnURL = ""; - - service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { - // GifLoaderDialogUtils.hideDialog(context); - await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - orderDescription: "Advance Payment", - orderAmount: double.parse(widget.advanceModel.amount), - merchantReference: transID, - payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - onFailed: (failureResult) async { - log("failureResult: ${failureResult.toString()}"); - }, - onSuccess: (successResult) async { - log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); - checkPaymentStatus(AppoitmentAllHistoryResultList()); - }, - projectId: widget.advanceModel.hospitalsModel.iD, - serviceTypeEnum: ServiceTypeEnum.advancePayment, - ); - }).catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - }); + startApplePay(); } else { openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); } @@ -311,14 +233,6 @@ class _ConfirmPaymentPageState extends State { }); } projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); - - // startApplePay(); - // if() - // GifLoaderDialogUtils.showMyDialog(context); - // model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { - // GifLoaderDialogUtils.hideDialog(context); - // if (model.state = ViewState.ErrorLocal && model.state = ViewState.Error) showSMSDialog(model); - // }); }, ), ), @@ -327,7 +241,86 @@ class _ConfirmPaymentPageState extends State { ); } - void addPayFortApplePayResponse() {} + void startApplePay() async { + transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context + .read() + .getProjectDetailsForPayfort(projectId: widget.advanceModel.hospitalsModel.iD, serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum()) + .then((value) { + payfortProjectDetailsRespModel = value; + }); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = 0; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = 0; + applePayInsertRequest.projectID = widget.advanceModel.hospitalsModel.iD.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = null; + applePayInsertRequest.appointmentNo = 0; + applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = widget.advanceModel.amount.toString(); + applePayInsertRequest.isSchedule = "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Advance Payment", + orderAmount: double.parse(widget.advanceModel.amount), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(AppoitmentAllHistoryResultList()); + }, + projectId: widget.advanceModel.hospitalsModel.iD, + serviceTypeEnum: ServiceTypeEnum.advancePayment, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } String getApplePayPaymentType(dynamic paymentMethod) { switch (paymentMethod) { From aa04e943efb13160898a1206f6ad31fc84cba4c8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 31 Dec 2023 17:03:08 +0300 Subject: [PATCH 34/71] updates & fixes --- lib/config/config.dart | 2 +- .../service/appointment_rate_service.dart | 3 +- lib/core/service/client/base_app_client.dart | 4 +- .../appointment_rate_view_model.dart | 4 +- lib/pages/BookAppointment/QRCode.dart | 36 ++++----- lib/pages/MyAppointments/MyAppointments.dart | 5 +- lib/pages/MyAppointments/VisitTicket.dart | 7 +- .../widgets/AppointmentActions.dart | 6 +- lib/pages/ToDoList/ToDo.dart | 3 +- lib/pages/feedback/send_feedback_page.dart | 7 +- lib/pages/landing/landing_page.dart | 32 ++++---- lib/pages/livecare/widgets/clinic_card.dart | 4 +- lib/pages/livecare/widgets/clinic_list.dart | 2 +- lib/pages/login/confirm-login.dart | 56 ++++++++++---- lib/pages/login/login.dart | 75 +++++++++---------- .../rate_appointment_clinic.dart | 37 +++++---- .../rate_appointment_doctor.dart | 36 +++++---- .../appointment_services/GetDoctorsList.dart | 11 ++- .../livecare_services/livecare_provider.dart | 13 +++- lib/widgets/drawer/app_drawer_widget.dart | 1 + 20 files changed, 207 insertions(+), 137 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 6666141f..e7635e5b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -342,7 +342,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.6; +var VERSION_ID = 11.7; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/core/service/appointment_rate_service.dart b/lib/core/service/appointment_rate_service.dart index 848aeb48..446b5d6b 100644 --- a/lib/core/service/appointment_rate_service.dart +++ b/lib/core/service/appointment_rate_service.dart @@ -36,7 +36,7 @@ class AppointmentRateService extends BaseService { }, body: bodyData); } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, int languageID) async { hasError = false; AppointmentRate appointmentRate = AppointmentRate(); appointmentRate.rate = rate; @@ -47,6 +47,7 @@ class AppointmentRateService extends BaseService { appointmentRate.note = note; appointmentRate.createdBy = 2; appointmentRate.editedBy = 2; + appointmentRate.languageID = languageID; await baseAppClient.post(NEW_RATE_APPOINTMENT_URL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 54235646..26bacebe 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -77,7 +77,7 @@ class BaseAppClient { if (body.containsKey('LanguageID')) { if(body['LanguageID'] != null) { //change this line because language issue happened on dental - body['LanguageID'] = body['LanguageID'] =='ar' ? "1" : body['LanguageID'] =='en' ? '2' : body['LanguageID']; + body['LanguageID'] = body['LanguageID'] =='ar' ? 1 : body['LanguageID'] =='en' ? 2 : body['LanguageID']; } else { body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; } @@ -170,7 +170,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 1231755; //3844083 + // body['PatientID'] = 1014144; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index 9396c2f5..1817c23d 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -35,9 +35,9 @@ class AppointmentRateViewModel extends BaseViewModel { } } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, int languageID) async { setState(ViewState.Busy); - await _appointmentRateService.sendAppointmentRate(rate, appointmentNo, projectID, doctorID, clinicID, note); + await _appointmentRateService.sendAppointmentRate(rate, appointmentNo, projectID, doctorID, clinicID, note, languageID); if (_appointmentRateService.hasError) { error = _appointmentRateService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 3b7e6300..90e39767 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; @@ -63,7 +64,7 @@ class _QRCodeState extends State { widget.authUser = new AuthenticatedUser(); // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - // startNFCScan(); + // startNFCScan(); // }); super.initState(); @@ -213,19 +214,17 @@ class _QRCodeState extends State { optionsList.add( InkWell( onTap: () { - if (projectViewModel.havePrivilege(80) && _supportsNFC) { - startNFCScan(); - } else { - Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); + if (projectViewModel.havePrivilege(102)) { + startLocationCheckIn(); } }, child: MedicalProfileItem( - title: TranslationBase.of(context).scanNFC, - imagePath: 'contactless.svg', + title: TranslationBase.of(context).checkInViaLocation, + imagePath: 'location.svg', subTitle: "", - isEnable: projectViewModel.havePrivilege(80), - width: 80.0, - height: 80.0, + isEnable: projectViewModel.havePrivilege(102), + width: 70.0, + height: 70.0, ), ), ); @@ -251,17 +250,19 @@ class _QRCodeState extends State { optionsList.add( InkWell( onTap: () { - if (projectViewModel.havePrivilege(102)) { - startLocationCheckIn(); + if (projectViewModel.havePrivilege(80) && _supportsNFC) { + startNFCScan(); + } else { + Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); } }, child: MedicalProfileItem( - title: TranslationBase.of(context).checkInViaLocation, - imagePath: 'location.svg', + title: TranslationBase.of(context).scanNFC, + imagePath: 'contactless.svg', subTitle: "", - isEnable: projectViewModel.havePrivilege(102), - width: 70.0, - height: 70.0, + isEnable: projectViewModel.havePrivilege(80), + width: 80.0, + height: 80.0, ), ), ); @@ -378,6 +379,7 @@ class _QRCodeState extends State { child: const Text('OK'), onPressed: () { Navigator.of(context).pop(); + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); }, ), ], diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 31b8f85b..a53b231f 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -55,6 +55,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid int _currentPage = 0; ToDoCountProviderModel toDoProvider; + ProjectViewModel projectViewModel; @override void initState() { @@ -76,6 +77,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).myAppointmentsList, @@ -135,6 +137,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid } getPatientAppointmentHistory() { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); widget.appoList.clear(); @@ -150,7 +153,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid widget._patientConfirmedAppointmentListClinic.clear(); widget._patientArrivedAppointmentListClinic.clear(); - service.getPatientAppointmentHistory(false, context).then((res) { + service.getPatientAppointmentHistory(false, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { diff --git a/lib/pages/MyAppointments/VisitTicket.dart b/lib/pages/MyAppointments/VisitTicket.dart index c2f5c6ed..a1b44b7a 100644 --- a/lib/pages/MyAppointments/VisitTicket.dart +++ b/lib/pages/MyAppointments/VisitTicket.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class VisitTicket extends StatefulWidget { List appoList = []; @@ -17,6 +19,7 @@ class VisitTicket extends StatefulWidget { class _VisitTicketState extends State { bool isLoading = false; + ProjectViewModel projectViewModel; @override void initState() { @@ -26,6 +29,7 @@ class _VisitTicketState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, body: isLoading == false @@ -48,9 +52,10 @@ class _VisitTicketState extends State { } getPatientAppointmentCurfewHistory(BuildContext context) { + int languageID = projectViewModel.isArabic ? 1 : 2; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.getPatientAppointmentHistory(true, context).then((res) { + service.getPatientAppointmentHistory(true, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index b7083b7c..86a80be2 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -365,10 +365,11 @@ class _AppointmentActionsState extends State { // } openAppointmentLabResults() { + int languageID = widget.projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); PatientLabOrders patientLabOrders = new PatientLabOrders(); - service.getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, widget.appo.projectID, widget.appo.clinicID, context).then((res) { + service.getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, widget.appo.projectID, widget.appo.clinicID, languageID, context).then((res) { print(res['ListLabResultsByAppNo']); GifLoaderDialogUtils.hideDialog(context); if (res['ListLabResultsByAppNo'] != null) { @@ -400,10 +401,11 @@ class _AppointmentActionsState extends State { } openAppointmentRadiology() { + int languageID = widget.projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); FinalRadiology finalRadiology = new FinalRadiology(); - service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context).then((res) { + service.getPatientRadOrders(widget.appo.appointmentNo.toString(), languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['FinalRadiologyList'] != null) { print(res['FinalRadiologyList']); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 30c043e5..9a2d73bc 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -823,9 +823,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } getPatientAppointmentHistory() { + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getPatientAppointmentHistory(true, context).then((res) { + service.getPatientAppointmentHistory(true, languageID, context).then((res) { widget.appoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 06e9560b..cc24d511 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -56,6 +56,8 @@ class _SendFeedbackPageState extends State { List appoList = []; + ProjectViewModel projectViewModel; + String getSelected(BuildContext context) { switch (messageType) { case MessageType.ComplaintOnAnAppointment: @@ -106,7 +108,7 @@ class _SendFeedbackPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( allowAny: true, builder: (_, model, widget) => AppScaffold( @@ -466,6 +468,7 @@ class _SendFeedbackPageState extends State { listData: list, selectedIndex: selectedStatusIndex, onValueSelected: (index) { + int languageID = projectViewModel.isArabic ? 1 : 2; selectedStatusIndex = index; if (index == 1) { @@ -485,7 +488,7 @@ class _SendFeedbackPageState extends State { if (messageType == MessageType.ComplaintOnAnAppointment) { appoList.clear(); GifLoaderDialogUtils.showMyDialog(context); - service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) { + service.getPatientAppointmentHistory(false, languageID, context, isForCOC: true).then((res) { GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 7e56896f..1cebe35d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -655,22 +655,22 @@ class _LandingPageState extends State with WidgetsBindingObserver { FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); } }); - if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) { - int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; - appointmentRateViewModel.getIsLastAppointmentRatedList(languageID).then((value) async { - if (appointmentRateViewModel.isHaveAppointmentNotRate) { - await AppSharedPreferences().setBool(IS_LAST_APPOINTMENT_RATE_SHOWN, true); - Navigator.push( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - ); - } - }).catchError((err) { - print(err); - }); - } + // if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) { + // int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + // appointmentRateViewModel.getIsLastAppointmentRatedList(languageID).then((value) async { + // if (appointmentRateViewModel.isHaveAppointmentNotRate) { + // await AppSharedPreferences().setBool(IS_LAST_APPOINTMENT_RATE_SHOWN, true); + // Navigator.push( + // context, + // FadePage( + // page: RateAppointmentDoctor(), + // ), + // ); + // } + // }).catchError((err) { + // print(err); + // }); + // } }); } projectViewModel.analytics.setUser(data); diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index d6fb745a..e79037fe 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -163,10 +163,10 @@ class _State extends State { } getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { - + int languageID = widget.languageID == 'ar' ? 1 : 2; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index bbf7a159..437e93c9 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -513,7 +513,7 @@ class _clinic_listState extends State { isDataLoaded = false; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getLivecareClinics(context).then((res) { + service.getLivecareClinics(languageID == 'ar' ? 1: 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['PatientER_GetClinicsList'].length); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index b99e7c07..d4c8b17f 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -663,11 +663,11 @@ class _ConfirmLogin extends State { } checkIfUserAgreedBefore(CheckActivationCode result) { - if (result.isNeedUserAgreement == true) { - //move to agreement page. - } else { - goToHome(); - } + // if (result.isNeedUserAgreement == true) { + //move to agreement page. + // } else { + goToHome(); + // } } insertIMEI() { @@ -695,17 +695,45 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - GifLoaderDialogUtils.hideDialog(context); - + // GifLoaderDialogUtils.hideDialog(context); getToDoCount(); + appointmentRateViewModel + .getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2) + .then((value) => { + GifLoaderDialogUtils.hideDialog(AppGlobal.context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + }, + insertIMEI() + }) + .catchError((err) { + print(err); + }); - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false); - insertIMEI(); + // getToDoCount(); + + // Navigator.pushAndRemoveUntil( + // context, + // FadePage( + // page: LandingPage(), + // ), + // (r) => false); + // insertIMEI(); } loading(flag) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 107db2c3..69ff8dbb 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -345,45 +345,44 @@ class _Login extends State { authenticatedUserObject.user = result.list; projectViewModel.user = authenticatedUserObject.user; - GifLoaderDialogUtils.hideDialog(context); - + // GifLoaderDialogUtils.hideDialog(context); + // + // getToDoCount(); + // + // Navigator.pushAndRemoveUntil( + // context, + // FadePage( + // page: LandingPage(), + // ), + // (r) => false); getToDoCount(); - - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false); - - // appointmentRateViewModel - // .getIsLastAppointmentRatedList() - // .then((value) => { - // getToDoCount(), - // GifLoaderDialogUtils.hideDialog(context), - // if (appointmentRateViewModel.isHaveAppointmentNotRate) - // { - // Navigator.pushAndRemoveUntil( - // context, - // FadePage( - // page: RateAppointmentDoctor(), - // ), - // (r) => false) - // } - // else - // { - // Navigator.pushAndRemoveUntil( - // context, - // FadePage( - // page: LandingPage(), - // ), - // (r) => false) - // } - // }) - // .catchError((err) { - // print(err); - // GifLoaderDialogUtils.hideDialog(context); - // }); + appointmentRateViewModel + .getIsLastAppointmentRatedList(projectViewModel.isArabic ? 1 : 2) + .then((value) => { + GifLoaderDialogUtils.hideDialog(context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); }); } diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 09b083cc..eabe9528 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -32,10 +32,11 @@ class _RateAppointmentClinicState extends State { final formKey = GlobalKey(); String note = ""; int rating = 0; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -191,18 +192,27 @@ class _RateAppointmentClinicState extends State { child: DefaultButton( TranslationBase.of(context).later, () { - // Navigator.pushReplacement( - // context, - // FadePage( - // page: LandingPage(), - // ), - // ); - Navigator.pop( - context, - ); - Navigator.pop( + Navigator.pushReplacement( context, + FadePage( + page: LandingPage(), + ), ); + // if (projectViewModel.isLoginChild) { + // Navigator.pushReplacement( + // context, + // FadePage( + // page: LandingPage(), + // ), + // ); + // } else { + // Navigator.pop( + // context, + // // FadePage( + // // page: LandingPage(), + // // ), + // ); + // } }, color: CustomColors.accentColor, textColor: Colors.white, @@ -215,9 +225,10 @@ class _RateAppointmentClinicState extends State { rating <= 0 ? null : () { + int languageID = projectViewModel.isArabic ? 1 : 2; model - .sendAppointmentRate( - rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note) + .sendAppointmentRate(rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, + widget.appointmentDetails.clinicID, note, languageID) .then( (value) => { model diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index aa49d15a..6aa627f8 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -193,21 +193,27 @@ class _RateAppointmentDoctorState extends State { }); dialog.showAlertDialog(context); } else { - if(projectViewModel.isLoginChild) { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ); - } else { - Navigator.pop( - context, - // FadePage( - // page: LandingPage(), - // ), - ); - } + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + // if(projectViewModel.isLoginChild) { + // Navigator.pushReplacement( + // context, + // FadePage( + // page: LandingPage(), + // ), + // ); + // } else { + // Navigator.pop( + // context, + // // FadePage( + // // page: LandingPage(), + // // ), + // ); + // } } }, color: CustomColors.accentColor, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 94766e3c..910c2680 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -604,7 +604,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentHistory(bool isActiveAppointment, BuildContext context, {bool isForCOC = false}) async { + Future getPatientAppointmentHistory(bool isActiveAppointment, int languageID, BuildContext context, {bool isForCOC = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -626,7 +626,8 @@ class DoctorsListService extends BaseService { "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, "IsComingFromCOC": isForCOC, - "PatientType": authUser.patientType + "PatientType": authUser.patientType, + "LanguageID": languageID }; dynamic localRes; @@ -1162,7 +1163,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientRadOrders(String appoNo, BuildContext context) async { + Future getPatientRadOrders(String appoNo, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1182,6 +1183,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1194,7 +1196,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientLabOrdersByAppoNo(dynamic appoNo, dynamic projID, dynamic clinicID, BuildContext context) async { + Future getPatientLabOrdersByAppoNo(dynamic appoNo, dynamic projID, dynamic clinicID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1216,6 +1218,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 126f5a73..b0262ea5 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -17,7 +17,7 @@ class LiveCareService extends BaseService { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - Future getLivecareClinics(BuildContext context) async { + Future getLivecareClinics(int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -25,7 +25,12 @@ class LiveCareService extends BaseService { authUser = data; } - request = {"Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0}; + request = { + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID + }; dynamic localRes; @@ -122,7 +127,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getLivecareClinicTiming(int serviceID, BuildContext context) async { + Future getLivecareClinicTiming(int serviceID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -132,6 +137,7 @@ class LiveCareService extends BaseService { request = { "ServiceID": serviceID, + "LanguageID": languageID, "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -354,5 +360,4 @@ class LiveCareService extends BaseService { }, body: request); return Future.value(localRes); } - } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 408b0afc..28ff1833 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -42,6 +42,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + // import 'package:flutter_amazonpaymentservices/environment_type.dart'; // import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; From fddb4234517c5f39e2d1199c8aaee11f5c250fc1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 1 Jan 2024 18:01:39 +0300 Subject: [PATCH 35/71] Updates & fixes --- lib/config/config.dart | 8 +- lib/config/localized_values.dart | 2 + lib/core/service/client/base_app_client.dart | 4 +- .../viewModels/notifications_view_model.dart | 2 +- .../Appointments/toDoCountProviderModel.dart | 6 +- lib/pages/BookAppointment/BookConfirm.dart | 8 +- .../Covid-DriveThru/Covid-TimeSlots.dart | 8 +- lib/pages/DrawerPages/family/my-family.dart | 5 +- .../MyAppointments/AppointmentDetails.dart | 27 +++- lib/pages/MyAppointments/MyAppointments.dart | 117 ++++++++++++------ .../ToDoList/ObGyne/ObGyne-TimeSlots.dart | 5 +- lib/pages/ToDoList/ToDo.dart | 7 +- .../fragments/home_page_fragment2.dart | 2 +- lib/pages/landing/landing_page.dart | 9 +- lib/pages/livecare/widgets/clinic_list.dart | 3 +- lib/pages/login/confirm-login.dart | 5 +- lib/pages/login/login.dart | 5 +- lib/pages/login/register-info.dart | 5 +- .../appointment_services/GetDoctorsList.dart | 9 +- .../authentication/auth_provider.dart | 2 +- .../livecare_services/livecare_provider.dart | 3 +- lib/uitl/translations_delegate_base.dart | 2 + .../bottom_navigation_item.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 5 +- 24 files changed, 169 insertions(+), 82 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e7635e5b..7652d6f0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,10 +21,10 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; //var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; - // var BASE_URL = 'http://10.20.200.111:1010/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'http://10.20.200.111:1010/'; + // 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/'; @@ -342,7 +342,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.7; +var VERSION_ID = 11.8; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ba17f2ec..cc45dfeb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1903,4 +1903,6 @@ const Map localizedValues = { "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": "يرجى التأكد من تواجدك داخل موقع المستشفى لإجراء تسجيل الوصول عبر الإنترنت."}, + "upcoming": {"en": "Upcoming", "ar": "المواعيد القادمة"}, + "noUpcomingAppointment": {"en": "No upcoming appointments", "ar": "لا توجد مواعيد القادمة"}, }; \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 26bacebe..c234304f 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -170,7 +170,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 1014144; //3844083 + // body['PatientID'] = 291367; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 @@ -710,7 +710,7 @@ class BaseAppClient { var model = Provider.of(AppGlobal.context, listen: false); _vitalSignService.weightKg = ""; _vitalSignService.heightCm = ""; - model.setState(0, false, null); + model.setState(0, 0, false, null); Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } diff --git a/lib/core/viewModels/notifications_view_model.dart b/lib/core/viewModels/notifications_view_model.dart index 80e89edb..a520f36e 100644 --- a/lib/core/viewModels/notifications_view_model.dart +++ b/lib/core/viewModels/notifications_view_model.dart @@ -39,7 +39,7 @@ class NotificationViewModel extends BaseViewModel { await authService.getDashboard().then((value) { var notificationCount = ''; notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - model.setState(model.count, true, notificationCount); + model.setState(model.count, 0, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); }); diff --git a/lib/models/Appointments/toDoCountProviderModel.dart b/lib/models/Appointments/toDoCountProviderModel.dart index 3363471f..cf2c0ca4 100644 --- a/lib/models/Appointments/toDoCountProviderModel.dart +++ b/lib/models/Appointments/toDoCountProviderModel.dart @@ -2,19 +2,23 @@ import 'package:flutter/cupertino.dart'; class ToDoCountProviderModel with ChangeNotifier { int _count; + int _ancillaryCount; String _notificationsCount; bool _isShowBadge = false; int get count => _count == null ? 0 : _count; + int get ancillaryCount => _ancillaryCount == null ? 0 : _ancillaryCount; + String get notificationsCount => _notificationsCount == null ? "0" : _notificationsCount; bool get isShowBadge => _isShowBadge; - void setState(int count, bool isShowBadge, String notifCount) { + void setState(int count, int ancillaryCount, bool isShowBadge, String notifCount) { _count = count; _isShowBadge = isShowBadge; _notificationsCount = notifCount; + _ancillaryCount = ancillaryCount; notifyListeners(); } } \ No newline at end of file diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index bb4d153a..74f7c142 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -428,12 +428,13 @@ class _BookConfirmState extends State { } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); @@ -441,9 +442,10 @@ class _BookConfirmState extends State { } getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + int languageID = projectViewModel.isArabic ? 1 : 2; String errorMsg = ""; GifLoaderDialogUtils.showMyDialog(context); - widget.service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; if(res['OnlineCheckInAppointments'].length != 0) { diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 9b5c47a7..d5c60b20 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -468,12 +468,13 @@ class _CovidTimeSlotsState extends State with TickerProviderStat } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); @@ -499,8 +500,9 @@ class _CovidTimeSlotsState extends State with TickerProviderStat } getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + int languageID = projectViewModel.isArabic ? 1 : 2; DoctorsListService service = new DoctorsListService(); - service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index eedf36fc..9feb62ec 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -600,13 +600,14 @@ class _MyFamily extends State with TickerProviderStateMixin { } getToDoCount() async { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = ClinicListService(); try { var res = await service.getActiveAppointmentNo(context); print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} } catch (ex) { print("getToDoCount:$ex"); diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index ceee266b..67b165b8 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.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'; @@ -260,6 +261,19 @@ class _AppointmentDetailsState extends State with SingleTick ), ), ); + list.add( + SizedBox(width: 8), + ); + if (AppointmentType.isBooked(widget.appo)) + list.add( + Expanded( + child: DefaultButton( + TranslationBase.of(context).confirm, + confirmAppointment, + color: Color(0xff359846), + ), + ), + ); } else if (_tabController.index == 1) { list.add( Expanded( @@ -489,10 +503,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(); }, @@ -627,11 +641,12 @@ class _AppointmentDetailsState extends State with SingleTick } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index a53b231f..072c622e 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -25,7 +25,8 @@ import 'package:provider/provider.dart'; import 'AppointmentDetails.dart'; class MyAppointments extends StatefulWidget { - List appoList = []; + List upcomingAppoList = []; + List arrivedAppoListNew = []; List bookedAppoList = []; List confirmedAppoList = []; @@ -39,6 +40,9 @@ class MyAppointments extends StatefulWidget { List _patientConfirmedAppointmentListClinic = List(); List _patientArrivedAppointmentListClinic = List(); + List _patientBookedAndConfirmedAppointmentListHospital = List(); + List _patientBookedAndConfirmedAppointmentListClinic = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -52,7 +56,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid FilterType filterType; - int _currentPage = 0; + int _currentPage = 1; ToDoCountProviderModel toDoProvider; ProjectViewModel projectViewModel; @@ -61,7 +65,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid void initState() { filterType = FilterType.Clinic; WidgetsBinding.instance.addPostFrameCallback((_) { - if (Provider.of(context, listen: false).isLogin) getPatientAppointmentHistory(); + if (Provider.of(context, listen: false).isLogin) getPatientAppointmentHistory(true, false); }); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png')); @@ -86,7 +90,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid showNewAppBar: true, backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, - showDropDown: true, + showDropDown: false, dropdownIndexValue: _currentPage, dropDownIndexChange: (index) { setState(() { @@ -94,8 +98,8 @@ class _MyAppointmentsState extends State with SingleTickerProvid }); }, dropDownList: [ - TranslationBase.of(context).booked, - TranslationBase.of(context).confirmed, + // TranslationBase.of(context).booked, + TranslationBase.of(context).upcoming, TranslationBase.of(context).arrived, ], description: TranslationBase.of(context).infoMyAppointments, @@ -115,10 +119,10 @@ class _MyAppointmentsState extends State with SingleTickerProvid Padding( padding: EdgeInsets.only(left: 21, right: 21), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - myRadioButton(TranslationBase.of(context).booked, 0), - myRadioButton(TranslationBase.of(context).confirmed, 1), + myRadioButton(TranslationBase.of(context).upcoming, 1), + // myRadioButton(TranslationBase.of(context).upcoming, 1), myRadioButton(TranslationBase.of(context).arrived, 2), ], ), @@ -127,7 +131,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid ? Expanded( child: IndexedStack( index: _currentPage, - children: [getBookedAppointments(), getConfirmedAppointments(), getArrivedAppointments()], + children: [getBookedAppointments(), getBookedAndConfirmedAppointments(), getArrivedAppointments()], ), ) : Container(), @@ -136,11 +140,14 @@ class _MyAppointmentsState extends State with SingleTickerProvid ); } - getPatientAppointmentHistory() { + getPatientAppointmentHistory(bool isForUpcoming, bool isForArrived) { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - widget.appoList.clear(); + + widget.upcomingAppoList.clear(); + widget.arrivedAppoListNew.clear(); + widget.bookedAppoList.clear(); widget.confirmedAppoList.clear(); widget.arrivedAppoList.clear(); @@ -153,19 +160,23 @@ class _MyAppointmentsState extends State with SingleTickerProvid widget._patientConfirmedAppointmentListClinic.clear(); widget._patientArrivedAppointmentListClinic.clear(); - service.getPatientAppointmentHistory(false, languageID, context).then((res) { + widget._patientBookedAndConfirmedAppointmentListHospital.clear(); + widget._patientBookedAndConfirmedAppointmentListClinic.clear(); + + service.getPatientAppointmentHistory(false, languageID, context, isForUpcomming: isForUpcoming, IsForArrived: isForArrived).then((res) { GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { - // setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { - // isDataLoaded = true; res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + if (isForArrived) { + widget.arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v)); + } else { + widget.upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + } }); - sortAppointmentList(); + sortAppointmentList(isForUpcoming, isForArrived); } else {} - // }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -180,11 +191,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid } getToDoCount() { - toDoProvider.setState(0, true, "0"); + toDoProvider.setState(0, 0, true, "0"); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0"); } else {} }).catchError((err) { print(err); @@ -203,20 +215,36 @@ class _MyAppointmentsState extends State with SingleTickerProvid return AppointmentType.isBooked(appo); } - sortAppointmentList() { - widget.appoList.forEach((v) { - if (isBooked(v)) { - widget.bookedAppoList.add(v); - } + sortAppointmentList(bool isForUpcoming, bool isForArrived) { + if (isForArrived) { + widget.arrivedAppoListNew.forEach((v) { + if (isBooked(v)) { + widget.bookedAppoList.add(v); + } - if (isConfirmed(v)) { - widget.confirmedAppoList.add(v); - } + if (isConfirmed(v)) { + widget.confirmedAppoList.add(v); + } - if (isArrived(v)) { - widget.arrivedAppoList.add(v); - } - }); + if (isArrived(v)) { + widget.arrivedAppoList.add(v); + } + }); + } else { + widget.upcomingAppoList.forEach((v) { + if (isBooked(v)) { + widget.bookedAppoList.add(v); + } + + if (isConfirmed(v)) { + widget.confirmedAppoList.add(v); + } + + if (isArrived(v)) { + widget.arrivedAppoList.add(v); + } + }); + } widget.bookedAppoList.forEach((element) { List doctorByClinic = widget._patientBookedAppointmentListClinic @@ -242,6 +270,10 @@ class _MyAppointmentsState extends State with SingleTickerProvid } else { widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } + + //Merging Booked & Confirmed Appointments into Upcoming Tab + widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientBookedAppointmentListHospital); + widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientBookedAppointmentListClinic); }); widget.confirmedAppoList.forEach((element) { @@ -268,6 +300,10 @@ class _MyAppointmentsState extends State with SingleTickerProvid } else { widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } + + //Merging Booked & Confirmed Appointments into Upcoming Tab + widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientConfirmedAppointmentListHospital); + widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientConfirmedAppointmentListClinic); }); widget.arrivedAppoList.forEach((element) { @@ -295,7 +331,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } - openAppointmentsTab(); + // openAppointmentsTab(); }); } @@ -326,6 +362,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital); } + Widget getBookedAndConfirmedAppointments() { + return _getAppointment((widget.bookedAppoList.length + widget.confirmedAppoList.length), + (filterType == FilterType.Clinic) ? widget._patientBookedAndConfirmedAppointmentListClinic : widget._patientBookedAndConfirmedAppointmentListHospital); + } + Widget _getAppointment(int _listLength, List _list) { return Container( child: Container( @@ -341,7 +382,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid Container( margin: EdgeInsets.only(top: 10.0), child: Text( - _currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noConfirmedAppo : TranslationBase.of(context).noArrivedAppo), + _currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo), style: TextStyle( fontSize: 16.0, ), @@ -388,7 +429,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid ), ), ).then((value) { - getPatientAppointmentHistory(); + getPatientAppointmentHistory(true, false); }), isInOutPatient: _appointmentResult.isInOutPatient, name: _appointmentResult.doctorTitle + " " + _appointmentResult.doctorNameObj, @@ -453,6 +494,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid onChanged: (index) { setState(() { _currentPage = index; + if (_value == 1) { + getPatientAppointmentHistory(true, false); + } + if (_value == 2) { + getPatientAppointmentHistory(false, true); + } }); //_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut); }, diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index 970d31c7..ff3bc13c 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -402,13 +402,14 @@ class _CovidTimeSlotsState extends State with TickerProviderSta } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} Navigator.pushAndRemoveUntil( context, diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 9a2d73bc..b5f417e2 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -860,11 +860,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } getToDoCount() { - toDoProvider.setState(0, true, "0"); + toDoProvider.setState(0, 0, true, "0"); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0"); } else {} }).catchError((err) { print(err); @@ -919,13 +919,14 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } getPatientShare(context, AppoitmentAllHistoryResultList appo) { + int languageID = projectViewModel.isArabic ? 1 : 2; String errorMsg = ""; DoctorsListService service = new DoctorsListService(); if (appo.isLiveCareAppointment) { getLiveCareAppointmentPatientShare(context, service, appo); } else { GifLoaderDialogUtils.showMyDialog(context); - service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { + service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['OnlineCheckInAppointments'].length != 0) { widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index c25e9fd0..6d013e8b 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -67,7 +67,7 @@ class _HomePageFragment2State extends State { projectViewModel = Provider.of(context); initialiseHmgServices(false); var appoCountProvider = Provider.of(context); - var userProvider = Provider.of(context); + // var userProvider = Provider.of(context); List myMedicalList = Utils.myMedicalListHomePage(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); return Container( width: double.infinity, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 1cebe35d..601e7303 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -253,13 +253,14 @@ class _LandingPageState extends State with WidgetsBindingObserver { } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -453,7 +454,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { setState(() { notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - model.setState(model.count, true, notificationCount); + model.setState(model.count, 0, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); }) } @@ -650,7 +651,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { setState(() { if (value != null) { notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - model.setState(model.count, true, notificationCount); + model.setState(model.count, 0, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 437e93c9..d47e5117 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -492,8 +492,9 @@ class _clinic_listState extends State { addNewCallForPatientER(String clientRequestID) { LiveCareService service = new LiveCareService(); + int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); - service.addNewCallForPatientER(selectedClinicID, clientRequestID, widget.isPharmacyLiveCare, context).then((res) { + service.addNewCallForPatientER(selectedClinicID, clientRequestID, languageID, widget.isPharmacyLiveCare, context).then((res) { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: "New Call has been added successfully"); widget.getLiveCareHistory(); diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index d4c8b17f..7497856d 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -677,11 +677,12 @@ class _ConfirmLogin extends State { } getToDoCount() { - toDoProvider.setState(0, true, "0"); + toDoProvider.setState(0, 0, true, "0"); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0"); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 69ff8dbb..d55c4017 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -387,12 +387,13 @@ class _Login extends State { } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index e004663e..8b60295a 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -748,11 +748,12 @@ class _RegisterInfo extends State { } getToDoCount() { - toDoProvider.setState(0, true, "0"); + toDoProvider.setState(0, 0, true, "0"); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0"); } else {} }).catchError((err) { print(err); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 910c2680..02559d95 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -443,7 +443,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { + Future getPatientShare(String appoID, int clinicID, int projectID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -468,6 +468,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -604,7 +605,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentHistory(bool isActiveAppointment, int languageID, BuildContext context, {bool isForCOC = false}) async { + Future getPatientAppointmentHistory(bool isActiveAppointment, int languageID, BuildContext context, {bool isForCOC = false, isForUpcomming = false, IsForArrived = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -627,7 +628,9 @@ class DoctorsListService extends BaseService { "PatientTypeID": authUser.patientType, "IsComingFromCOC": isForCOC, "PatientType": authUser.patientType, - "LanguageID": languageID + "LanguageID": languageID, + "isForUpcomming": isForUpcomming, + "IsForArrived": IsForArrived }; dynamic localRes; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index ff8abbdc..9b1f1e3b 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -565,7 +565,7 @@ class AuthProvider with ChangeNotifier { await authenticatedUserObject.getUser(); Provider.of(AppGlobal.context, listen: false).isLogin = false; var model = Provider.of(AppGlobal.context, listen: false); - model.setState(0, false, null); + model.setState(0, 0, false, null); Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index b0262ea5..25df930d 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -209,7 +209,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future addNewCallForPatientER(int serviceID, String clientRequestID, bool isPharma, BuildContext context) async { + Future addNewCallForPatientER(int serviceID, String clientRequestID, int languageID, bool isPharma, BuildContext context) async { Map request; String deviceToken; @@ -237,6 +237,7 @@ class LiveCareService extends BaseService { "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID, "IsVoip": Platform.isIOS ? true : false }; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index e1f1ac74..03a76dc1 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2912,6 +2912,8 @@ class TranslationBase { String get validInsurance => localizedValues["validInsurance"][locale.languageCode]; String get checkInViaLocation => localizedValues["checkInViaLocation"][locale.languageCode]; String get locationCheckInError => localizedValues["locationCheckInError"][locale.languageCode]; + String get upcoming => localizedValues["upcoming"][locale.languageCode]; + String get noUpcomingAppointment => localizedValues["noUpcomingAppointment"][locale.languageCode]; } diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index f7cdafce..db5d0979 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -114,7 +114,7 @@ class BottomNavigationItem extends StatelessWidget { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(model.count.toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), + child: Text((model.count + model.ancillaryCount).toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), ), ), ), diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 28ff1833..8f3cf40c 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -752,12 +752,13 @@ class _AppDrawerState extends State { } getToDoCount() { - toDoProvider.setState(0, true, toDoProvider.notificationsCount); + toDoProvider.setState(0, 0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) { - toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + // toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); From 3401496739a30c4f1b0797c55ce0468c04dd714c Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 2 Jan 2024 14:16:10 +0300 Subject: [PATCH 36/71] Updates & fixes --- .../xcshareddata/xcschemes/Runner.xcscheme | 97 ------------------- lib/core/service/client/base_app_client.dart | 10 +- .../medical/ask_doctor_view_model.dart | 12 ++- lib/pages/DrawerPages/family/my-family.dart | 51 +++++----- lib/pages/MyAppointments/MyAppointments.dart | 1 - .../family_files/family_files_provider.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 2 +- 7 files changed, 40 insertions(+), 135 deletions(-) delete mode 100644 ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index ea96fe5f..00000000 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index c234304f..43b0a9b1 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -75,9 +75,13 @@ class BaseAppClient { body['Channel'] = CHANNEL; if (body.containsKey('LanguageID')) { - if(body['LanguageID'] != null) { + if (body['LanguageID'] != null) { //change this line because language issue happened on dental - body['LanguageID'] = body['LanguageID'] =='ar' ? 1 : body['LanguageID'] =='en' ? 2 : body['LanguageID']; + body['LanguageID'] = body['LanguageID'] == 'ar' + ? 1 + : body['LanguageID'] == 'en' + ? 2 + : body['LanguageID']; } else { body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; } @@ -716,7 +720,7 @@ class BaseAppClient { String getSessionId(String id) { ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); - return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); + if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); } static defaultHttpParameters() async { diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index abe2220c..9f8d9862 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -28,12 +28,14 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Error); } else if (_myDoctorService.patientDoctorAppointmentList.length != 0) { _myDoctorService.patientDoctorAppointmentList.forEach((element) { - List doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); + if (!element.isLiveCareClinic) { + List doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); - if (doctorByClinic.length != 0) { - patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); - } else { - patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + if (doctorByClinic.length != 0) { + patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); + } else { + patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + } } setState(ViewState.Idle); }); diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 9feb62ec..ef6f5e3d 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -341,8 +341,8 @@ class _MyFamily extends State with TickerProviderStateMixin { return requestDecoratedContainerWithExpandable( TranslationBase.of(context).sentRequest, [ - Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)), - Expanded(flex: 2, child: columnText(TranslationBase.of(context).status)), + Expanded(flex: 3, child: columnText(TranslationBase.of(context).name)), + Expanded(flex: 1, child: columnText(TranslationBase.of(context).status)), ], sentRecordsList.map((result) { return sentItemView(result); @@ -351,29 +351,26 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget sentItemView(GetAllSharedRecordsByStatusList result) { return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(flex: 2, child: rowText(result.patientName)), + Expanded(flex: 3, child: rowText(result.patientName)), Expanded( flex: 1, - child: Row( - children: [ - Container( - padding: EdgeInsets.only(top: 3, bottom: 3, left: 8, right: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), - ), - child: Text( - result.statusDescription != null ? result.statusDescription : "", - style: TextStyle( - fontSize: 10, - color: Colors.white, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), + child: Container( + padding: EdgeInsets.only(top: 3, bottom: 3, left: 8, right: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50), + color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), + ), + child: Text( + result.statusDescription != null ? result.statusDescription : "", + style: TextStyle( + fontSize: 10, + color: Colors.white, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, ), - ], + ), ), ), ], @@ -553,6 +550,7 @@ class _MyFamily extends State with TickerProviderStateMixin { List sentRecordsList = []; Future getFamilyFiles() async { + int languageID = projectViewModel.isArabic ? 1 : 2; GetAllSharedRecordsByStatusResponse familySharedRecords; if (await sharedPref.getObject(FAMILY_FILE) != null) { familySharedRecords = GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE)); @@ -560,7 +558,6 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { - int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; familySharedRecords = await familyFileProvider.getSharedRecordByStatus(languageID); } familySharedRecordsList =[]; @@ -573,7 +570,7 @@ class _MyFamily extends State with TickerProviderStateMixin { }); approvedRecordsList = []; pendingRecordsList = []; - GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(); + GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(languageID); pendingAndApprovedRecords.getAllSharedRecordsByStatusList.forEach((element) { print(element.toJson()); @@ -589,9 +586,9 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.hideDialog(context); } - Future getUserViewRequest() async { + Future getUserViewRequest(int languageID) async { var user = await sharedPref.getObject(USER_PROFILE); - return familyFileProvider.getUserViewRequest(user['PatientID']); + return familyFileProvider.getUserViewRequest(user['PatientID'], languageID); } Future getSentRequest() async { @@ -617,7 +614,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget columnText(String title) { return Text( title, - textAlign: TextAlign.left, + // textAlign: TextAlign.left, style: TextStyle( fontSize: 12, color: CustomColors.textDarkColor, @@ -630,7 +627,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget rowText(String title) { return Text( title, - textAlign: TextAlign.left, + // textAlign: TextAlign.left, style: TextStyle( fontSize: 10, color: CustomColors.textColor, diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 072c622e..b1477b77 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -501,7 +501,6 @@ class _MyAppointmentsState extends State with SingleTickerProvid getPatientAppointmentHistory(false, true); } }); - //_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut); }, ), ), diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 4b8b31ad..f209812e 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -61,7 +61,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserViewRequest(responseID) async { + Future getUserViewRequest(responseID, int languageID) async { try { dynamic localRes; Map request = {}; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 8f3cf40c..af6cd03f 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -669,7 +669,7 @@ class _AppDrawerState extends State { }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err.toString()); + // AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); }); } From 27b6e04d33421823191cb5839c3f0f8766b49df9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 2 Jan 2024 14:35:26 +0300 Subject: [PATCH 37/71] updates --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/config/config.dart | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index c3e46b58..db84daa7 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.75; + MARKETING_VERSION = 4.5.77; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.75; + MARKETING_VERSION = 4.5.77; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.75; + MARKETING_VERSION = 4.5.77; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index 7652d6f0..128264a2 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:4422/'; -//var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/pubspec.yaml b/pubspec.yaml index 58c83fe0..8fb7faae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.037+4050037 +version: 4.5.040+4050040 environment: sdk: ">=2.7.0 <3.0.0" From 75bfeaa71656b890003df5bb48c92855d4c0b4bb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 2 Jan 2024 17:00:05 +0300 Subject: [PATCH 38/71] My appointment fixes --- lib/core/service/client/base_app_client.dart | 6 +- lib/pages/MyAppointments/MyAppointments.dart | 132 ++++++++++--------- lib/widgets/drawer/app_drawer_widget.dart | 2 +- 3 files changed, 75 insertions(+), 65 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 43b0a9b1..d6b88e33 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -158,7 +158,8 @@ class BaseAppClient { ? body['PatientOutSA'] : user['OutSA'] : user['OutSA']; - body['SessionID'] = getSessionId(body['TokenID']); //getSe + body['SessionID'] = getSessionId(body['TokenID'] != null ? body['TokenID'] : ""); //getSe + // body['SessionID'] = body['TokenID']; //getSe headers = { 'Content-Type': 'application/json', @@ -720,7 +721,8 @@ class BaseAppClient { String getSessionId(String id) { ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); - if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); + // if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); + return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); } static defaultHttpParameters() async { diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index b1477b77..3d0eb15f 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -25,6 +25,11 @@ import 'package:provider/provider.dart'; import 'AppointmentDetails.dart'; class MyAppointments extends StatefulWidget { + @override + _MyAppointmentsState createState() => _MyAppointmentsState(); +} + +class _MyAppointmentsState extends State with SingleTickerProviderStateMixin { List upcomingAppoList = []; List arrivedAppoListNew = []; @@ -43,11 +48,6 @@ class MyAppointments extends StatefulWidget { List _patientBookedAndConfirmedAppointmentListHospital = List(); List _patientBookedAndConfirmedAppointmentListClinic = List(); - @override - _MyAppointmentsState createState() => _MyAppointmentsState(); -} - -class _MyAppointmentsState extends State with SingleTickerProviderStateMixin { bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); AuthenticatedUserObject authenticatedUserObject = locator(); @@ -145,23 +145,23 @@ class _MyAppointmentsState extends State with SingleTickerProvid GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - widget.upcomingAppoList.clear(); - widget.arrivedAppoListNew.clear(); + upcomingAppoList.clear(); + arrivedAppoListNew.clear(); - widget.bookedAppoList.clear(); - widget.confirmedAppoList.clear(); - widget.arrivedAppoList.clear(); + bookedAppoList.clear(); + confirmedAppoList.clear(); + arrivedAppoList.clear(); - widget._patientBookedAppointmentListHospital.clear(); - widget._patientConfirmedAppointmentListHospital.clear(); - widget._patientArrivedAppointmentListHospital.clear(); + _patientBookedAppointmentListHospital.clear(); + _patientConfirmedAppointmentListHospital.clear(); + _patientArrivedAppointmentListHospital.clear(); - widget._patientBookedAppointmentListClinic.clear(); - widget._patientConfirmedAppointmentListClinic.clear(); - widget._patientArrivedAppointmentListClinic.clear(); + _patientBookedAppointmentListClinic.clear(); + _patientConfirmedAppointmentListClinic.clear(); + _patientArrivedAppointmentListClinic.clear(); - widget._patientBookedAndConfirmedAppointmentListHospital.clear(); - widget._patientBookedAndConfirmedAppointmentListClinic.clear(); + _patientBookedAndConfirmedAppointmentListHospital.clear(); + _patientBookedAndConfirmedAppointmentListClinic.clear(); service.getPatientAppointmentHistory(false, languageID, context, isForUpcomming: isForUpcoming, IsForArrived: isForArrived).then((res) { GifLoaderDialogUtils.hideDialog(context); @@ -170,9 +170,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid if (res['AppoimentAllHistoryResultList'].length != 0) { res['AppoimentAllHistoryResultList'].forEach((v) { if (isForArrived) { - widget.arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v)); + arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v)); } else { - widget.upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); } }); sortAppointmentList(isForUpcoming, isForArrived); @@ -217,118 +217,118 @@ class _MyAppointmentsState extends State with SingleTickerProvid sortAppointmentList(bool isForUpcoming, bool isForArrived) { if (isForArrived) { - widget.arrivedAppoListNew.forEach((v) { + arrivedAppoListNew.forEach((v) { if (isBooked(v)) { - widget.bookedAppoList.add(v); + bookedAppoList.add(v); } if (isConfirmed(v)) { - widget.confirmedAppoList.add(v); + confirmedAppoList.add(v); } if (isArrived(v)) { - widget.arrivedAppoList.add(v); + arrivedAppoList.add(v); } }); } else { - widget.upcomingAppoList.forEach((v) { + upcomingAppoList.forEach((v) { if (isBooked(v)) { - widget.bookedAppoList.add(v); + bookedAppoList.add(v); } if (isConfirmed(v)) { - widget.confirmedAppoList.add(v); + confirmedAppoList.add(v); } if (isArrived(v)) { - widget.arrivedAppoList.add(v); + arrivedAppoList.add(v); } }); } - widget.bookedAppoList.forEach((element) { - List doctorByClinic = widget._patientBookedAppointmentListClinic + bookedAppoList.forEach((element) { + List doctorByClinic = _patientBookedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); + _patientBookedAppointmentListClinic[_patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientBookedAppointmentListHospital + List doctorByHospital = _patientBookedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + _patientBookedAppointmentListHospital[_patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } //Merging Booked & Confirmed Appointments into Upcoming Tab - widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientBookedAppointmentListHospital); - widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientBookedAppointmentListClinic); + _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientBookedAppointmentListHospital); + _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientBookedAppointmentListClinic); }); - widget.confirmedAppoList.forEach((element) { - List doctorByClinic = widget._patientConfirmedAppointmentListClinic + confirmedAppoList.forEach((element) { + List doctorByClinic = _patientConfirmedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); + _patientConfirmedAppointmentListClinic[_patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientConfirmedAppointmentListHospital + List doctorByHospital = _patientConfirmedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + _patientConfirmedAppointmentListHospital[_patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } //Merging Booked & Confirmed Appointments into Upcoming Tab - widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientConfirmedAppointmentListHospital); - widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientConfirmedAppointmentListClinic); + _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientConfirmedAppointmentListHospital); + _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientConfirmedAppointmentListClinic); }); - widget.arrivedAppoList.forEach((element) { - List doctorByClinic = widget._patientArrivedAppointmentListClinic + arrivedAppoList.forEach((element) { + List doctorByClinic = _patientArrivedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); + _patientArrivedAppointmentListClinic[_patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientArrivedAppointmentListHospital + List doctorByHospital = _patientArrivedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + _patientArrivedAppointmentListHospital[_patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } // openAppointmentsTab(); @@ -345,11 +345,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid } else if (flag == 3) { index = 2; } else { - if (widget._patientBookedAppointmentListClinic.length != 0) { + if (_patientBookedAppointmentListClinic.length != 0) { index = 0; - } else if (widget._patientConfirmedAppointmentListClinic.length != 0) { + } else if (_patientConfirmedAppointmentListClinic.length != 0) { index = 1; - } else if (widget._patientArrivedAppointmentListClinic.length != 0) { + } else if (_patientArrivedAppointmentListClinic.length != 0) { index = 2; // return; } @@ -359,12 +359,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid } Widget getBookedAppointments() { - return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital); + return _getAppointment(bookedAppoList.length, (filterType == FilterType.Clinic) ? _patientBookedAppointmentListClinic : _patientBookedAppointmentListHospital); } Widget getBookedAndConfirmedAppointments() { - return _getAppointment((widget.bookedAppoList.length + widget.confirmedAppoList.length), - (filterType == FilterType.Clinic) ? widget._patientBookedAndConfirmedAppointmentListClinic : widget._patientBookedAndConfirmedAppointmentListHospital); + return _getAppointment( + (bookedAppoList.length + confirmedAppoList.length), (filterType == FilterType.Clinic) ? _patientBookedAndConfirmedAppointmentListClinic : _patientBookedAndConfirmedAppointmentListHospital); } Widget _getAppointment(int _listLength, List _list) { @@ -382,7 +382,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid Container( margin: EdgeInsets.only(top: 10.0), child: Text( - _currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo), + _currentPage == 0 + ? TranslationBase.of(context).noBookedAppo + : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo), style: TextStyle( fontSize: 16.0, ), @@ -461,11 +463,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid } Widget getConfirmedAppointments() { - return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital); + return _getAppointment(confirmedAppoList.length, (filterType == FilterType.Clinic) ? _patientConfirmedAppointmentListClinic : _patientConfirmedAppointmentListHospital); } Widget getArrivedAppointments() { - return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital); + return _getAppointment(arrivedAppoList.length, (filterType == FilterType.Clinic) ? _patientArrivedAppointmentListClinic : _patientArrivedAppointmentListHospital); } setFilterType(FilterType filterType) { @@ -479,6 +481,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid onTap: () { setState(() { _currentPage = _value; + if (_value == 1) { + getPatientAppointmentHistory(true, false); + } + if (_value == 2) { + getPatientAppointmentHistory(false, true); + } }); }, child: Row( diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index af6cd03f..89d35885 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -706,7 +706,7 @@ class _AppDrawerState extends State { _vitalSignService.heightCm = ""; _vitalSignService.weightKg = ""; - if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); + // if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; From e5d8505c2d4791f69a405a6c1e42aabe7ed4f8c6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 3 Jan 2024 11:08:00 +0300 Subject: [PATCH 39/71] Updates & fixes --- lib/core/service/medical/labs_service.dart | 3 + lib/core/viewModels/er/rrt-view-model.dart | 8 +-- lib/pages/BookAppointment/BookConfirm.dart | 6 +- lib/pages/BookAppointment/BookSuccess.dart | 4 +- lib/pages/BookAppointment/DoctorProfile.dart | 4 +- .../components/LaserClinic.dart | 2 +- .../Covid-DriveThru/Covid-TimeSlots.dart | 4 +- .../rapid-response-team/rrt-main-screen.dart | 2 +- .../rapid-response-team/rrt-request-page.dart | 7 +- .../MyAppointments/AppointmentDetails.dart | 2 +- .../widgets/PrescriptionReport.dart | 8 ++- .../ToDoList/ObGyne/ObGyne-TimeSlots.dart | 4 +- lib/pages/ToDoList/ToDo.dart | 8 +-- lib/pages/medical/eye/EyeHomePage.dart | 5 +- .../appointment_services/GetDoctorsList.dart | 70 +++++++++++++------ lib/widgets/new_design/doctor_header.dart | 2 +- 16 files changed, 90 insertions(+), 49 deletions(-) diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 1d635c69..8e5ac3b4 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -191,6 +191,8 @@ class LabsService extends BaseService { body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID; body['Procedure'] = procedure; + body['Procedure'] = procedure; + body['LanguageID'] = 1; await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT, onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { @@ -223,6 +225,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; _requestSendLabReportEmail.isDownload = isDownload; _requestSendLabReportEmail.doctorID = patientLabOrder.doctorID; + _requestSendLabReportEmail.languageID = 1; await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) { if (isDownload) { diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index d615ef98..0ed0cf55 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -38,10 +38,10 @@ class RRTViewModel extends BaseViewModel { _RRTServiceData rrtServiceData = _RRTServiceData(); - Future<_RRTServiceData> loadRequiredData() async { + Future<_RRTServiceData> loadRequiredData(int languageID) async { // await getServicePrice(); // await getAllOrders(); - await getProcedureDetails(); + await getProcedureDetails(languageID); await getAllOrdersRC(); // getProcedureDetails(); return rrtServiceData; @@ -120,9 +120,9 @@ class RRTViewModel extends BaseViewModel { return rrtServiceData; } - Future<_RRTServiceData> getProcedureDetails() async { + Future<_RRTServiceData> getProcedureDetails(int languageID) async { DoctorsListService service = new DoctorsListService(); - await service.getRRTProcedures(15).then((res) { + await service.getRRTProcedures(15, languageID).then((res) { rrtProcedureList.clear(); var data = res["Vida_ProcedureList"]; data.forEach((json) { diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 74f7c142..63f58910 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -329,7 +329,7 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service - .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel) + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, null, null, projectViewModel) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -385,7 +385,7 @@ class _BookConfirmState extends State { widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { + widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context).then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); @@ -489,7 +489,7 @@ class _BookConfirmState extends State { } getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { - widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse, false); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index ea0f186b..52113d74 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -493,7 +493,7 @@ class _BookSuccessState extends State { setOnlineCheckInForAppointment() { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID, context).then((res) { + service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.clinicID = widget.docObject.clinicID; appo.projectID = widget.docObject.projectID; @@ -538,7 +538,7 @@ class _BookSuccessState extends State { GifLoaderDialogUtils.showMyDialog(context); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context) + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 426df212..1ad0bf67 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -234,7 +234,7 @@ class _DoctorProfileState extends State with TickerProviderStateM getDoctorRatings() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRating(widget.doctor.doctorID, context).then((res) { + service.getDoctorsRating(widget.doctor.doctorID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['NotesDoctorRatingList']); @@ -251,7 +251,7 @@ class _DoctorProfileState extends State with TickerProviderStateM getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.doctor.doctorID, context).then((res) { + service.getDoctorsRatingDetails(widget.doctor.doctorID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index c7e32565..61ca55d7 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -69,7 +69,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getLaserBodyPartsList(laserCategoryId, widget.selectedHospital.iD).then((res) { + service.getLaserBodyPartsList(laserCategoryId, widget.selectedHospital.iD, projectViewModel.isArabic ? 1 : 2).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index d5c60b20..8acf6efe 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -412,7 +412,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat insertCovidQuestionnaire(context, DoctorList docObject) async { DoctorsListService service = new DoctorsListService(); List qa = await sharedPref.getObject(COVID_QA_LIST); - service.insertCovidQuestionnaire(qa, widget.projectID, widget.selectedProject.testTypeEnum, widget.selectedProject.testProcedureEnum).then((res) { + service.insertCovidQuestionnaire(qa, widget.projectID, widget.selectedProject.testTypeEnum, projectViewModel.isArabic ? 1 : 2, widget.selectedProject.testProcedureEnum).then((res) { insertAppointmentCovidTest(context, docObject); }).catchError((err) { print(err); @@ -430,7 +430,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, 0, context, widget.selectedProcedure.procedureID, + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, 0, projectViewModel.isArabic ? 1 : 2, context, widget.selectedProcedure.procedureID, widget.selectedProject.testTypeEnum, widget.selectedProject.testProcedureEnum) .then((res) { if (res['MessageStatus'] == 1) { diff --git a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart index b56e28d5..ec1d5a23 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -56,7 +56,7 @@ class RRTMainScreenState extends State with SingleTickerProviderS onModelReady: (vm) async { viewModel = vm; loadingData = true; - await vm.loadRequiredData().then((value) {}).whenComplete(() => setState(() => loadingData = false)); + await vm.loadRequiredData(projectViewModel.isArabic ? 1 : 2).then((value) {}).whenComplete(() => setState(() => loadingData = false)); }, builder: (ctx, vm, widget) => content(), )); diff --git a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart index 8541b859..beada490 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/rrt/RRTProcedureList.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; @@ -16,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class RRTRequestPage extends StatefulWidget { final List pendingOrders; @@ -32,6 +34,8 @@ class RRTRequestPageState extends State { bool acceptTerms = false; VidaProcedureList selectedProcedure; + ProjectViewModel projectViewModel; + @override void initState() { // getProcedureDetails(); @@ -40,6 +44,7 @@ class RRTRequestPageState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (vm) { // viewModel = vm; @@ -272,7 +277,7 @@ class RRTRequestPageState extends State { getProcedureDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getRRTProcedures(15).then((res) { + service.getRRTProcedures(15, projectViewModel.isArabic ? 1 : 2).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['Vida_ProcedureList']); }).catchError((err) { diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 67b165b8..cd5597db 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -328,7 +328,7 @@ class _AppointmentDetailsState extends State with SingleTick void getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.appo.doctorID, context).then((res) { + service.getDoctorsRatingDetails(widget.appo.doctorID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart index 33c55ddd..69470f23 100644 --- a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -10,6 +11,7 @@ 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'; +import 'package:provider/provider.dart'; class PrescriptionReportPage extends StatefulWidget { List prescriptionReportEnhList; @@ -26,6 +28,9 @@ class PrescriptionReportPage extends StatefulWidget { } class _PrescriptionReportState extends State { + + ProjectViewModel projectViewModel; + @override void initState() { super.initState(); @@ -33,6 +38,7 @@ class _PrescriptionReportState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, appBarTitle: 'Items', @@ -117,7 +123,7 @@ class _PrescriptionReportState extends State { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service - .sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, + .sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, projectViewModel.isArabic ? 1 : 2, widget.listPres, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index ff3bc13c..242a072f 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -353,7 +353,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta AppoitmentAllHistoryResultList appo; service .insertAppointment( - docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, context, widget.obGyneProcedureListResponse.procedureId) + docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, projectViewModel.isArabic ? 1 : 2, context, widget.obGyneProcedureListResponse.procedureId) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -394,7 +394,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta DoctorsListService service = new DoctorsListService(); service .updateObGyneAppointment(widget.obGyneProcedureListResponse.episodeID, int.parse(appoNo), widget.obGyneProcedureListResponse.orderNo, widget.obGyneProcedureListResponse.procedureId, - widget.obGyneProcedureListResponse.lineItemNo, widget.obGyneProcedureListResponse.uniqueRowID) + widget.obGyneProcedureListResponse.lineItemNo, widget.obGyneProcedureListResponse.uniqueRowID, projectViewModel.isArabic ? 1 : 2) .then((res) {}) .catchError((err) { print(err); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index b5f417e2..5fb46243 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -776,7 +776,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); List doctorsList = []; List _patientDoctorAppointmentListHospital = []; - service.getOBGyneDoctorsList(projectID, setupID, context).then((res) { + service.getOBGyneDoctorsList(projectID, setupID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['HIS_ObgyneUltrasoundDoctorsList'][0]); if (res['MessageStatus'] == 1) { @@ -967,7 +967,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); - service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { + service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); @@ -1274,7 +1274,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context) + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); getPatientAppointmentHistory(); @@ -1334,7 +1334,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context) + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 901ce187..288689fb 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -36,6 +36,7 @@ class EyeHomePage extends StatefulWidget { class _EyeHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; List doctorDetailsList = List(); + ProjectViewModel projectViewModel; @override void initState() { @@ -54,7 +55,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -180,7 +181,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat void getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.appointmentAllHistoryResultList.doctorID, context).then((res) { + service.getDoctorsRatingDetails(widget.appointmentAllHistoryResultList.doctorID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 02559d95..8f47063c 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -174,7 +175,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating(int docID, context) async { + Future getDoctorsRating(int docID,int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -191,6 +192,7 @@ class DoctorsListService extends BaseService { "PatientID": 0, "License": true, "IsRegistered": true, + "LanguageID": languageID, "isDentalAllowedBackend": false }; @@ -224,7 +226,7 @@ class DoctorsListService extends BaseService { return Future.value(images); } - Future getDoctorsRatingDetails(int docID, context) async { + Future getDoctorsRatingDetails(int docID,int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -241,6 +243,7 @@ class DoctorsListService extends BaseService { "PatientID": 0, "License": true, "IsRegistered": true, + "LanguageID": languageID, "isDentalAllowedBackend": false }; @@ -273,6 +276,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; @@ -316,6 +320,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authUser.outSA, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; @@ -329,7 +334,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, BuildContext context, + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context, [String procedureID, num testTypeEnum, num testProcedureEnum, ProjectViewModel projectViewModel]) async { Map request; @@ -392,7 +397,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, BuildContext context) async { + Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -482,14 +487,14 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future setOnlineCheckInForAppointment(String appoID, int projectID, BuildContext context) async { + Future setOnlineCheckInForAppointment(String appoID, int projectID, int languageID, 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}; + request = {"ProjectID": projectID, "AppointmentNo": appoID, "LanguageID": languageID}; dynamic localRes; @@ -501,7 +506,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { + Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -527,6 +532,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -562,7 +568,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getOBGyneDoctorsList(int projectID, String setupID, BuildContext context) async { + Future getOBGyneDoctorsList(int projectID, String setupID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -579,6 +585,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -697,6 +704,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; @@ -710,7 +718,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, String appoDate, String clientRequestID, BuildContext context) async { + Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, String appoDate, String clientRequestID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -751,6 +759,7 @@ class DoctorsListService extends BaseService { "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType, "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), + "LanguageID": languageID, "IsVoip": Platform.isIOS ? true : false }; @@ -796,6 +805,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; @@ -834,6 +844,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; @@ -909,6 +920,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -955,6 +967,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -998,6 +1011,7 @@ class DoctorsListService extends BaseService { "PatientType": authUser.patientType, "DeviceToken": await sharedPref.getString(PUSH_TOKEN), "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), + "LanguageID": 1, "IsVoip": Platform.isIOS ? true : false }; @@ -1034,6 +1048,7 @@ class DoctorsListService extends BaseService { }); request = { + "LanguageID": 1, "RequestAncillaryOrderInvoice": [ {"MemberID": 102, "ProjectID": projectID, "AppointmentNo": appointmentID, "OrderNo": orderNo, "AncillaryOrderInvoiceProcList": selectedProcListAPI} ], @@ -1234,7 +1249,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientPrescriptionReports(AppoitmentAllHistoryResultList appo, BuildContext context) async { + Future getPatientPrescriptionReports(AppoitmentAllHistoryResultList appo, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1258,6 +1273,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1270,7 +1286,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendPrescriptionEmail(String appoDate, String setupId, dynamic prescriptionReportEnhList, BuildContext context) async { + Future sendPrescriptionEmail(String appoDate, String setupId, int languageID, dynamic prescriptionReportEnhList, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1297,6 +1313,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": authUser.patientType, "PatientType": authUser.patientType }; @@ -1340,6 +1357,7 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -1378,7 +1396,7 @@ class DoctorsListService extends BaseService { "PaymentMethod": paymentMethodName, "VersionID": req.VersionID, "Channel": req.Channel, - + "LanguageID": 1, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1414,6 +1432,7 @@ class DoctorsListService extends BaseService { "generalid": req.generalid, "PatientOutSA": authUser.outSA, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "ERAdvanceAmount": { "ProjectId": projectID, "PatientId": authUser.patientID, @@ -1454,6 +1473,7 @@ class DoctorsListService extends BaseService { "generalid": req.generalid, "PatientOutSA": authUser.outSA, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "EROnlineCheckinPaymentDetails": { "CheckinDate": DateUtil.convertDateToString(DateTime.now()), "ExpectedArrivalTime": DateUtil.convertDateToString(DateTime.now()), @@ -1516,7 +1536,7 @@ class DoctorsListService extends BaseService { Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, int checkInBy, BuildContext context) async { Map request; - request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy}; + request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { localRes = response; @@ -1531,6 +1551,7 @@ class DoctorsListService extends BaseService { request = { "ProjectID": projectID, + "LanguageID": 1, }; dynamic localRes; await baseAppClient.post(HAS_DENTAL_PLAN, onSuccess: (response, statusCode) async { @@ -1592,12 +1613,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLaserBodyPartsList(int laserCategoryID, int projectID) async { + Future getLaserBodyPartsList(int laserCategoryID, int projectID, int languageID) async { Map request; request = { "LaserCategoryID": laserCategoryID, "ProjectID": projectID, + "LanguageID": languageID, }; dynamic localRes; await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { @@ -1608,11 +1630,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertCovidQuestionnaire(List qa, int projectID, int testTypeEnum, int testProcedureEnum) async { + Future insertCovidQuestionnaire(List qa, int projectID, int testTypeEnum, int languageID, int testProcedureEnum) async { Map request; request = { "ProjectID": projectID, + "LanguageID": languageID, "IsForTravel": qa[0]['ans'].toString(), "IsComingOutSA": qa[1]['ans'].toString(), "IsFeverCurrently": qa[2]['ans'].toString(), @@ -1655,11 +1678,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future updateObGyneAppointment(int episodeID, int appointmentNo, int orderNo, String procedureId, int lineItemNo, int uniqueRowID) async { + Future updateObGyneAppointment(int episodeID, int appointmentNo, int orderNo, String procedureId, int lineItemNo, int uniqueRowID, int languageID) async { Map request; request = { "EpisodeID": episodeID, + "LanguageID": languageID, "AppointmentNo": appointmentNo, "OrderNo": orderNo, "ProcedureId": procedureId, @@ -1678,10 +1702,10 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getRRTProcedures(int projectID) async { + Future getRRTProcedures(int projectID, int languageID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": languageID}; dynamic localRes; await baseAppClient.post(GET_RRT_PROCEDURE_LIST, onSuccess: (response, statusCode) async { @@ -1699,6 +1723,7 @@ class DoctorsListService extends BaseService { "ClientRequestID": clientRequestID, "Status": status, "FortID": tamaraOrderID, // Tamara order ID + "LanguageID": 1, "Installments_Number": selectedInstallments }; @@ -1714,7 +1739,7 @@ class DoctorsListService extends BaseService { Future markAppointmentForTamara(int projectID, String appoNo) async { Map request; - request = {"ProjectID": projectID, "AppointmentNo": appoNo}; + request = {"ProjectID": projectID, "AppointmentNo": appoNo, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(MARK_APPOINTMENT_TAMARA_STATUS, onSuccess: (response, statusCode) async { localRes = response; @@ -1727,7 +1752,7 @@ class DoctorsListService extends BaseService { Future autoGenerateInvoiceTamara(int projectID, String appoNo, String mobileNo) async { Map request; - request = {"ProjectID": projectID, "AppointmentNo": appoNo, "MobileNo": mobileNo, "UserID": 102}; + request = {"ProjectID": projectID, "AppointmentNo": appoNo, "MobileNo": mobileNo, "UserID": 102, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(AUTO_GENERATE_INVOICE_TAMARA, onSuccess: (response, statusCode) async { localRes = response; @@ -1740,7 +1765,7 @@ class DoctorsListService extends BaseService { Future checkPatientNphiesEligibility(int projectID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(CHECK_PATIENT_NPHIES_ELIGIBILITY, onSuccess: (response, statusCode) async { localRes = response; @@ -1753,7 +1778,7 @@ class DoctorsListService extends BaseService { Future convertPatientToCash(int projectID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(CONVERT_PATIENT_TO_CASH, onSuccess: (response, statusCode) async { localRes = response; @@ -1797,6 +1822,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 549c182a..7e75b63a 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -203,7 +203,7 @@ class DoctorHeader extends StatelessWidget { List doctorDetailsList = List(); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(headerModel.doctorId, context).then((res) { + service.getDoctorsRatingDetails(headerModel.doctorId, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); From 86d3e03c06f1d44c6420675b60c04e803cc53d74 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 3 Jan 2024 14:35:49 +0300 Subject: [PATCH 40/71] Updates --- lib/pages/DrawerPages/family/my-family.dart | 2 +- .../family_files/family_files_provider.dart | 1 + lib/widgets/drawer/app_drawer_widget.dart | 20 +++++++++---------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index ef6f5e3d..9d80ee83 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -477,7 +477,7 @@ class _MyFamily extends State with TickerProviderStateMixin { var bloodType = await sharedPref.getString(BLOOD_TYPE); var mainUser = await sharedPref.getObject(MAIN_USER); var loginType = await sharedPref.getInt(LAST_LOGIN); - this.sharedPref.clear(); + // this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index f209812e..88cc0c69 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -43,6 +43,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; try { var request = GetAllSharedRecordsByStatusReq(); + // var request = {"LanguageID": languageID}; // var result = await sharedPref.getObject(MAIN_USER); // request.status = 0; // request.patientID = result["PatientID"]; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 89d35885..47dbdabe 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -67,12 +67,6 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { final InAppReview _inAppReview = InAppReview.instance; - @override - void initState() { - super.initState(); - checkUserData(); - } - ProjectViewModel projectProvider; var sharedPref = new AppSharedPreferences(); var familyFileProvider = FamilyFilesProvider(); @@ -89,6 +83,12 @@ class _AppDrawerState extends State { final authService = new AuthProvider(); String pharmacyLiveCareQRCode = ""; + @override + void initState() { + super.initState(); + checkUserData(); + } + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); @@ -684,16 +684,16 @@ class _AppDrawerState extends State { var currentLang = await sharedPref.getString(APP_LANGUAGE); var mainUser = await sharedPref.getObject(MAIN_USER); var loginType = await sharedPref.getInt(LAST_LOGIN); - this.sharedPref.clear(); + // this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } else { result.list.isFamily = false; } // result.list.cRSVerificationStatus = result['CRSVerificationStatus']; - this.sharedPref.setString(APP_LANGUAGE, currentLang); - this.sharedPref.setString(BLOOD_TYPE, bloodType); - this.sharedPref.setInt(LAST_LOGIN, loginType); + await this.sharedPref.setString(APP_LANGUAGE, currentLang); + await this.sharedPref.setString(BLOOD_TYPE, bloodType); + await this.sharedPref.setInt(LAST_LOGIN, loginType); await this.sharedPref.setObject(MAIN_USER, mainUser); await this.sharedPref.setObject(USER_PROFILE, result.list); await this.sharedPref.setObject(FAMILY_FILE, familyFile); From e6d093a84ce92856d5f94e9a6bd74cdb484abf33 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 3 Jan 2024 16:27:38 +0300 Subject: [PATCH 41/71] updates --- lib/config/config.dart | 4 +- lib/core/service/client/base_app_client.dart | 2 +- lib/uitl/utils.dart | 68 +++++++++----------- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 128264a2..a77a0814 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:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index d6b88e33..109326bc 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 291367; //3844083 + // body['PatientID'] = 1018977; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 77522108..4022f2ef 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -614,42 +614,38 @@ class Utils { hasBadge: true, isEnable: projectViewModel.havePrivilege(5)), projectViewModel.isArabic - ? !projectViewModel.isLoginChild - ? Positioned( - left: 8, - top: 4, - child: badge_import.Badge( - toAnimate: false, - elevation: 0, - position: badge_import.BadgePosition.topEnd(), - shape: badge_import.BadgeShape.circle, - badgeColor: secondaryColor.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), - ), - ), - ) - : Container() - : !projectViewModel.isLoginChild - ? Positioned( - right: 8, - top: 4, - child: badge_import.Badge( - toAnimate: false, - elevation: 0, - position: badge_import.BadgePosition.topEnd(), - shape: badge_import.BadgeShape.circle, - badgeColor: secondaryColor.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), - ), - ), - ) - : Container(), + ? Positioned( + left: 8, + top: 4, + child: badge_import.Badge( + toAnimate: false, + elevation: 0, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + ), + ), + ) + : Positioned( + right: 8, + top: 4, + child: badge_import.Badge( + toAnimate: false, + elevation: 0, + position: badge_import.BadgePosition.topEnd(), + shape: badge_import.BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)), + ), + ), + ), ]) : MedicalProfileItem( title: TranslationBase.of(context).myAppointments, From e1718270eb4743d1e9a89d5d08eaff9a268d5313 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Jan 2024 09:59:47 +0300 Subject: [PATCH 42/71] updates --- lib/pages/MyAppointments/MyAppointments.dart | 7 ++++++- pubspec.yaml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 3d0eb15f..1163da12 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -431,7 +431,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid ), ), ).then((value) { - getPatientAppointmentHistory(true, false); + if(_currentPage == 1) { + getPatientAppointmentHistory(true, false); + } + if(_currentPage == 2) { + getPatientAppointmentHistory(false, true); + } }), isInOutPatient: _appointmentResult.isInOutPatient, name: _appointmentResult.doctorTitle + " " + _appointmentResult.doctorNameObj, diff --git a/pubspec.yaml b/pubspec.yaml index 8fb7faae..0cb06dd5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.040+4050040 +version: 4.5.78+1 environment: sdk: ">=2.7.0 <3.0.0" From cd8b76a374dfc3a01eb0a1cce9f19eb8737d47e9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 4 Jan 2024 10:57:54 +0300 Subject: [PATCH 43/71] In App Apple Pay implemented --- lib/pages/BookAppointment/BookSuccess.dart | 93 +++++++++++++++++- lib/pages/ToDoList/ToDo.dart | 1 - lib/pages/livecare/widgets/clinic_list.dart | 95 ++++++++++++++++++- .../payfort_services/payfort_service.dart | 4 +- .../payfort_services/payfort_view_model.dart | 4 +- 5 files changed, 189 insertions(+), 8 deletions(-) diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index ea0f186b..8e29e908 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -1,16 +1,22 @@ +import 'dart:developer'; import 'dart:io'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -28,6 +34,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:provider/provider.dart'; +import '../../config/shared_pref_kay.dart'; import 'QRCode.dart'; class BookSuccess extends StatefulWidget { @@ -622,13 +629,97 @@ class _BookSuccessState extends State { }, patientShare: widget.patientShareResponse.patientShareWithTax))) .then((value) { + selectedPaymentMethod = value[0]; if (value != null) { - openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + if (selectedPaymentMethod == "ApplePay") { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } projectViewModel.analytics.appointment.payment_method(appointment_type: 'regular', clinic: widget.docObject.clinicName, payment_method: value[0], payment_type: 'appointment'); } }); } + void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { + String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context.read().getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum()).then((value) { + payfortProjectDetailsRespModel = value; + }); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = appo.clinicID; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = appo.doctorID; + applePayInsertRequest.projectID = appo.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = appo.appointmentDate; + applePayInsertRequest.appointmentNo = appo.appointmentNo; + applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = patientShareResponse.patientShareWithTax.toString(); + applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Appointment Payment", + orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } + openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); selectedPaymentMethod = paymentMethod[0]; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 2ba88f10..d353180a 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1377,7 +1377,6 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); - // GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index bbf7a159..5a220947 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -1,10 +1,14 @@ +import 'dart:developer'; import 'dart:io'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; @@ -18,6 +22,8 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -296,7 +302,8 @@ class _clinic_listState extends State { appo.clinicID = selectedClinicID; appo.appointmentNo = DateTime.now().millisecondsSinceEpoch; - appo.projectID = 12; + appo.projectID = BASE_URL.contains("uat.") ? 15 : 12; + appo.isLiveCareAppointment = false; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -318,16 +325,100 @@ class _clinic_listState extends State { patientShare: num.parse(getERAppointmentFeesList.total), isFromAdvancePayment: widget.isPharmacyLiveCare, ))).then((value) { + selectedPaymentMethod = value[0]; print(value); widget.isPharmacyLiveCare = isPharmacyLiveCare; widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue; if (value != null) { - openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + if (selectedPaymentMethod == "ApplePay") { + startApplePay(appo, getERAppointmentFeesList.total); + } else { + openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + } projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); } }); } + void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async { + String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context.read().getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2).then((value) { + payfortProjectDetailsRespModel = value; + }); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = appo.clinicID; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = appo.doctorID; + applePayInsertRequest.projectID = appo.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = appo.appointmentDate; + applePayInsertRequest.appointmentNo = appo.appointmentNo; + applePayInsertRequest.orderDescription = "LiveCare Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = amount; + applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "LiveCare Payment", + orderAmount: double.parse(amount), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } + openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index e684d1bd..5a00700c 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -20,8 +20,8 @@ class PayfortService extends BaseService { ); } - Future getPayfortConfigurations({int serviceId, int projectId, int integrationId = 2}) async { - Map body = {"Integration_Id": integrationId, "ServID": serviceId, "ProjectID": projectId}; + Future getPayfortConfigurations({int serviceId, int projectId, int integrationId = 2, int languageID}) async { + Map body = {"Integration_Id": integrationId, "ServID": serviceId, "ProjectID": projectId, "LanguageID": languageID}; PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); await baseAppClient.post( diff --git a/lib/services/payfort_services/payfort_view_model.dart b/lib/services/payfort_services/payfort_view_model.dart index 4a9038b0..f57e936b 100644 --- a/lib/services/payfort_services/payfort_view_model.dart +++ b/lib/services/payfort_services/payfort_view_model.dart @@ -15,10 +15,10 @@ class PayfortViewModel extends ChangeNotifier { await _payfortService.initPayfortSDK(); } - Future getProjectDetailsForPayfort({int serviceId, int projectId}) async { + Future getProjectDetailsForPayfort({int serviceId, int projectId, int languageID}) async { PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); try { - payfortProjectDetailsRespModel = await _payfortService.getPayfortConfigurations(serviceId: serviceId, projectId: projectId); + payfortProjectDetailsRespModel = await _payfortService.getPayfortConfigurations(serviceId: serviceId, projectId: projectId, languageID: languageID); String signature = await _payfortService.getPayfortSignature(payfortProjectDetailsRespModel.accessCode, payfortProjectDetailsRespModel.merchantIdentifier, payfortProjectDetailsRespModel.shaRequest); From 63621b5fedaf73422243d3e0e0907623970e9bf5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 7 Jan 2024 09:42:28 +0300 Subject: [PATCH 44/71] Updates & fixes --- lib/pages/ToDoList/ToDo.dart | 137 ++++++++++++++++++----------------- pubspec.yaml | 2 +- 2 files changed, 70 insertions(+), 69 deletions(-) diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 5fb46243..2be4f097 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -48,9 +48,6 @@ import 'package:rating_bar/rating_bar.dart'; class ToDo extends StatefulWidget { PatientShareResponse patientShareResponse; - List appoList = []; - List ancillaryLists = []; - List obGyneAppoList = []; var languageID; bool isShowAppBar = true; @@ -86,6 +83,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isCash = false; MyInAppBrowser browser; + List appoList = []; + List ancillaryLists = []; + List obGyneAppoList = []; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -103,6 +104,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { @override void dispose() { super.dispose(); + // getToDoCount(); _tabController.dispose(); } @@ -162,15 +164,15 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: widget.appoList.length.toString(), + counter: appoList.length.toString(), title: TranslationBase.of(context).appointments, - bodyWidget: widget.appoList.length != 0 + bodyWidget: appoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, + itemCount: appoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -190,12 +192,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { children: [ Padding( padding: const EdgeInsets.only(top: 4.0), - child: widget.appoList[index].clinicID == 265 + child: appoList[index].clinicID == 265 ? Container( margin: EdgeInsets.only(left: 5.0, right: 5.0), child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0), ) - : widget.appoList[index].isLiveCareAppointment + : appoList[index].isLiveCareAppointment ? SvgPicture.asset("assets/images/new/virtual.svg") : SvgPicture.asset("assets/images/new/hospital-visit.svg"), ), @@ -205,9 +207,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Text( - widget.appoList[index].clinicID == 265 + appoList[index].clinicID == 265 ? TranslationBase.of(context).covidTestTodo - : widget.appoList[index].isLiveCareAppointment + : appoList[index].isLiveCareAppointment ? TranslationBase.of(context).liveCareAppo : TranslationBase.of(context).walkinAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), @@ -215,8 +217,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + controller: + new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (appoList[index].remaniningHoursTocanPay * 1000) * 60), widgetBuilder: (_, CurrentRemainingTime time) { return time != null ? Text( @@ -236,17 +238,17 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: Container( child: InkWell( onTap: () { - performNextAction(widget.appoList[index]); + performNextAction(appoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: getNextActionButtonColor(widget.appoList[index].nextAction), + color: getNextActionButtonColor(appoList[index].nextAction), border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.circular(6), ), child: Text( - getNextActionText(widget.appoList[index].nextAction), + getNextActionText(appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), @@ -259,7 +261,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + appoList[index].doctorTitle + " " + appoList[index].doctorNameObj, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -267,8 +269,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - url: widget.appoList[index].doctorImageURL, + name: appoList[index].doctorTitle + " " + appoList[index].doctorNameObj, + url: appoList[index].doctorImageURL, width: 52, height: 52, ), @@ -278,32 +280,32 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", appoList[index].clinicName, projectViewModel.isArabic), // MyRichText(TranslationBase.of(context).appointmentDate + ": ", - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), // Timezone changes - widget.appoList[index].isLiveCareAppointment + appoList[index].isLiveCareAppointment ? MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), + DateUtil.convertStringToDate(appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), projectViewModel.isArabic) : MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - widget.appoList[index].startTime.substring(0, 5), + appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, appoList[index].projectName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, children: [ RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + initialRating: appoList[index].actualDoctorRate.toDouble(), size: 16.0, filledColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127), @@ -322,13 +324,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 12.0), child: Text( - getNextActionDescription(widget.appoList[index].nextAction), + getNextActionDescription(appoList[index].nextAction), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), ), InkWell( onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); + navigateToAppointmentDetails(context, appoList[index]); }, child: Padding( padding: const EdgeInsets.only(top: 0.0), @@ -357,9 +359,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: (widget.ancillaryLists.isNotEmpty) ? widget.ancillaryLists[0].ancillaryOrderList.length.toString() : "0", + counter: (ancillaryLists.isNotEmpty) ? ancillaryLists[0].ancillaryOrderList.length.toString() : "0", title: TranslationBase.of(context).anicllaryOrders, - bodyWidget: widget.ancillaryLists.length != 0 + bodyWidget: ancillaryLists.length != 0 ? Container( padding: EdgeInsets.all(12), child: ListView.separated( @@ -368,18 +370,18 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { reverse: true, itemBuilder: (context, index) { return DoctorCard( - onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList[index], widget.ancillaryLists[0].projectID), + onTap: () => ancillaryOrdersDetails(ancillaryLists[0].ancillaryOrderList[index], ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), - billNo: widget.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), + name: TranslationBase.of(context).dr.toString() + " " + (ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), + billNo: ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", - subName: widget.ancillaryLists[0].projectName, + subName: ancillaryLists[0].projectName, isLiveCareAppointment: false, - date: DateUtil.convertStringToDate(widget.ancillaryLists[0].ancillaryOrderList[index].orderDate), + date: DateUtil.convertStringToDate(ancillaryLists[0].ancillaryOrderList[index].orderDate), isSortByClinic: true, ); }, - itemCount: widget.ancillaryLists[0].ancillaryOrderList.length, + itemCount: ancillaryLists[0].ancillaryOrderList.length, separatorBuilder: (context, index) => SizedBox(height: 14), ), ) @@ -389,13 +391,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { ), ), Container( - child: widget.obGyneAppoList.length != 0 + child: obGyneAppoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.obGyneAppoList.length, + itemCount: obGyneAppoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -433,7 +435,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Container( child: InkWell( onTap: () { - getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID, widget.obGyneAppoList[index].setupID, widget.obGyneAppoList[index]); + getOBGyneDoctorsList(obGyneAppoList[index].projectID, obGyneAppoList[index].setupID, obGyneAppoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), @@ -454,7 +456,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -462,7 +464,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName, + name: TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName, url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", width: 52, height: 52, @@ -473,12 +475,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", obGyneAppoList[index].clinicDescription, projectViewModel.isArabic), MyRichText( TranslationBase.of(context).orderDate + ": ", - DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate)).split(" ")[0], + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(obGyneAppoList[index].orderDate)).split(" ")[0], projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, obGyneAppoList[index].projectDescription, projectViewModel.isArabic), ], ), ), @@ -749,14 +751,14 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getOBGyneOrdersList(context).then((res) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['HIS_OBGYNEProcedureGet_List'].length != 0) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); res['HIS_OBGYNEProcedureGet_List'].forEach((v) { - widget.obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); + obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); }); } else { // Navigator.of(context).popAndPushNamed(HOME); @@ -822,32 +824,31 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { obGyneProcedureListResponse: obGyneProcedureListResponse))); } - getPatientAppointmentHistory() { + getPatientAppointmentHistory() async { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, languageID, context).then((res) { - widget.appoList.clear(); + appoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - setState(() { - if (res['AppoimentAllHistoryResultList'].length != 0) { - widget.appoList.clear(); - res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - }); - } - if (res['AncillaryOrderList'].length != 0) { - res['AncillaryOrderList'].forEach((item) { - widget.ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); - }); - } - dataLoaded = true; - if (widget.isFromMyAppointments) { - performNextAction(widget.appointment); - widget.isFromMyAppointments = false; - } - }); + if (res['AppoimentAllHistoryResultList'].length != 0) { + appoList.clear(); + res['AppoimentAllHistoryResultList'].forEach((v) { + appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + }); + } + if (res['AncillaryOrderList'].length != 0) { + res['AncillaryOrderList'].forEach((item) { + ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + }); + } + dataLoaded = true; + if (widget.isFromMyAppointments) { + performNextAction(widget.appointment); + widget.isFromMyAppointments = false; + } + setState(() {}); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } diff --git a/pubspec.yaml b/pubspec.yaml index 0cb06dd5..5de7f32e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.78+1 +version: 4.5.79+1 environment: sdk: ">=2.7.0 <3.0.0" From b39357a497d97564a7f12b134e6f56e8632c988f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 7 Jan 2024 15:06:22 +0300 Subject: [PATCH 45/71] Medical report changes, Loading added in Location Check-In --- lib/config/config.dart | 4 ++-- lib/core/model/reports/Reports.dart | 4 ++++ lib/core/service/client/base_app_client.dart | 2 +- lib/pages/BookAppointment/QRCode.dart | 5 ++++ lib/pages/landing/landing_page.dart | 2 +- .../medical/reports/report_list_widget.dart | 5 +++- lib/uitl/location_util.dart | 24 +++++++++++++++---- 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index a77a0814..128264a2 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:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/model/reports/Reports.dart b/lib/core/model/reports/Reports.dart index 6791a3d4..0d409f04 100644 --- a/lib/core/model/reports/Reports.dart +++ b/lib/core/model/reports/Reports.dart @@ -5,6 +5,7 @@ class Reports { DateTime encounterDate; int projectID; int invoiceNo; + int invoiceNo_VP; int encounterNo; String procedureId; int requestType; @@ -35,6 +36,7 @@ class Reports { this.encounterDate, this.projectID, this.invoiceNo, + this.invoiceNo_VP, this.encounterNo, this.procedureId, this.requestType, @@ -67,6 +69,7 @@ class Reports { json['EncounterDate']); //json['EncounterDate']; projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; + invoiceNo_VP = json['InvoiceNo_VP']; encounterNo = json['EncounterNo']; procedureId = json['ProcedureId']; requestType = json['RequestType']; @@ -104,6 +107,7 @@ class Reports { data['EncounterDate'] = this.encounterDate; data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; + data['InvoiceNo_VP'] = this.invoiceNo_VP; data['EncounterNo'] = this.encounterNo; data['ProcedureId'] = this.procedureId; data['RequestType'] = this.requestType; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 109326bc..f756ba8e 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 1018977; //3844083 + // body['PatientID'] = 1400563; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 90e39767..cc700e97 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -93,16 +93,21 @@ class _QRCodeState extends State { } startLocationCheckIn() async { + GifLoaderDialogUtils.showMyDialog(context); 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; print(dist); if (dist <= projectDetailListModel.geofenceRadius) { + GifLoaderDialogUtils.hideDialog(context); sendNfcCheckInRequest(projectDetailListModel.checkInQrCode, 3); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } + }, failureCallBack: () { + GifLoaderDialogUtils.hideDialog(context); }); } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 601e7303..36257423 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -650,7 +650,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { authService.getDashboard().then((value) async { setState(() { if (value != null) { - notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + notificationCount = value ['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); model.setState(model.count, 0, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); FlutterAppIconBadge.updateBadge(num.parse(notificationCount)); diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 2809b317..82df163c 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -12,6 +12,7 @@ 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/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -197,7 +198,9 @@ class ReportListWidget extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(AppGlobal.context); ReportsService _reportsService = locator(); _reportsService - .sendEmailForMedicalReport(report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), report.invoiceNo.toString(), report.projectID, + .sendEmailForMedicalReport(report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), + Utils.isVidaPlusProject(projectViewModel, report.projectID) ? report.invoiceNo_VP.toString() : report.invoiceNo.toString(), + report.projectID, DateUtil.convertDateToString(report.requestDate), report.setupId) .then((value) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 3eb6388f..b890882f 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -28,7 +28,7 @@ class LocationUtils { LocationUtils({@required this.isShowConfirmDialog, @required this.context, this.isHuawei = false}); - void getCurrentLocation({Function(LatLng) callBack}) async { + void getCurrentLocation({Function(LatLng) callBack, Function() failureCallBack}) async { if (Platform.isAndroid && isHuawei) { _getHMSCurrentLocation(callBack); } else { @@ -68,7 +68,7 @@ class LocationUtils { print(err); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: failureCallBack); } }).catchError((err) { print(err); @@ -141,14 +141,28 @@ class LocationUtils { } } - showErrorLocationDialog(bool isPermissionError) { + showErrorLocationDialog(bool isPermissionError, {Function() failureCallBack}) { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: TranslationBase.of(context).locationDialogMessage, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings(), Navigator.of(context).canPop()}, - cancelFunction: () => {}); + okFunction: () { + ConfirmDialog.closeAlertDialog(context); + if (isPermissionError) + Geolocator.openAppSettings(); + else + Geolocator.openLocationSettings(); + Navigator.of(context).canPop(); + if (failureCallBack != null) { + failureCallBack(); + } + }, + cancelFunction: () { + if (failureCallBack != null) { + failureCallBack(); + } + }); return dialog.showAlertDialog(context); } From e67bd54c04940df668912727c39a5e61f83b2a3a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 7 Jan 2024 15:06:44 +0300 Subject: [PATCH 46/71] updates --- lib/services/appointment_services/GetDoctorsList.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 8f47063c..47826a43 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1536,7 +1536,7 @@ class DoctorsListService extends BaseService { Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, int checkInBy, BuildContext context) async { Map request; - request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy, "LanguageID": 1}; + request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy}; dynamic localRes; await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { localRes = response; From 27ed5c95f2195439cfb1500ef614e23451c16950 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 8 Jan 2024 10:24:08 +0300 Subject: [PATCH 47/71] update to stores --- lib/config/config.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 128264a2..09e07839 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:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; @@ -342,7 +342,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.8; +var VERSION_ID = 11.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; From 98a5b7d049e26f731213ae6dbc26adda2f8f55ac Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 8 Jan 2024 12:25:32 +0300 Subject: [PATCH 48/71] my appointments fixes --- lib/pages/MyAppointments/MyAppointments.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 1163da12..7939e0c0 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -270,10 +270,6 @@ class _MyAppointmentsState extends State with SingleTickerProvid } else { _patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } - - //Merging Booked & Confirmed Appointments into Upcoming Tab - _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientBookedAppointmentListHospital); - _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientBookedAppointmentListClinic); }); confirmedAppoList.forEach((element) { @@ -302,8 +298,8 @@ class _MyAppointmentsState extends State with SingleTickerProvid } //Merging Booked & Confirmed Appointments into Upcoming Tab - _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientConfirmedAppointmentListHospital); - _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientConfirmedAppointmentListClinic); + // _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientConfirmedAppointmentListHospital); + // _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientConfirmedAppointmentListClinic); }); arrivedAppoList.forEach((element) { @@ -333,6 +329,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid // openAppointmentsTab(); }); + + //Merging Booked & Confirmed Appointments into Upcoming Tab + _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientBookedAppointmentListHospital); + _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientBookedAppointmentListClinic); + } openAppointmentsTab() async { From ac52ba75a7cea05302d772a05596b12236d6aa92 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 9 Jan 2024 11:48:54 +0300 Subject: [PATCH 49/71] Updates & Fixes --- lib/config/config.dart | 4 ++-- lib/core/service/medical/reports_service.dart | 3 ++- .../viewModels/medical/reports_view_model.dart | 4 ++-- lib/pages/medical/reports/report_home_page.dart | 17 ++++++++++------- lib/widgets/drawer/app_drawer_widget.dart | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 09e07839..65f5fb5e 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:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index d80c80e4..a79f8f3e 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -42,9 +42,10 @@ class ReportsService extends BaseService { }, body: _requestReportsInpatient.toJson()); } - Future getInpatientAdmissionsList() async { + Future getInpatientAdmissionsList(int languageID) async { Map body = new Map(); body['IsForMedicalReport'] = true; + body['LanguageID'] = languageID; hasError = false; await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { admissionsMedicalReport.clear(); diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 8f55b3b7..9e977dfe 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -26,7 +26,7 @@ class ReportsViewModel extends BaseViewModel { List get admissionsMedicalReportList => _reportsService.admissionsMedicalReport; - getReports() async { + getReports(int languageID) async { setState(ViewState.Busy); reportsOrderRequestList.clear(); reportsOrderReadyList.clear(); @@ -37,7 +37,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - await _reportsService.getInpatientAdmissionsList(); + await _reportsService.getInpatientAdmissionsList(languageID); setState(ViewState.Idle); } } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 55d1b901..95225b39 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -31,6 +31,7 @@ class _HomeReportPageState extends State with SingleTickerProvid TabController _tabController_new; List imagesInfo = List(); int _currentPage = 0; + ProjectViewModel projectViewModel; @override void initState() { @@ -46,7 +47,7 @@ class _HomeReportPageState extends State with SingleTickerProvid @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); imagesInfo.add(ImagesInfo( @@ -55,7 +56,7 @@ class _HomeReportPageState extends State with SingleTickerProvid imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( onModelReady: (model) { - model.getReports(); + model.getReports(projectViewModel.isArabic ? 1 : 2); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, @@ -156,11 +157,13 @@ class _HomeReportPageState extends State with SingleTickerProvid return InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: InPatientMedicalReports( + context, + FadePage( + page: InPatientMedicalReports( admissionMedicalReport: admissionMedicalReport, - ))); + ), + ), + ); }, child: Container( // height: 100.0, @@ -259,7 +262,7 @@ class _HomeReportPageState extends State with SingleTickerProvid page: MedicalReports(), ), ).then((value) { - model.getReports(); + model.getReports(projectViewModel.isArabic ? 1 : 2); }), ), ) diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 47dbdabe..0ca93570 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -222,7 +222,7 @@ class _AppDrawerState extends State { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child: Text('')); + return Padding(padding: EdgeInsets.all(10), child:CircularProgressIndicator()); default: if (snapshot.hasError) return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); From fe7c2c6873e9b861a939f113c53697ddbb201fbc Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 14 Jan 2024 10:16:06 +0300 Subject: [PATCH 50/71] CR 6631 --- lib/core/service/er/er_service.dart | 1 + lib/core/service/hospital_service.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/core/service/er/er_service.dart b/lib/core/service/er/er_service.dart index 5b7552bb..445fa6c1 100644 --- a/lib/core/service/er/er_service.dart +++ b/lib/core/service/er/er_service.dart @@ -20,6 +20,7 @@ class ErService extends BaseService { var long = await sharedPref.getDouble(USER_LONG); body['Latitude'] = lat ?? 0; body['Longitude'] = long ?? 0; + body['IsForER'] = true; dynamic localRes; diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index e6dc7727..f07880fe 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -59,6 +59,7 @@ class HospitalService extends BaseService { body['IsOnlineCheckIn'] = isResBasedOnLoc; body['IsAdvancePayment'] = isAdvancePayment; body['LanguageID'] = languageID; + body['IsForER'] = true; await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { _hospitals.clear(); From ec0bed04d3e98d5e1250322853d43496b6f798ef Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 14 Jan 2024 17:01:12 +0300 Subject: [PATCH 51/71] Apple Pay in production implemented & tested --- lib/config/config.dart | 12 ++- .../ancillaryOrdersDetails.dart | 96 ++++++++++++++++++- lib/pages/BookAppointment/BookSuccess.dart | 2 + lib/pages/ToDoList/ToDo.dart | 2 + lib/pages/livecare/widgets/clinic_list.dart | 7 +- .../medical/balance/confirm_payment_page.dart | 3 + .../payfort_services/payfort_view_model.dart | 2 + lib/uitl/utils.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- 9 files changed, 120 insertions(+), 10 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4831aeb6..1186bfbd 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.20.200.111:1010/'; - 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/'; @@ -340,7 +340,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.5; +var VERSION_ID = 11.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -626,8 +626,10 @@ var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceComp //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; -var payFortEnvironment = FortEnvironment.test; -var applePayMerchantId = "merchant.com.hmgwebservices.uat"; +var payFortEnvironment = FortEnvironment.production; +// var payFortEnvironment = FortEnvironment.test; +// var applePayMerchantId = "merchant.com.hmgwebservices.uat"; +var applePayMerchantId = "merchant.com.hmgwebservices"; class AppGlobal { diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 8e224320..d7d5f983 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -1,18 +1,26 @@ +import 'dart:developer'; import 'dart:io'; import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/PayfortEnums.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'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_proc_model.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; +import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -507,13 +515,99 @@ class _AnicllaryOrdersState extends State with SingleTic onSelectedMethod: (String method, [String selectedInstallmentPlan]) { selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); + if (selectedPaymentMethod == "ApplePay") { + startApplePay(); + } else { + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); + } }, patientShare: double.parse(getTotalValue()), isFromAdvancePayment: !projectViewModel.havePrivilege(94), )); } + void startApplePay() async { + transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID); + + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(context); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await context.read().getProjectDetailsForPayfort(projectId: widget.projectID, serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum()).then((value) { + payfortProjectDetailsRespModel = value; + }); + + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = 0; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = 0; + applePayInsertRequest.projectID = widget.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = null; + applePayInsertRequest.appointmentNo = 0; + applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = double.parse(getTotalValue()).toString(); + applePayInsertRequest.isSchedule = "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { + await context.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "Ancillary Order Payment", + orderAmount: double.parse(getTotalValue()), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + log("Payfort: ${successResult.responseMessage}"); + await context.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(AppoitmentAllHistoryResultList()); + }, + projectId: widget.projectID, + serviceTypeEnum: ServiceTypeEnum.ancillaryOrder, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + }); + } + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String selectedInstallmentPlan]) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 8e29e908..f41d5a84 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -678,6 +678,7 @@ class _BookSuccessState extends State { applePayInsertRequest.amount = patientShareResponse.patientShareWithTax.toString(); applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; @@ -701,6 +702,7 @@ class _BookSuccessState extends State { orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d353180a..488b52a1 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1352,6 +1352,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.amount = patientShareResponse.patientShareWithTax.toString(); applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; @@ -1375,6 +1376,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 5a220947..f8294150 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -349,7 +349,10 @@ class _clinic_listState extends State { ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; - await context.read().getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2).then((value) { + await context + .read() + .getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2) + .then((value) { payfortProjectDetailsRespModel = value; }); @@ -377,6 +380,7 @@ class _clinic_listState extends State { applePayInsertRequest.amount = amount; applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; @@ -400,6 +404,7 @@ class _clinic_listState extends State { orderAmount: double.parse(amount), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index b754b987..8a70c6f9 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -281,6 +281,7 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.amount = widget.advanceModel.amount.toString(); applePayInsertRequest.isSchedule = "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; @@ -304,8 +305,10 @@ class _ConfirmPaymentPageState extends State { orderAmount: double.parse(widget.advanceModel.amount), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); + AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { log("Payfort: ${successResult.responseMessage}"); diff --git a/lib/services/payfort_services/payfort_view_model.dart b/lib/services/payfort_services/payfort_view_model.dart index f57e936b..5bef18a8 100644 --- a/lib/services/payfort_services/payfort_view_model.dart +++ b/lib/services/payfort_services/payfort_view_model.dart @@ -51,6 +51,7 @@ class PayfortViewModel extends ChangeNotifier { FailedCallback onFailed, ServiceTypeEnum serviceTypeEnum, int projectId, + String currency, }) async { // GifLoaderDialogUtils.showMyDialog(AppGlobal.context); // PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = await getProjectDetailsForPayfort(projectId: projectId, serviceId: serviceTypeEnum.getIdFromServiceEnum()); @@ -72,6 +73,7 @@ class PayfortViewModel extends ChangeNotifier { merchantIdentifier: payfortProjectDetailsRespModel.merchantIdentifier ?? "", applePayAccessCode: payfortProjectDetailsRespModel.accessCode ?? "", applePayShaRequestPhrase: payfortProjectDetailsRespModel.shaRequest ?? "", + currency: currency, ); GifLoaderDialogUtils.hideDialog(AppGlobal.context); } catch (e) { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 77522108..8c48157a 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -154,7 +154,7 @@ class Utils { } static String getAppointmentTransID(int projectID, int clinicID, int appoNo) { - return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString(); + return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString(); } static String getAdvancePaymentTransID(int projectID, int fileNumber) { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c71b206b..c9fecbf9 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,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 48202ffd120ecccc66da49ffbf3d99341885b850 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Jan 2024 14:02:32 +0300 Subject: [PATCH 52/71] updates --- lib/pages/livecare/widgets/clinic_list.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 8a3a2d8f..e19d6105 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -407,6 +407,7 @@ class _clinic_listState extends State { currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { From d3bdcfa9752806223830faa28cc54319a0171543 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Jan 2024 16:52:17 +0300 Subject: [PATCH 53/71] Apple Pay code merged into main branch --- lib/config/config.dart | 8 +- .../ancillaryOrdersDetails.dart | 2 + lib/pages/BookAppointment/BookSuccess.dart | 8 +- lib/pages/ToDoList/ToDo.dart | 9 +- lib/pages/livecare/widgets/clinic_list.dart | 224 +++++++++--------- .../payfort_services/payfort_service.dart | 5 - 6 files changed, 123 insertions(+), 133 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f63eb699..bc651005 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; @@ -343,7 +343,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.9; +var VERSION_ID = 12.0; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -630,9 +630,9 @@ var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceComp var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; var payFortEnvironment = FortEnvironment.production; +var applePayMerchantId = "merchant.com.hmgwebservices"; // var payFortEnvironment = FortEnvironment.test; // var applePayMerchantId = "merchant.com.hmgwebservices.uat"; -var applePayMerchantId = "merchant.com.hmgwebservices"; class AppGlobal { diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index d7d5f983..701fc269 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_pro import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/services/payfort_services/payfort_project_details_resp_model.dart'; @@ -803,6 +804,7 @@ class _AnicllaryOrdersState extends State with SingleTic okFunction: () { AlertDialogBox.closeAlertDialog(context); Navigator.of(context).pop(); + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); }).showAlertDialog(context); } diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 7cce4fcf..f6ece784 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -64,6 +64,7 @@ class _BookSuccessState extends State { String selectedInstallments = ""; String tamaraPaymentStatus; String tamaraOrderID; + String transID; @override initState() { @@ -642,7 +643,7 @@ class _BookSuccessState extends State { } void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { - String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); print("TransactionID: $transID"); GifLoaderDialogUtils.showMyDialog(context); @@ -726,10 +727,11 @@ class _BookSuccessState extends State { widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); selectedPaymentMethod = paymentMethod[0]; selectedInstallments = paymentMethod[1]; + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); widget.browser.openPaymentBrowser( amount, "Appointment check in", - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + transID, appo.projectID.toString(), authenticatedUser.emailAddress, paymentMethod[0], @@ -884,7 +886,7 @@ class _BookSuccessState extends State { final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) { + service.checkPaymentStatus(transID, false, context).then((res) { String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { txn_ref = res['Merchant_Reference']; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d30ef0fd..771a6557 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -92,6 +92,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { List appoList = []; List ancillaryLists = []; List obGyneAppoList = []; + String transID; @override void initState() { @@ -1061,11 +1062,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); browser.openPaymentBrowser( amount, "Appointment check in", - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + transID, appo.projectID.toString(), authenticatedUser.emailAddress, paymentMethod[0], @@ -1214,7 +1215,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) { + service.checkPaymentStatus(transID, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { @@ -1319,7 +1320,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } void startApplePay(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) async { - String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); print("TransactionID: $transID"); GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index e19d6105..f0beb79b 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -89,6 +89,9 @@ class _clinic_listState extends State { String tamaraOrderID; String selectedInstallmentPlan; + String transID; + BuildContext localContext; + @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); @@ -114,6 +117,7 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + localContext = context; getLanguageID(); return Container( child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), @@ -325,134 +329,123 @@ class _clinic_listState extends State { patientShare: num.parse(getERAppointmentFeesList.total), isFromAdvancePayment: widget.isPharmacyLiveCare, ))).then((value) { - selectedPaymentMethod = value[0]; - print(value); - widget.isPharmacyLiveCare = isPharmacyLiveCare; - widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue; if (value != null) { - if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, getERAppointmentFeesList.total); - } else { - openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + selectedPaymentMethod = value[0]; + print(value); + widget.isPharmacyLiveCare = isPharmacyLiveCare; + widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue; + if (value != null) { + if (selectedPaymentMethod == "ApplePay") { + startApplePay(appo, getERAppointmentFeesList.total); + } else { + openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + } + projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); } - projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); } }); } void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async { - String transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); - print("TransactionID: $transID"); - GifLoaderDialogUtils.showMyDialog(context); - - LiveCareService service = new LiveCareService(); - ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); - - PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; - await context - .read() - .getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2) - .then((value) { - payfortProjectDetailsRespModel = value; - }); + try { + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + print("TransactionID: $transID"); + GifLoaderDialogUtils.showMyDialog(localContext); + + LiveCareService service = new LiveCareService(); + ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); + + PayfortProjectDetailsRespModel payfortProjectDetailsRespModel; + await localContext + .read() + .getProjectDetailsForPayfort(projectId: appo.projectID, serviceId: ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum(), languageID: projectViewModel.isArabic ? 1 : 2) + .then((value) { + payfortProjectDetailsRespModel = value; + }); - applePayInsertRequest.clientRequestID = transID; - applePayInsertRequest.clinicID = appo.clinicID; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; - applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); - applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); - applePayInsertRequest.doctorID = appo.doctorID; - applePayInsertRequest.projectID = appo.projectID.toString(); - applePayInsertRequest.serviceID = ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(); - applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; - applePayInsertRequest.appointmentDate = appo.appointmentDate; - applePayInsertRequest.appointmentNo = appo.appointmentNo; - applePayInsertRequest.orderDescription = "LiveCare Payment"; - applePayInsertRequest.liveServiceID = "0"; - applePayInsertRequest.latitude = "0.0"; - applePayInsertRequest.longitude = "0.0"; - applePayInsertRequest.amount = amount; - applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; - applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; - applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; - applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; - applePayInsertRequest.paymentOption = "ApplePay"; - - applePayInsertRequest.isMobSDK = true; - applePayInsertRequest.merchantReference = transID; - applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; - applePayInsertRequest.commandType = "PURCHASE"; - applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; - applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; - applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; - applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; - applePayInsertRequest.returnURL = ""; - - service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { - await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - orderDescription: "LiveCare Payment", - orderAmount: double.parse(amount), - merchantReference: transID, - payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", - onFailed: (failureResult) async { - log("failureResult: ${failureResult.toString()}"); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: failureResult.toString()); - }, - onSuccess: (successResult) async { - log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); - checkPaymentStatus(appo); - }, - projectId: appo.projectID, - serviceTypeEnum: ServiceTypeEnum.appointmentPayment, - ); - }).catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - }); + applePayInsertRequest.clientRequestID = transID; + applePayInsertRequest.clinicID = appo.clinicID; + applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); + applePayInsertRequest.doctorID = appo.doctorID; + applePayInsertRequest.projectID = appo.projectID.toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(); + applePayInsertRequest.channelID = 3; + applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.appointmentDate = appo.appointmentDate; + applePayInsertRequest.appointmentNo = appo.appointmentNo; + applePayInsertRequest.orderDescription = "LiveCare Payment"; + applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.latitude = "0.0"; + applePayInsertRequest.longitude = "0.0"; + applePayInsertRequest.amount = amount; + applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; + applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; + applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; + applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; + applePayInsertRequest.paymentOption = "ApplePay"; + + applePayInsertRequest.isMobSDK = true; + applePayInsertRequest.merchantReference = transID; + applePayInsertRequest.merchantIdentifier = payfortProjectDetailsRespModel.merchantIdentifier; + applePayInsertRequest.commandType = "PURCHASE"; + applePayInsertRequest.signature = payfortProjectDetailsRespModel.signature; + applePayInsertRequest.accessCode = payfortProjectDetailsRespModel.accessCode; + applePayInsertRequest.shaRequestPhrase = payfortProjectDetailsRespModel.shaRequest; + applePayInsertRequest.shaResponsePhrase = payfortProjectDetailsRespModel.shaResponse; + applePayInsertRequest.returnURL = ""; + + service.applePayInsertRequest(applePayInsertRequest, localContext).then((res) async { + await localContext.read().initiateApplePayWithPayfort( + customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + orderDescription: "LiveCare Payment", + orderAmount: double.parse(amount), + merchantReference: transID, + payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, + currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + onFailed: (failureResult) async { + log("failureResult: ${failureResult.toString()}"); + GifLoaderDialogUtils.hideDialog(localContext); + AppToast.showErrorToast(message: failureResult.toString()); + }, + onSuccess: (successResult) async { + GifLoaderDialogUtils.hideDialog(localContext); + log("Payfort: ${successResult.responseMessage}"); + await localContext.read().addPayfortApplePayResponse(result: successResult); + checkPaymentStatus(appo); + }, + projectId: appo.projectID, + serviceTypeEnum: ServiceTypeEnum.appointmentPayment, + ); + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(localContext); + AppToast.showErrorToast(message: err); + }); + } catch (ex) { + print(ex.toString()); + GifLoaderDialogUtils.hideDialog(localContext); + } } openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); selectedPaymentMethod = paymentMethod[0]; selectedInstallmentPlan = paymentMethod[1]; this.amount = amount.toString(); - browser.openPaymentBrowser( - amount, - "LiveCare Payment", - widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), - "12", - authenticatedUser.emailAddress, - paymentMethod[0], - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - browser, - false, - "4", - selectedClinicID, - context, - "", - "", - "", - "", - paymentMethod[1]); + browser.openPaymentBrowser(amount, "LiveCare Payment", widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID, "12", authenticatedUser.emailAddress, paymentMethod[0], + authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID, context, "", "", "", "", paymentMethod[1]); } onBrowserLoadStart(String url) { @@ -560,10 +553,7 @@ class _clinic_listState extends State { final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service - .checkPaymentStatus( - widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), widget.isPharmacyLiveCare, context) - .then((res) { + service.checkPaymentStatus(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID, widget.isPharmacyLiveCare, context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; amount = res['Amount'].toString(); @@ -611,7 +601,7 @@ class _clinic_listState extends State { isDataLoaded = false; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getLivecareClinics(languageID == 'ar' ? 1: 2, context).then((res) { + service.getLivecareClinics(languageID == 'ar' ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['PatientER_GetClinicsList'].length); if (res['MessageStatus'] == 1) { diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index 5a00700c..d8cef846 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -49,12 +49,8 @@ class PayfortService extends BaseService { "ECI": result.eci, "Response_Message": result.responseMessage, "Card_Number": result.cardNumber, - // "Card_Bin": result.ca, "Status": result.status, "Merchant_Ref": result.merchantReference, - // Installments_Number - // plan_code - // issuer_code "Pat_Token": result.tokenName, "IsRefund": false, "RemmeberMe": false, @@ -62,7 +58,6 @@ class PayfortService extends BaseService { "LanguageID": 1, }; - // PayfortProjectDetailsRespModel payfortProjectDetailsRespModel = PayfortProjectDetailsRespModel(); await baseAppClient.post( addPayFortApplePayResponse, onSuccess: (response, statusCode) async { From bbc42bd1e739cdd542e0a587487f06fb31893d18 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 16 Jan 2024 08:44:20 +0300 Subject: [PATCH 54/71] updates --- lib/core/service/client/base_app_client.dart | 4 ++-- lib/services/appointment_services/GetDoctorsList.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f756ba8e..7b294b28 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -280,7 +280,7 @@ class BaseAppClient { } catch (e) { print(e); onFailure(e.toString(), -1); - _analytics.errorTracking.log(endPoint, error: "api exception: $e"); + _analytics.errorTracking.log(endPoint, error: "api exception: $e - API Path: $url"); } } @@ -450,7 +450,7 @@ class BaseAppClient { } catch (e) { print(e); onFailure(e.toString(), -1); - _analytics.errorTracking.log(endPoint, error: "api exception: $e"); + _analytics.errorTracking.log(endPoint, error: "api exception: $e - API Path: $url"); } } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 47826a43..bc08fd25 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -805,7 +805,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, - "LanguageID": 1, + // "LanguageID": 1, "PatientType": authUser.patientType }; From f1a74749f7868edd193e6dfec916600b08b78093 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 16 Jan 2024 16:18:07 +0300 Subject: [PATCH 55/71] param update --- lib/services/payfort_services/payfort_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index d8cef846..308d5818 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -54,7 +54,7 @@ class PayfortService extends BaseService { "Pat_Token": result.tokenName, "IsRefund": false, "RemmeberMe": false, - "Reconciliation_Reference": result.reconcilationReference, + "Reconciliation_Reference": result.reconciliationReference, "LanguageID": 1, }; From eb1bddf77296cd45fc50829c0d0daa4273f12494 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Jan 2024 13:31:52 +0300 Subject: [PATCH 56/71] updates --- android/app/build.gradle | 4 ++-- lib/config/config.dart | 4 ++-- lib/core/service/client/base_app_client.dart | 4 ++-- lib/pages/BookAppointment/BookConfirm.dart | 2 +- lib/services/appointment_services/GetDoctorsList.dart | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 965934fd..75a9b598 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -41,7 +41,7 @@ configurations.all { } android { - compileSdkVersion 33 + compileSdkVersion 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -57,7 +57,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.ejada.hmg" minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true diff --git a/lib/config/config.dart b/lib/config/config.dart index bc651005..5c5f984c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 7b294b28..8818d6bb 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -174,8 +174,8 @@ class BaseAppClient { } // body['IdentificationNo'] = 1023854217; - // body['MobileNo'] = "531940021"; - // body['PatientID'] = 1400563; //3844083 + // body['MobileNo'] = "531940021"; //0560717232 + // body['PatientID'] = 1400563; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 63f58910..9f6c5df5 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -262,7 +262,7 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context, isReschedule: true).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () async { + Future.delayed(new Duration(milliseconds: 500), () async { if (isLiveCareSchedule != null && isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index bc08fd25..d057dcbb 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -704,7 +704,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, - "LanguageID": 1, + // "LanguageID": 1, "PatientType": authUser.patientType }; From c29e2c88f0d4d4ff6bb8b94cbc21c97cd1356d13 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Jan 2024 14:01:25 +0300 Subject: [PATCH 57/71] location timeout handled in online check-in via location --- lib/config/localized_values.dart | 1 + lib/uitl/location_util.dart | 30 +++++++++++++++++++++--- lib/uitl/translations_delegate_base.dart | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cc45dfeb..34251a8f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1905,4 +1905,5 @@ const Map localizedValues = { "locationCheckInError": {"en": "Please make sure that you're within the hospital location to perform online check-in.", "ar": "يرجى التأكد من تواجدك داخل موقع المستشفى لإجراء تسجيل الوصول عبر الإنترنت."}, "upcoming": {"en": "Upcoming", "ar": "المواعيد القادمة"}, "noUpcomingAppointment": {"en": "No upcoming appointments", "ar": "لا توجد مواعيد القادمة"}, + "locationTimeoutError": {"en": "Unable to fetch your location, Please try again.", "ar": "غير قادر على جلب موقعك، يرجى المحاولة مرة أخرى."}, }; \ No newline at end of file diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index b890882f..a73c48e9 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -36,9 +36,12 @@ class LocationUtils { if (value) { await Geolocator.checkPermission().then((permission) async { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low, timeLimit: Duration(seconds: 10)).then((value) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best, timeLimit: Duration(seconds: 1)).then((value) { setLocation(value); if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); + }).catchError((err) { + print(err); + if (isShowConfirmDialog) showLocationTimeOutDialog(failureCallBack: failureCallBack); }); } @@ -52,7 +55,7 @@ class LocationUtils { if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: failureCallBack); } }); } else { @@ -60,7 +63,7 @@ class LocationUtils { getCurrentLocation(callBack: callBack); } else { setZeroLocation(); - if (isShowConfirmDialog) showErrorLocationDialog(false); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: failureCallBack); } } } @@ -141,6 +144,27 @@ class LocationUtils { } } + showLocationTimeOutDialog({Function() failureCallBack}) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).locationTimeoutError, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () { + ConfirmDialog.closeAlertDialog(context); + Navigator.of(context).canPop(); + if (failureCallBack != null) { + failureCallBack(); + } + }, + cancelFunction: () { + if (failureCallBack != null) { + failureCallBack(); + } + }); + return dialog.showAlertDialog(context); + } + showErrorLocationDialog(bool isPermissionError, {Function() failureCallBack}) { ConfirmDialog dialog = new ConfirmDialog( context: context, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 03a76dc1..150b23c1 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2914,6 +2914,7 @@ class TranslationBase { String get locationCheckInError => localizedValues["locationCheckInError"][locale.languageCode]; String get upcoming => localizedValues["upcoming"][locale.languageCode]; String get noUpcomingAppointment => localizedValues["noUpcomingAppointment"][locale.languageCode]; + String get locationTimeoutError => localizedValues["locationTimeoutError"][locale.languageCode]; } From 1b0961a08f577b2c7b1c6fecb3cfd508606e3b18 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Jan 2024 14:22:10 +0300 Subject: [PATCH 58/71] location timeout --- lib/uitl/location_util.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index a73c48e9..2d0424c5 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -36,7 +36,7 @@ class LocationUtils { if (value) { await Geolocator.checkPermission().then((permission) async { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best, timeLimit: Duration(seconds: 1)).then((value) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best, timeLimit: Duration(seconds: 5)).then((value) { setLocation(value); if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }).catchError((err) { From 0168f06bb920da3212b04154374c7c3b6d681180 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 18 Jan 2024 10:53:52 +0300 Subject: [PATCH 59/71] updates --- lib/uitl/gif_loader_dialog_utils.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index eae84e38..d95307de 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -11,7 +11,7 @@ class GifLoaderDialogUtils { try { Navigator.of(context).pop(); } catch (error) { - Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop()); + Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).canPop()); } } } From 7850748ea2a4015af93f71615005ab98560fe819 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 22 Jan 2024 11:08:54 +0300 Subject: [PATCH 60/71] Dental updates --- lib/config/config.dart | 4 ++-- lib/pages/BookAppointment/DentalComplaints.dart | 8 +++++--- lib/pages/BookAppointment/DoctorProfile.dart | 4 +++- .../components/DocAvailableAppointments.dart | 5 +++-- lib/pages/BookAppointment/widgets/DoctorView.dart | 11 +++++++---- lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart | 2 +- lib/services/appointment_services/GetDoctorsList.dart | 5 +++-- lib/services/clinic_services/get_clinic_service.dart | 6 +++--- 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5c5f984c..bc651005 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 487fbab4..67cd0215 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -118,6 +118,7 @@ class _DentalComplaintsState extends State { return DoctorView( doctor: doctor, isLiveCareAppointment: false, + isContinueDentalPlan: hasDentalPlan, ); }).toList(), )), @@ -146,8 +147,8 @@ class _DentalComplaintsState extends State { confirmMessage: TranslationBase.of(context).continuePlan, okText: TranslationBase.of(context).yes, cancelText: TranslationBase.of(context).no, - okFunction: () => {Navigator.of(context).pop(), continueDentalPlan()}, - cancelFunction: () => {getChiefComplaintsList()}); + okFunction: () => {Navigator.of(context).pop(), continueDentalPlan(), hasDentalPlan = true}, + cancelFunction: () => {getChiefComplaintsList(), hasDentalPlan = false}); dialog.showAlertDialog(context); } else { getChiefComplaintsList(); @@ -260,8 +261,9 @@ class _DentalComplaintsState extends State { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); getLanguageID(); + hasDentalPlan = false; ClinicListService service = new ClinicListService(); - service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, languageID, context).then((res) { + service.getChiefComplaintsList(widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, languageID, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 1ad0bf67..9c44fabf 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -39,8 +39,9 @@ class DoctorProfile extends StatefulWidget { final bool isOpenAppt; bool isLiveCareAppointment; bool isDoctorNameSearch; + bool isContinueDentalPlan; - DoctorProfile({@required this.doctor, @required this.docProfileList, @required this.isLiveCareAppointment, this.isOpenAppt = false, this.isDoctorNameSearch = false}); + DoctorProfile({@required this.doctor, @required this.docProfileList, @required this.isLiveCareAppointment, this.isOpenAppt = false, this.isDoctorNameSearch = false, this.isContinueDentalPlan = false}); AuthenticatedUser authUser; @@ -203,6 +204,7 @@ class _DoctorProfileState extends State with TickerProviderStateM doctor: widget.doctor, isLiveCareAppointment: widget.isLiveCareAppointment, doctorSchedule: doctorSchedule, + isContinueDentalPlan: widget.isContinueDentalPlan, ), ], controller: _tabController, diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 61e697f4..d1aaa1f5 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -27,10 +27,11 @@ class DocAvailableAppointments extends StatefulWidget { static String selectedDate; static String selectedTime; bool isLiveCareAppointment; + bool isContinueDentalPlan; final dynamic doctorSchedule; static int initialSlotDuration; - DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment}); + DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment, this.isContinueDentalPlan = false}); @override _DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState(); @@ -320,7 +321,7 @@ class _DocAvailableAppointmentsState extends State wit print(DocAvailableAppointments.initialSlotDuration); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context, projectViewModel).then((res) { + service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.isContinueDentalPlan, context, projectViewModel).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 6969302f..3e14a6fc 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -28,6 +28,7 @@ class DoctorView extends StatelessWidget { bool isObGyneAppointment; bool isShowFlag; bool isDoctorNameSearch; + bool isContinueDentalPlan; OBGyneProcedureListResponse obGyneProcedureListResponse; final VoidCallback onTap; @@ -36,6 +37,7 @@ class DoctorView extends StatelessWidget { @required this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isDoctorNameSearch = false, + this.isContinueDentalPlan = false, this.isShowFlag = true, this.onTap, this.obGyneProcedureListResponse}); @@ -54,7 +56,7 @@ class DoctorView extends StatelessWidget { // showDentalChiefComplaintsList(context); // } else if (isShowFlag) { - getDoctorsProfile(context, doctor, isAppo: true); + getDoctorsProfile(context, doctor, isAppo: true, isContinueDentalPlan: isContinueDentalPlan); } (onTap ?? () {})(); // For log analytics of doctor click from book appointment } @@ -182,7 +184,7 @@ class DoctorView extends StatelessWidget { return docSpeciality; } - getDoctorsProfile(context, DoctorList docObject, {isAppo}) { + getDoctorsProfile(context, DoctorList docObject, {isAppo, bool isContinueDentalPlan = false}) { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List docProfileList = []; @@ -195,7 +197,7 @@ class DoctorView extends StatelessWidget { docProfileList.add(new DoctorProfileList.fromJson(v)); }); } else {} - navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo); + navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo, isContinueDentalPlan: isContinueDentalPlan); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -234,7 +236,7 @@ class DoctorView extends StatelessWidget { FadePage(page: ObGyneTimeSlots(projectID: doctor.projectID, selectedClinicID: doctor.clinicID, selectedDoctorID: doctor.doctorID, obGyneProcedureListResponse: obGyneProcedureListResponse))); } - Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo, bool isContinueDentalPlan = false}) async { Navigator.push( context, FadePage( @@ -244,6 +246,7 @@ class DoctorView extends StatelessWidget { docProfileList: docProfile, isOpenAppt: isAppo, isDoctorNameSearch: isDoctorNameSearch, + isContinueDentalPlan: isContinueDentalPlan, ), ), ); diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index 242a072f..0d02afe8 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -466,7 +466,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta getCovidFreeSlots(BuildContext context, int projectID) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.getDoctorFreeSlots(widget.selectedDoctorID, widget.selectedClinicID, widget.projectID, context).then((res) { + service.getDoctorFreeSlots(widget.selectedDoctorID, widget.selectedClinicID, widget.projectID, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index d057dcbb..b85ec599 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -257,7 +257,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel projectViewModel]) async { + Future getDoctorFreeSlots(int docID, int clinicID, int projectID, bool isContinueDentalPlan, BuildContext context, [ProjectViewModel projectViewModel]) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -277,7 +277,8 @@ class DoctorsListService extends BaseService { "SessionID": null, "isDentalAllowedBackend": false, "LanguageID": 1, - "DeviceTypeID": 1 + "DeviceTypeID": 1, + "ContinueDentalPlan": isContinueDentalPlan, }; if (clinicID == 253) { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 80032015..8b1098e6 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -61,7 +61,7 @@ class ClinicListService extends BaseService { return Future.value(localRes); } - Future getChiefComplaintsList(int clinicID, int projectID, int languageID, BuildContext context, {doctorId}) async { + Future getChiefComplaintsList(int clinicID, int projectID, int languageID, bool isContinueDentalPlan, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -86,8 +86,8 @@ class ClinicListService extends BaseService { "SessionID": null, "isDentalAllowedBackend": true, "DeviceTypeID": 1, - "PatientID": 1, - "ContinueDentalPlan": true, + // "PatientID": 1, + "ContinueDentalPlan": isContinueDentalPlan, "IsSearchAppointmnetByClinicID": false, "DateofBirth": authUser.dateofBirth }; From 3792a67ae7246b1f4809cfea49e5bd644f694d77 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 23 Jan 2024 09:54:46 +0300 Subject: [PATCH 61/71] updates --- android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gradle.properties b/android/gradle.properties index c5ccb9b6..73fec6d1 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx4096m android.enableR8=true android.useAndroidX=true android.enableJetifier=true \ No newline at end of file From b4138b2066c719c955280cdac6e63f5429895fff Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 23 Jan 2024 18:13:01 +0300 Subject: [PATCH 62/71] Show Date check added in DoctorView --- lib/pages/BookAppointment/SearchResults.dart | 1 + .../BookAppointment/widgets/DoctorView.dart | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 3d95a694..d230f700 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -65,6 +65,7 @@ class _SearchResultsState extends State { isObGyneAppointment: widget.isObGyneAppointment, isDoctorNameSearch: widget.isDoctorNameSearch, obGyneProcedureListResponse: widget.obGyneProcedureListResponse, + isShowDate: false, onTap: () { projectViewModel.analytics.appointment.book_appointment_select_doctor(appointment_type: 'regular', doctor: doctor); }); diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 3e14a6fc..7e1a7d53 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -31,6 +31,7 @@ class DoctorView extends StatelessWidget { bool isContinueDentalPlan; OBGyneProcedureListResponse obGyneProcedureListResponse; final VoidCallback onTap; + bool isShowDate; DoctorView( {@required this.doctor, @@ -39,6 +40,7 @@ class DoctorView extends StatelessWidget { this.isDoctorNameSearch = false, this.isContinueDentalPlan = false, this.isShowFlag = true, + this.isShowDate = true, this.onTap, this.obGyneProcedureListResponse}); @@ -55,7 +57,7 @@ class DoctorView extends StatelessWidget { // if (doctor.clinicID == 17 && isDoctorNameSearch) { // showDentalChiefComplaintsList(context); // } else - if (isShowFlag) { + if (isShowFlag) { getDoctorsProfile(context, doctor, isAppo: true, isContinueDentalPlan: isContinueDentalPlan); } (onTap ?? () {})(); // For log analytics of doctor click from book appointment @@ -89,10 +91,10 @@ class DoctorView extends StatelessWidget { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), - Text( + isShowDate ? Text( DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), - ), + ) : Container(), ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), @@ -171,9 +173,14 @@ class DoctorView extends StatelessWidget { searchInfo.hospital = selectedHospital; searchInfo.clinic = selectedClinic; - showDraggableDialog(context, DentalComplaints(isDoctorNameSearch: true, onSelectedMethod: () { - Navigator.pop(context); - }, searchInfo: searchInfo)); + showDraggableDialog( + context, + DentalComplaints( + isDoctorNameSearch: true, + onSelectedMethod: () { + Navigator.pop(context); + }, + searchInfo: searchInfo)); } String getDoctorSpeciality(List docSpecial) { From e28805f70f87da43645609ad7f050e7894c09944 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 24 Jan 2024 14:13:23 +0300 Subject: [PATCH 63/71] updates --- ios/Runner/Runner.entitlements | 4 ++++ lib/core/model/prescriptions/prescription_report_inp.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 44ce1b68..fbd726da 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -4,6 +4,10 @@ aps-environment development + com.apple.developer.associated-domains + + applinks:hmg.com + com.apple.developer.healthkit com.apple.developer.healthkit.access diff --git a/lib/core/model/prescriptions/prescription_report_inp.dart b/lib/core/model/prescriptions/prescription_report_inp.dart index b802337b..079b1bda 100644 --- a/lib/core/model/prescriptions/prescription_report_inp.dart +++ b/lib/core/model/prescriptions/prescription_report_inp.dart @@ -18,7 +18,7 @@ class PrescriptionReportINP { int days; String startDate; String orderDate; - int doseDailyQuantity; + num doseDailyQuantity; int itemID; Null productImage; String sKU; From 9043e3c687be72e796268a615373b70ec87033b5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 25 Jan 2024 13:18:15 +0300 Subject: [PATCH 64/71] Apple Pay Updates --- lib/core/service/client/base_app_client.dart | 2 +- .../ancillary-orders/ancillaryOrdersDetails.dart | 12 +++++++++--- lib/pages/BookAppointment/BookSuccess.dart | 12 +++++++++--- lib/pages/ToDoList/ToDo.dart | 12 +++++++++--- lib/pages/livecare/widgets/clinic_list.dart | 12 +++++++++--- lib/pages/medical/balance/confirm_payment_page.dart | 12 +++++++++--- 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 8818d6bb..e9fa657e 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 1400563; //4609100 + // body['PatientID'] = 1374756; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 701fc269..66008a86 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -517,7 +517,11 @@ class _AnicllaryOrdersState extends State with SingleTic selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; if (selectedPaymentMethod == "ApplePay") { - startApplePay(); + if (projectViewModel.havePrivilege(103)) { + startApplePay(); + } else { + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); + } } else { openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, selectedInstallmentPlan); } @@ -544,7 +548,8 @@ class _AnicllaryOrdersState extends State with SingleTic applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); @@ -584,7 +589,8 @@ class _AnicllaryOrdersState extends State with SingleTic service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Ancillary Order Payment", orderAmount: double.parse(getTotalValue()), merchantReference: transID, diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index f6ece784..bf16e987 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -633,7 +633,11 @@ class _BookSuccessState extends State { selectedPaymentMethod = value[0]; if (value != null) { if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, patientShareResponse); + if (projectViewModel.havePrivilege(103)) { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } } else { openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } @@ -658,7 +662,8 @@ class _BookSuccessState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); @@ -698,7 +703,8 @@ class _BookSuccessState extends State { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Appointment Payment", orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 771a6557..bbd7d579 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1310,7 +1310,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (value != null) { final appType = appo.isLiveCareAppointment ? 'livecare' : 'regular'; if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, patientShareResponse); + if (projectViewModel.havePrivilege(103)) { + startApplePay(appo, patientShareResponse); + } else { + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + } } else { openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } @@ -1335,7 +1339,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); @@ -1375,7 +1380,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Appointment Payment", orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index f0beb79b..faff8c98 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -336,7 +336,11 @@ class _clinic_listState extends State { widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue; if (value != null) { if (selectedPaymentMethod == "ApplePay") { - startApplePay(appo, getERAppointmentFeesList.total); + if (projectViewModel.havePrivilege(103)) { + startApplePay(appo, getERAppointmentFeesList.total); + } else { + openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + } } else { openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); } @@ -366,7 +370,8 @@ class _clinic_listState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); @@ -406,7 +411,8 @@ class _clinic_listState extends State { service.applePayInsertRequest(applePayInsertRequest, localContext).then((res) async { await localContext.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "LiveCare Payment", orderAmount: double.parse(amount), merchantReference: transID, diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 8a70c6f9..e63264a4 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -221,7 +221,11 @@ class _ConfirmPaymentPageState extends State { () async { if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { if (widget.selectedPaymentMethod == "ApplePay") { - startApplePay(); + if (projectViewModel.havePrivilege(103)) { + startApplePay(); + } else { + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); + } } else { openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); } @@ -260,7 +264,8 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; - applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); @@ -300,7 +305,8 @@ class _ConfirmPaymentPageState extends State { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, - customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, + customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", orderDescription: "Advance Payment", orderAmount: double.parse(widget.advanceModel.amount), merchantReference: transID, From ccdf410995c58abfc51e2f0139bdbace0e4bafc2 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 28 Jan 2024 11:12:01 +0300 Subject: [PATCH 65/71] Update to stores --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index db84daa7..0067c96b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.77; + MARKETING_VERSION = 4.5.81; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.77; + MARKETING_VERSION = 4.5.81; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.77; + MARKETING_VERSION = 4.5.81; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/pubspec.yaml b/pubspec.yaml index 53c72f22..e346f37c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.79+1 +version: 4.5.044+4050044 environment: sdk: ">=2.7.0 <3.0.0" From 30b57ff5f034d2cb118205ea253b697f82eaf060 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 29 Jan 2024 09:09:20 +0300 Subject: [PATCH 66/71] updates --- apple-app-site-association.json | 11 +++++++++++ assetlinks.json | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 apple-app-site-association.json create mode 100644 assetlinks.json diff --git a/apple-app-site-association.json b/apple-app-site-association.json new file mode 100644 index 00000000..3c3a8b7e --- /dev/null +++ b/apple-app-site-association.json @@ -0,0 +1,11 @@ +{ + "applinks": { + "apps": [], + "details": [ + { + "appID": "3A359E86ZF.com.HMG.HMG-Smartphone", + "paths": ["*"] + } + ] + } + } \ No newline at end of file diff --git a/assetlinks.json b/assetlinks.json new file mode 100644 index 00000000..d68ca550 --- /dev/null +++ b/assetlinks.json @@ -0,0 +1,26 @@ +[ + { + "relation": [ + "delegate_permission/common.handle_all_urls" + ], + "target": { + "namespace": "android_app", + "package_name": "com.ejada.hmg", + "sha256_cert_fingerprints": [ + "57:EA:97:F9:C2:03:52:83:C1:13:E7:D9:9E:AD:55:B3:77:07:C5:14:6C:AA:1E:C8:70:24:73:DD:7F:25:A8:7B" + ] + } + }, + { + "relation": [ + "delegate_permission/common.handle_all_urls" + ], + "target": { + "namespace": "android_app", + "package_name": "com.ejada.hmg", + "sha256_cert_fingerprints": [ + "10:AC:36:05:DD:D5:63:3F:FF:0D:88:C3:9C:92:F1:12:1D:EE:1A:A8:4D:0C:85:AE:6C:B9:A9:C0:0C:7F:03:B5" + ] + } + } +] \ No newline at end of file From cb79d625d1a20d399561283e7dd6f800f9f72da0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 29 Jan 2024 12:21:25 +0300 Subject: [PATCH 67/71] Update to stores for LiveCare fix --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/config/config.dart | 2 +- lib/pages/BookAppointment/BookSuccess.dart | 2 +- lib/pages/ToDoList/ToDo.dart | 2 +- lib/pages/livecare/widgets/clinic_list.dart | 12 ++++++------ lib/uitl/utils.dart | 5 +++-- pubspec.yaml | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0067c96b..70c9bd9b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.81; + MARKETING_VERSION = 4.5.82; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.81; + MARKETING_VERSION = 4.5.82; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.81; + MARKETING_VERSION = 4.5.82; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index bc651005..09255501 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -343,7 +343,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 = 12.0; +var VERSION_ID = 12.1; 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 bf16e987..810f977b 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -677,7 +677,7 @@ class _BookSuccessState extends State { applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; - applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.orderDescription = "Appointment Payment"; applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index bbd7d579..37161678 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1354,7 +1354,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; - applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.orderDescription = "Appointment Payment"; applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index faff8c98..0e1ba5aa 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -352,7 +352,7 @@ class _clinic_listState extends State { void startApplePay(AppoitmentAllHistoryResultList appo, String amount) async { try { - transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo, isAddMilliseconds: false); print("TransactionID: $transID"); GifLoaderDialogUtils.showMyDialog(localContext); @@ -445,7 +445,7 @@ class _clinic_listState extends State { openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo, isAddMilliseconds: false); selectedPaymentMethod = paymentMethod[0]; selectedInstallmentPlan = paymentMethod[1]; this.amount = amount.toString(); @@ -491,7 +491,7 @@ class _clinic_listState extends State { print("onBrowserExit Called!!!!"); try { if (selectedPaymentMethod == "TAMARA") { - checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + checkTamaraPaymentStatus(transID, appo); // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallmentPlan), appo); // } else { @@ -515,7 +515,7 @@ class _clinic_listState extends State { updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(selectedInstallmentPlan), appo); } else { updateTamaraRequestStatus( - "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo); + "Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -532,7 +532,7 @@ class _clinic_listState extends State { service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) { GifLoaderDialogUtils.hideDialog(context); if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { - addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); + addNewCallForPatientER(transID); } else { AppToast.showErrorToast(message: res['Response_Message']); projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed( @@ -565,7 +565,7 @@ class _clinic_listState extends State { amount = res['Amount'].toString(); payment_method = res['PaymentMethod']; if (paymentInfo == 'Success') { - addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); + addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : transID); } else { AppToast.showErrorToast(message: res['Response_Message']); projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed( diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 050badb9..d93cec9b 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -153,8 +153,9 @@ class Utils { } } - static String getAppointmentTransID(int projectID, int clinicID, int appoNo) { - return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString(); + static String getAppointmentTransID(int projectID, int clinicID, int appoNo, {bool isAddMilliseconds = true}) { + String currentMillis = DateTime.now().millisecondsSinceEpoch.toString(); + return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString() + (isAddMilliseconds ? '-' + currentMillis.substring(currentMillis.length - 5, currentMillis.length) : ""); } static String getAdvancePaymentTransID(int projectID, int fileNumber) { diff --git a/pubspec.yaml b/pubspec.yaml index e346f37c..2a44171b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.044+4050044 +version: 4.5.046+4050046 environment: sdk: ">=2.7.0 <3.0.0" From 180cc437053aa3fb65df18dd1f601c3e179f2f8b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 30 Jan 2024 09:41:21 +0300 Subject: [PATCH 68/71] Update to stores --- SmsOtpAutoVerifyPlugin.kt | 216 +++++++++++++++++++ android/build.gradle | 2 +- ios/Runner.xcodeproj/project.pbxproj | 6 +- lib/config/config.dart | 2 +- lib/pages/ToDoList/ToDo.dart | 2 +- lib/pages/livecare/widgets/clinic_list.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- lib/widgets/otp/sms-popup.dart | 2 +- pubspec.yaml | 2 +- 9 files changed, 227 insertions(+), 11 deletions(-) create mode 100644 SmsOtpAutoVerifyPlugin.kt diff --git a/SmsOtpAutoVerifyPlugin.kt b/SmsOtpAutoVerifyPlugin.kt new file mode 100644 index 00000000..a6fafd90 --- /dev/null +++ b/SmsOtpAutoVerifyPlugin.kt @@ -0,0 +1,216 @@ +package com.oohyugi.sms_otp_auto_verify + +import android.app.Activity +import android.app.PendingIntent +import android.content.Context +import android.content.Intent + +import android.content.IntentFilter +import android.content.IntentSender +import android.os.Build +import android.telephony.TelephonyManager +import android.util.Log +import androidx.annotation.RequiresApi +import com.google.android.gms.auth.api.credentials.Credential +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import com.google.android.gms.auth.api.phone.SmsRetriever; +import com.google.android.gms.auth.api.phone.SmsRetrieverClient +import io.flutter.embedding.engine.plugins.FlutterPlugin +import io.flutter.embedding.engine.plugins.activity.ActivityAware +import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.PluginRegistry +import com.google.android.gms.auth.api.credentials.Credentials +import com.google.android.gms.auth.api.credentials.HintRequest +import io.flutter.plugin.common.PluginRegistry.Registrar +import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.RECEIVER_EXPORTED + + +/** SmsOtpAutoVerifyPlugin */ +class SmsOtpAutoVerifyPlugin : FlutterPlugin, MethodCallHandler, + MySmsListener, ActivityAware { + private var channel: MethodChannel? = null + private var pendingResult: MethodChannel.Result? = null + private var receiver: SmsBroadcastReceiver? = null + private var alreadyCalledSmsRetrieve = false + private var client: SmsRetrieverClient? = null + private var activity: Activity? = null + private var binding: ActivityPluginBinding? = null + + private val activityResultListener: PluginRegistry.ActivityResultListener = + object : PluginRegistry.ActivityResultListener { + override fun onActivityResult( + requestCode: Int, + resultCode: Int, + data: Intent? + ): Boolean { + if (requestCode == REQUEST_RESOLVE_HINT) { + if (resultCode == Activity.RESULT_OK && data != null) { + val credential: Credential? = data.getParcelableExtra(Credential.EXTRA_KEY) + val phoneNumber: String? = credential?.id + pendingResult?.success(phoneNumber) + } else { + pendingResult?.success(null) + } + return true + } + return false + } + } + + companion object { + private const val channelName = "sms_otp_auto_verify" + private const val REQUEST_RESOLVE_HINT = 1256 + + @JvmStatic + fun setup(plugin: SmsOtpAutoVerifyPlugin, binaryMessenger: BinaryMessenger) { + plugin.channel = MethodChannel(binaryMessenger, channelName) + plugin.channel?.setMethodCallHandler(plugin) + plugin.binding?.addActivityResultListener(plugin.activityResultListener) + + } + } + + + override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { + setup(plugin = this, binding.binaryMessenger) + } + + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + unregister() + } + + @RequiresApi(Build.VERSION_CODES.O) + override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { + when (call.method) { + "getAppSignature" -> { + activity?.let { + val signature = AppSignatureHelper(it).getAppSignatures()[0] + result.success(signature) + } + + } + + "startListening" -> { + this.pendingResult = result + receiver = SmsBroadcastReceiver() + startListening() + + } + + "stopListening" -> { + pendingResult = null + unregister() + } + + "requestPhoneHint" -> { + this.pendingResult = result + requestHint() + + } + + else -> result.notImplemented() + } + } + + private fun requestHint() { + if (!isSimSupport()) { + pendingResult?.success(null) + return + } + + val hintRequest = HintRequest.Builder() + .setPhoneNumberIdentifierSupported(true) + .build() + + activity?.apply { + val intent = Credentials.getClient(this).getHintPickerIntent(hintRequest) + try { + startIntentSenderForResult( + intent.intentSender, + REQUEST_RESOLVE_HINT, null, 0, 0, 0 + ) + } catch (e: IntentSender.SendIntentException) { + e.printStackTrace() + } + } + } + + private fun isSimSupport(): Boolean { + val telephonyManager: TelephonyManager = + activity!!.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager + return (telephonyManager.simState == TelephonyManager.SIM_STATE_ABSENT) + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun startListening() { + activity?.let { + client = SmsRetriever.getClient(it) + } + val task = client?.startSmsRetriever() + task?.addOnSuccessListener { + // Successfully started retriever, expect broadcast intent + unregister() + Log.e(javaClass::getSimpleName.name, "task started") + receiver?.setSmsListener(this) + + activity?.applicationContext?.let { it1 -> + ContextCompat.registerReceiver( + it1, receiver, + IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION), RECEIVER_EXPORTED) + } + } + } + + private fun unregister() { + alreadyCalledSmsRetrieve = false + if (receiver != null) { + try { + activity?.unregisterReceiver(receiver) + Log.d(javaClass::getSimpleName.name, "task stoped") + receiver = null + } catch (e: Exception) { + } + } + } + + override fun onOtpReceived(message: String?) { + message?.let { + if (!alreadyCalledSmsRetrieve) { + pendingResult?.success(it) + alreadyCalledSmsRetrieve = true + } else { + Log.d("onOtpReceived: ", "already called") + } + } + + } + + override fun onOtpTimeout() { + } + + + override fun onAttachedToActivity(binding: ActivityPluginBinding) { + activity = binding.activity + this.binding = binding + binding.addActivityResultListener(activityResultListener); } + + override fun onDetachedFromActivityForConfigChanges() { + unregister() + } + + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { + activity = binding.activity + this.binding = binding + binding.addActivityResultListener(activityResultListener); + } + + override fun onDetachedFromActivity() { + unregister() + } + + +} diff --git a/android/build.gradle b/android/build.gradle index e723adba..78038517 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.20' + ext.kotlin_version = '1.8.0' repositories { google() jcenter() diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 70c9bd9b..1514bc24 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.82; + MARKETING_VERSION = 4.5.84; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.82; + MARKETING_VERSION = 4.5.84; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.82; + MARKETING_VERSION = 4.5.84; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index 09255501..e7013cf6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -343,7 +343,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 = 12.1; +var VERSION_ID = 12.3; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 37161678..d16c6579 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1282,7 +1282,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, - Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) + transID, projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); getPatientAppointmentHistory(); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 0e1ba5aa..1dbf72e4 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -386,7 +386,7 @@ class _clinic_listState extends State { applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; applePayInsertRequest.orderDescription = "LiveCare Payment"; - applePayInsertRequest.liveServiceID = "0"; + applePayInsertRequest.liveServiceID = selectedClinicID.toString(); applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; applePayInsertRequest.amount = amount; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c9fecbf9..c71b206b 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 64c981b2..d1affc14 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -103,7 +103,7 @@ class SMSOTP { startTimer(setState); // startLister(); - if (Platform.isAndroid) checkSignature(); + if (Platform.isAndroid && type == 1) checkSignature(); } return Container( diff --git a/pubspec.yaml b/pubspec.yaml index 2a44171b..addd6356 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.046+4050046 +version: 4.5.84+1 environment: sdk: ">=2.7.0 <3.0.0" From 32757c85f8af592841b6abbea20fdf08ba6e90ee Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 31 Jan 2024 09:53:56 +0300 Subject: [PATCH 69/71] updates --- .../new_Home_health_care_step_three_page.dart | 8 -------- lib/pages/BookAppointment/BookSuccess.dart | 2 +- lib/pages/Covid-DriveThru/covid-payment-summary.dart | 12 +++++++----- lib/pages/ToDoList/ToDo.dart | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart index d580f2bb..61a51d1b 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart @@ -104,14 +104,6 @@ class _NewHomeHealthCareStepThreePageState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { try { if (selectedPaymentMethod == "TAMARA") { - checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + checkTamaraPaymentStatus(transID, appo); // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); // } else { diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index e1f00173..5ba533da 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -31,7 +31,6 @@ class CovidPaymentSummary extends StatefulWidget { MyInAppBrowser browser; AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); - String transID = ""; CovidPaymentSummary({@required this.patientShareResponse, this.selectedPaymentMethod}); @@ -44,6 +43,8 @@ class _CovidPaymentSummaryState extends State { String tamaraPaymentStatus; String tamaraOrderID; + String transID = ""; + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -216,7 +217,7 @@ class _CovidPaymentSummaryState extends State { openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - + transID = Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo); widget.browser.openPaymentBrowser( amount, "Covid appointment payment", @@ -276,7 +277,8 @@ class _CovidPaymentSummaryState extends State { print("onBrowserExit Called!!!!"); try { if (widget.selectedPaymentMethod == "TAMARA") { - checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + // checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + checkTamaraPaymentStatus(transID, appo); // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(widget.selectedInstallmentPlan), appo); // } else { @@ -299,7 +301,7 @@ class _CovidPaymentSummaryState extends State { if (res["status"].toString().toLowerCase() == "success") { updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(widget.selectedInstallmentPlan), appo); } else { - updateTamaraRequestStatus("Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", + updateTamaraRequestStatus("Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(widget.selectedInstallmentPlan), appo); } }).catchError((err) { @@ -376,7 +378,7 @@ class _CovidPaymentSummaryState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) { + service.checkPaymentStatus(transID, false, context).then((res) { print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index d16c6579..00c5b25b 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1126,7 +1126,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); if (selectedPaymentMethod == "TAMARA") { - checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + checkTamaraPaymentStatus(transID, appo); // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); // } else { @@ -1146,7 +1146,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { updateTamaraRequestStatus("success", "14", orderID, res["tamara_order_id"], num.parse(selectedInstallments), appo); } else { updateTamaraRequestStatus( - "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); + "Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); From 6e558bf5a61245b0e1216dda3b5fd5b0f975d109 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 31 Jan 2024 10:37:48 +0300 Subject: [PATCH 70/71] Splash fix --- lib/splashPage.dart | 18 +++++++++--------- lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 290bbac0..778ab6ff 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; @@ -30,16 +31,19 @@ class _SplashScreenState extends State { @override void initState() { + AppGlobal.context = context; super.initState(); Timer( Duration(seconds: 1, milliseconds: 500), () async { await loadPrivilege().then((value) { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (BuildContext context) => LandingPage(), - ), - ); + if(!_privilegeService.hasError) { + Navigator.of(context).pushReplacement( + MaterialPageRoute( + builder: (BuildContext context) => LandingPage(), + ), + ); + } else {} }); }, ); @@ -58,10 +62,6 @@ class _SplashScreenState extends State { var themeNotifier = Provider.of(context, listen: false); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); PushNotificationHandler(context).init(); // Asyncronously - AppSharedPreferences().getAll().then((value) { - // debugPrint("ALL SHARED PREFERENCES!!!!!"); - // debugPrint(jsonEncode(value)); - }); } @override diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c71b206b..c9fecbf9 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,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 46ad67264983d655546d48f17c05c7265f90982a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 31 Jan 2024 19:09:22 +0300 Subject: [PATCH 71/71] Apple Pay fixes --- .../ancillaryOrdersDetails.dart | 28 +++++++------- lib/pages/BookAppointment/BookSuccess.dart | 38 +++++++++---------- lib/pages/DrawerPages/family/my-family.dart | 1 + lib/pages/ToDoList/ToDo.dart | 34 ++++++++--------- lib/pages/livecare/widgets/clinic_list.dart | 27 +++++++------ .../medical/balance/confirm_payment_page.dart | 29 ++++++++------ .../payfort_services/payfort_service.dart | 3 +- .../payfort_services/payfort_view_model.dart | 4 +- lib/widgets/drawer/app_drawer_widget.dart | 2 + 9 files changed, 86 insertions(+), 80 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 66008a86..4352b264 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -547,23 +547,23 @@ class _AnicllaryOrdersState extends State with SingleTic applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = 0; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.currency = projectViewModel.user.outSA == 1 ? "AED" : "SAR"; // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.user.patientID}@HMG.com"; + applePayInsertRequest.customerID = projectViewModel.user.patientID; + applePayInsertRequest.customerName = projectViewModel.user.firstName + " " + projectViewModel.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = 0; applePayInsertRequest.projectID = widget.projectID.toString(); applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.patientID = projectViewModel.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.user.outSA; applePayInsertRequest.appointmentDate = null; - applePayInsertRequest.appointmentNo = 0; - applePayInsertRequest.orderDescription = "Advance Payment"; + applePayInsertRequest.appointmentNo = widget.appoNo; + applePayInsertRequest.orderDescription = "Ancillary Order Payment"; applePayInsertRequest.liveServiceID = "0"; applePayInsertRequest.latitude = "0.0"; applePayInsertRequest.longitude = "0.0"; @@ -571,7 +571,7 @@ class _AnicllaryOrdersState extends State with SingleTic applePayInsertRequest.isSchedule = "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.userName = projectViewModel.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; @@ -588,21 +588,21 @@ class _AnicllaryOrdersState extends State with SingleTic service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", orderDescription: "Ancillary Order Payment", orderAmount: double.parse(getTotalValue()), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); + await context.read().addPayfortApplePayResponse(projectViewModel.user.patientID, result: successResult); checkPaymentStatus(AppoitmentAllHistoryResultList()); }, projectId: widget.projectID, diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index b959abd1..068d0ec6 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -661,20 +661,20 @@ class _BookSuccessState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.currency = projectViewModel.user.outSA == 1 ? "AED" : "SAR"; // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.user.patientID}@HMG.com"; + applePayInsertRequest.customerID = projectViewModel.user.patientID; + applePayInsertRequest.customerName = projectViewModel.user.firstName + " " + projectViewModel.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = appo.doctorID; applePayInsertRequest.projectID = appo.projectID.toString(); - applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(); applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.patientID = projectViewModel.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; applePayInsertRequest.orderDescription = "Appointment Payment"; @@ -685,7 +685,7 @@ class _BookSuccessState extends State { applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.userName = projectViewModel.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; @@ -702,21 +702,21 @@ class _BookSuccessState extends State { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", orderDescription: "Appointment Payment", orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); + await context.read().addPayfortApplePayResponse(projectViewModel.user.patientID, result: successResult); checkPaymentStatus(appo); }, projectId: appo.projectID, @@ -792,12 +792,12 @@ class _BookSuccessState extends State { try { if (selectedPaymentMethod == "TAMARA") { checkTamaraPaymentStatus(transID, appo); - // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { - // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); - // } else { - // updateTamaraRequestStatus( - // "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); - // } + if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { + updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo); + } else { + updateTamaraRequestStatus( + "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); + } } else { checkPaymentStatus(appo); } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 9d80ee83..04d8b396 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -493,6 +493,7 @@ class _MyFamily extends State with TickerProviderStateMixin { _vitalSignService.weightKg = ""; Provider.of(context, listen: false).user = result.list; Provider.of(context, listen: false).setUser(result.list); + Provider.of(context, listen: false).authenticatedUserObject.user = result.list; try { // await appointmentRateViewModel.getIsLastAppointmentRatedList(); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 00c5b25b..75889850 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1145,8 +1145,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (res["status"].toString().toLowerCase() == "success") { updateTamaraRequestStatus("success", "14", orderID, res["tamara_order_id"], num.parse(selectedInstallments), appo); } else { - updateTamaraRequestStatus( - "Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); + updateTamaraRequestStatus("Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -1280,10 +1279,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { addVIDARequestInsert(String advanceNumber, String paymentReference, AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, - transID, projectViewModel.isArabic ? 1 : 2, context) - .then((res) { + service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, transID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); getPatientAppointmentHistory(); }).catchError((err) { @@ -1338,20 +1334,20 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.currency = projectViewModel.user.outSA == 1 ? "AED" : "SAR"; // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.user.patientID}@HMG.com"; + applePayInsertRequest.customerID = projectViewModel.user.patientID; + applePayInsertRequest.customerName = projectViewModel.user.firstName + " " + projectViewModel.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = appo.doctorID; applePayInsertRequest.projectID = appo.projectID.toString(); - applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); + applePayInsertRequest.serviceID = ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum().toString(); applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.patientID = projectViewModel.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; applePayInsertRequest.orderDescription = "Appointment Payment"; @@ -1362,7 +1358,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.userName = projectViewModel.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; @@ -1379,21 +1375,21 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { service.applePayInsertRequest(applePayInsertRequest, context).then((res) async { await context.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", orderDescription: "Appointment Payment", orderAmount: double.parse(patientShareResponse.patientShareWithTax.toString()), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); AppToast.showErrorToast(message: failureResult.toString()); }, onSuccess: (successResult) async { log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); + await context.read().addPayfortApplePayResponse(projectViewModel.user.patientID, result: successResult); checkPaymentStatus(appo); }, projectId: appo.projectID, diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 1dbf72e4..917b7488 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -369,20 +369,20 @@ class _clinic_listState extends State { applePayInsertRequest.clientRequestID = transID; applePayInsertRequest.clinicID = appo.clinicID; - applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; + applePayInsertRequest.currency = projectViewModel.user.outSA == 1 ? "AED" : "SAR"; // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; + applePayInsertRequest.customerEmail = "CustID_${projectViewModel.user.patientID}@HMG.com"; + applePayInsertRequest.customerID = projectViewModel.user.patientID; + applePayInsertRequest.customerName = projectViewModel.user.firstName + " " + projectViewModel.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = appo.doctorID; applePayInsertRequest.projectID = appo.projectID.toString(); applePayInsertRequest.serviceID = ServiceTypeEnum.liveCareAppointment.getIdFromServiceEnum().toString(); applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; - applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; - applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; + applePayInsertRequest.patientID = projectViewModel.user.patientID; + applePayInsertRequest.patientTypeID = projectViewModel.user.patientType; + applePayInsertRequest.patientOutSA = projectViewModel.user.outSA; applePayInsertRequest.appointmentDate = appo.appointmentDate; applePayInsertRequest.appointmentNo = appo.appointmentNo; applePayInsertRequest.orderDescription = "LiveCare Payment"; @@ -393,7 +393,7 @@ class _clinic_listState extends State { applePayInsertRequest.isSchedule = appo.isLiveCareAppointment ? "1" : "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.userName = projectViewModel.user.patientID; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; @@ -410,14 +410,14 @@ class _clinic_listState extends State { service.applePayInsertRequest(applePayInsertRequest, localContext).then((res) async { await localContext.read().initiateApplePayWithPayfort( - customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, + customerName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + customerEmail: "CustID_${projectViewModel.user.patientID}@HMG.com", orderDescription: "LiveCare Payment", orderAmount: double.parse(amount), merchantReference: transID, payfortProjectDetailsRespModel: payfortProjectDetailsRespModel, - currency: projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR", + currency: projectViewModel.user.outSA == 1 ? "AED" : "SAR", onFailed: (failureResult) async { log("failureResult: ${failureResult.toString()}"); GifLoaderDialogUtils.hideDialog(localContext); @@ -426,7 +426,7 @@ class _clinic_listState extends State { onSuccess: (successResult) async { GifLoaderDialogUtils.hideDialog(localContext); log("Payfort: ${successResult.responseMessage}"); - await localContext.read().addPayfortApplePayResponse(result: successResult); + await localContext.read().addPayfortApplePayResponse(projectViewModel.user.patientID, result: successResult); checkPaymentStatus(appo); }, projectId: appo.projectID, @@ -514,8 +514,7 @@ class _clinic_listState extends State { if (res["status"].toString().toLowerCase() == "success") { updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(selectedInstallmentPlan), appo); } else { - updateTamaraRequestStatus( - "Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo); + updateTamaraRequestStatus("Failed", "00", transID, tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index e63264a4..aeaa4e75 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -76,12 +76,19 @@ class _ConfirmPaymentPageState extends State { Navigator.pop(context, true); AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = widget.patientInfoAndMobileNumber.projectID; - // if (widget.selectedPaymentMethod == "ApplePay") { - // startApplePay(); - // } else { + + if (widget.selectedPaymentMethod == "ApplePay") { + if (projectViewModel.havePrivilege(103)) { + startApplePay(); + } else { + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); + } + } else { + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), AppoitmentAllHistoryResultList()); + } + projectViewModel.analytics.advancePayments.payment_otp_confirmation(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); - // } + // openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); }); } @@ -265,8 +272,8 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.clinicID = 0; applePayInsertRequest.currency = projectViewModel.authenticatedUserObject.user.outSA == 1 ? "AED" : "SAR"; // applePayInsertRequest.customerEmail = projectViewModel.authenticatedUserObject.user.emailAddress; - applePayInsertRequest.customerEmail = "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com"; - applePayInsertRequest.customerID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.customerEmail = "CustID_${widget.advanceModel.fileNumber}@HMG.com"; + applePayInsertRequest.customerID = widget.advanceModel.fileNumber; applePayInsertRequest.customerName = projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); @@ -274,7 +281,7 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.projectID = widget.advanceModel.hospitalsModel.iD.toString(); applePayInsertRequest.serviceID = ServiceTypeEnum.advancePayment.getIdFromServiceEnum().toString(); applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.patientID = widget.advanceModel.fileNumber; applePayInsertRequest.patientTypeID = projectViewModel.authenticatedUserObject.user.patientType; applePayInsertRequest.patientOutSA = projectViewModel.authenticatedUserObject.user.outSA; applePayInsertRequest.appointmentDate = null; @@ -287,7 +294,7 @@ class _ConfirmPaymentPageState extends State { applePayInsertRequest.isSchedule = "0"; applePayInsertRequest.language = projectViewModel.isArabic ? 'ar' : 'en'; applePayInsertRequest.languageID = projectViewModel.isArabic ? 1 : 2; - applePayInsertRequest.userName = projectViewModel.authenticatedUserObject.user.patientID; + applePayInsertRequest.userName = num.parse(widget.advanceModel.fileNumber); applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.paymentOption = "ApplePay"; @@ -306,7 +313,7 @@ class _ConfirmPaymentPageState extends State { await context.read().initiateApplePayWithPayfort( customerName: projectViewModel.authenticatedUserObject.user.firstName + " " + projectViewModel.authenticatedUserObject.user.lastName, // customerEmail: projectViewModel.authenticatedUserObject.user.emailAddress, - customerEmail: "CustID_${projectViewModel.authenticatedUserObject.user.patientID}@HMG.com", + customerEmail: "CustID_${widget.advanceModel.fileNumber}@HMG.com", orderDescription: "Advance Payment", orderAmount: double.parse(widget.advanceModel.amount), merchantReference: transID, @@ -318,7 +325,7 @@ class _ConfirmPaymentPageState extends State { }, onSuccess: (successResult) async { log("Payfort: ${successResult.responseMessage}"); - await context.read().addPayfortApplePayResponse(result: successResult); + await context.read().addPayfortApplePayResponse(num.parse(widget.advanceModel.fileNumber), result: successResult); checkPaymentStatus(AppoitmentAllHistoryResultList()); }, projectId: widget.advanceModel.hospitalsModel.iD, diff --git a/lib/services/payfort_services/payfort_service.dart b/lib/services/payfort_services/payfort_service.dart index 308d5818..655ce673 100644 --- a/lib/services/payfort_services/payfort_service.dart +++ b/lib/services/payfort_services/payfort_service.dart @@ -39,7 +39,7 @@ class PayfortService extends BaseService { return payfortProjectDetailsRespModel; } - Future addPayfortApplePayResponse({PayFortResult result}) async { + Future addPayfortApplePayResponse(num patientID, {PayFortResult result}) async { Map body = { "Fort_id": result.fortId, "CommandType": result.command, @@ -56,6 +56,7 @@ class PayfortService extends BaseService { "RemmeberMe": false, "Reconciliation_Reference": result.reconciliationReference, "LanguageID": 1, + "PatientID": patientID }; await baseAppClient.post( diff --git a/lib/services/payfort_services/payfort_view_model.dart b/lib/services/payfort_services/payfort_view_model.dart index 5bef18a8..553169ba 100644 --- a/lib/services/payfort_services/payfort_view_model.dart +++ b/lib/services/payfort_services/payfort_view_model.dart @@ -31,9 +31,9 @@ class PayfortViewModel extends ChangeNotifier { } } - Future addPayfortApplePayResponse({PayFortResult result}) async { + Future addPayfortApplePayResponse(num patientID, {PayFortResult result}) async { try { - await _payfortService.addPayfortApplePayResponse(result: result); + await _payfortService.addPayfortApplePayResponse(patientID, result: result); } on Exception catch (e, s) { print(s); return null; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 0ca93570..bbc1e55f 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -702,6 +702,8 @@ class _AppDrawerState extends State { // Navigator.of(context).pop(); Provider.of(context, listen: false).user = result.list; Provider.of(context, listen: false).setUser(result.list); + + Provider.of(context, listen: false).authenticatedUserObject.user = result.list; // await pharmacyModuleViewModel.generatePharmacyToken(); _vitalSignService.heightCm = ""; _vitalSignService.weightKg = "";