From b92e45aa93459cad96be1915286aa2f75580c9eb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 7 Aug 2023 09:52:49 +0300 Subject: [PATCH] Updates & fixes --- lib/config/config.dart | 14 +- lib/config/localized_values.dart | 1 + .../admission_status_for_sick_leave.dart | 64 +++++ lib/core/service/medical/labs_service.dart | 18 ++ lib/extensions/string_extensions.dart | 16 +- .../livecare/widgets/LiveCareHistoryCard.dart | 1 + .../medical/patient_sick_leave_page.dart | 64 ++++- .../sickleave_workplace_update_page.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 68 +++--- lib/uitl/LocalNotification.dart | 229 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 5 + lib/widgets/drawer/app_drawer_widget.dart | 66 ++++- pubspec.yaml | 47 ++-- 14 files changed, 400 insertions(+), 196 deletions(-) create mode 100644 lib/core/model/sick_leave/admission_status_for_sick_leave.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 0fad39b1..73b647bf 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.50.100.198:2018/'; +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/'; @@ -88,6 +88,7 @@ var COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_Pass var GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport'; var UPDATE_WORKPLACE_NAME = 'Services/Patients.svc/REST/ActivateSickLeave_FromVida'; +var GET_SICKLEAVE_STATUS_ADMISSION_NO = 'Services/ChatBot_Service.svc/REST/GetSickLeaveStatusByAdmissionNo'; /// var GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -324,7 +325,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 = 10.6; +var VERSION_ID = 10.7; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -597,7 +598,10 @@ var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCar var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs'; -var GET_NATIONALITY ='Services/Lists.svc/REST/GetNationality'; +var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality'; + +var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; +var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a69002f6..2336430b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1889,4 +1889,5 @@ const Map localizedValues = { "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, "viewReport": {"en": "View Report", "ar": "عرض التقرير"}, + "sickLeaveAdmittedPatient": {"en": "You cannot activate this sick leave since you're an admitted patient.", "ar": "لا يمكنك تفعيل هذه الإجازة المرضية لأنك مريض مقبل."}, }; \ No newline at end of file diff --git a/lib/core/model/sick_leave/admission_status_for_sick_leave.dart b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart new file mode 100644 index 00000000..e4ee923c --- /dev/null +++ b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart @@ -0,0 +1,64 @@ +class AdmissionStatusForSickLeave { + String setupID; + int projectID; + int patientID; + int patientType; + int requestNo; + String requestDate; + int sickLeaveDays; + int appointmentNo; + int admissionNo; + String reportDate; + String placeOfWork; + int status; + dynamic dischargeDate; + + AdmissionStatusForSickLeave( + {this.setupID, + this.projectID, + this.patientID, + this.patientType, + this.requestNo, + this.requestDate, + this.sickLeaveDays, + this.appointmentNo, + this.admissionNo, + this.reportDate, + this.placeOfWork, + this.status, + this.dischargeDate}); + + AdmissionStatusForSickLeave.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + requestNo = json['RequestNo']; + requestDate = json['RequestDate']; + sickLeaveDays = json['SickLeaveDays']; + appointmentNo = json['AppointmentNo']; + admissionNo = json['AdmissionNo']; + reportDate = json['ReportDate']; + placeOfWork = json['PlaceOfWork']; + status = json['Status']; + dischargeDate = json['DischargeDate']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['RequestNo'] = this.requestNo; + data['RequestDate'] = this.requestDate; + data['SickLeaveDays'] = this.sickLeaveDays; + data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; + data['ReportDate'] = this.reportDate; + data['PlaceOfWork'] = this.placeOfWork; + data['Status'] = this.status; + data['DischargeDate'] = this.dischargeDate; + return data; + } +} diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 078703df..714ebcb1 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -153,6 +153,24 @@ class LabsService extends BaseService { return Future.value(localRes); } + Future getSickLeaveStatusByAdmissionNo(int projectID, int admissionNo) async { + hasError = false; + Map body = Map(); + + body['AdmissionNo'] = admissionNo; + body['ProjectID'] = projectID; + + dynamic localRes; + + await baseAppClient.post(GET_SICKLEAVE_STATUS_ADMISSION_NO, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } + Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure}) async { hasError = false; Map body = Map(); diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 6ba96b08..df9cb4f6 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,7 +1,19 @@ -extension CapExtension on String { +import 'dart:convert'; +import 'package:crypto/crypto.dart'; +extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps: str).join(" ") : ""; + + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps : str).join(" ") : ""; +} + +extension HashSha on String { + String get toSha256 { + var bytes = utf8.encode(this); + return sha256.convert(bytes).toString(); + } } diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 9e08af05..cf89b766 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -243,6 +243,7 @@ class _LiveCareHistoryCardState extends State { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err.toString()); print(err); }); diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 3d977a96..a82ff6b3 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,9 +1,15 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/admission_status_for_sick_leave.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; +import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/sickleave_workplace_update_page.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'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -110,20 +116,56 @@ class _PatientSickLeavePageState extends State { ); } - void openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + Future openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) async { + if (model.sickLeaveList[index].admissionNo != 0 && model.sickLeaveList[index].admissionNo != null) { + getSickLeaveStatusByAdmissionNo(requestNumber, setupID, model, index, projectID); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } + + void getSickLeaveStatusByAdmissionNo(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + AdmissionStatusForSickLeave admissionStatusForSickLeave; + + LabsService service = new LabsService(); + GifLoaderDialogUtils.showMyDialog(context); + + service.getSickLeaveStatusByAdmissionNo(model.sickLeaveList[index].projectID, model.sickLeaveList[index].admissionNo).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { + admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); + if (admissionStatusForSickLeave.status != 6) { + AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openWorkPlaceUpdatePageFunc(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { Navigator.push( - context, - FadePage( - page: WorkplaceUpdatePage( + context, + FadePage( + page: WorkplaceUpdatePage( requestNumber: requestNumber, setupID: setupID, projectID: projectID, - ))).then((value) { - print(value); - if (value != null && value == true) { - model.getSickLeave(); - showEmailDialog(model, index); - } - }); + ), + ), + ).then( + (value) { + print(value); + if (value != null && value == true) { + model.getSickLeave(); + showEmailDialog(model, index); + } + }, + ); } } diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 517f251c..60d9ef54 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -145,7 +145,7 @@ class _WorkplaceUpdatePageState extends State { keyboardType: TextInputType.name, controller: _controller, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp("[a-zA-Zء-ي ]")), + projectViewModel.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index effa4445..51471790 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1757,41 +1757,45 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { + Map request; + request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; + dynamic localRes; + await baseAppClient.post(isTest ? PAYFORT_TEST_URL : PAYFORT_PROD_URL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isExternal: true, isAllowAny: true); + return Future.value(localRes); + } - Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { - Map requestFreeSlots; - Map request; - - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - requestFreeSlots = { - "DoctorID": docID, - "IsBookingForLiveCare": 0, - "ClinicID": clinicID, - "ProjectID": projectID, - "OriginalClinicID": clinicID, - "days": 0, - "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, - "SessionID": null, - "isDentalAllowedBackend": false, - "DeviceTypeID": 1 - }; - - request = { + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { + Map requestFreeSlots; + Map request; + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + requestFreeSlots = { + "DoctorID": docID, + "IsBookingForLiveCare": 0, "ClinicID": clinicID, "ProjectID": projectID, - "AppointmentNo":appoNumber, - "DoctorFreeSlotRequest":requestFreeSlots, - "DoctorFreeSlotResponse":selectedfreeSlots, - "Value1":docID - }; + "OriginalClinicID": clinicID, + "days": 0, + "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, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + request = {"ClinicID": clinicID, "ProjectID": projectID, "AppointmentNo": appoNumber, "DoctorFreeSlotRequest": requestFreeSlots, "DoctorFreeSlotResponse": selectedfreeSlots, "Value1": docID}; dynamic localRes; await baseAppClient.post(INSERT_FREE_SLOTS_LOGS, onSuccess: (response, statusCode) async { localRes = response; @@ -1801,6 +1805,4 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - - } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index af0db957..d7afaa90 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -35,39 +35,38 @@ class LocalNotification { var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); await flutterLocalNotificationsPlugin.initialize( initializationSettings, - onDidReceiveNotificationResponse: - (NotificationResponse notificationResponse) { + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { switch (notificationResponse.notificationResponseType) { case NotificationResponseType.selectedNotification: - // selectNotificationStream.add(notificationResponse.payload); + // selectNotificationStream.add(notificationResponse.payload); break; case NotificationResponseType.selectedNotificationAction: - // if (notificationResponse.actionId == navigationActionId) { - // selectNotificationStream.add(notificationResponse.payload); - // } + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } break; } }, onDidReceiveBackgroundNotificationResponse: notificationTapBackground, ); - } catch(ex) {} - // 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; - // },} - // - // , - // - // ); -} + } catch (ex) {} + // 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; + // },} + // + // , + // + // ); + } void notificationTapBackground(NotificationResponse notificationResponse) { // ignore: avoid_print @@ -76,110 +75,106 @@ class LocalNotification { ' payload: ${notificationResponse.payload}'); if (notificationResponse.input?.isNotEmpty ?? false) { // ignore: avoid_print - print( - 'notification action tapped with input: ${notificationResponse.input}'); + print('notification action tapped with input: ${notificationResponse.input}'); } } -var _random = new Random(); + var _random = new Random(); -_randomNumber({int from = 100000}) { - return _random.nextInt(from); -} + _randomNumber({int from = 100000}) { + return _random.nextInt(from); + } -_vibrationPattern() { - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; + _vibrationPattern() { + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; - return vibrationPattern; -} + return vibrationPattern; + } -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 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 scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - 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'); - - // /change it to be as ionic - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); -} + Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + 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'); + + // /change it to be as ionic + 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 platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showDailyAtTime( - // 0, - // 'show daily title', - // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // time, - // 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 platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); + } -///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 platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - // 0, - // 'show weekly title', - // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // Day.Monday, - // time, - // platformChannelSpecifics); -} + ///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 platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); + } -String _toTwoDigitString(int value) { - return value.toString().padLeft(2, '0'); -} + String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); + } -Future cancelNotification() async { - await flutterLocalNotificationsPlugin.cancel(0); -} + Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); + } -Future cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); -}} + Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 534b0540..5f2d0f3f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2897,6 +2897,7 @@ class TranslationBase { String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; String get viewReport => localizedValues["viewReport"][locale.languageCode]; + String get sickLeaveAdmittedPatient => localizedValues["sickLeaveAdmittedPatient"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 001baf50..ece5613d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -809,6 +809,11 @@ class Utils { static String generateMd5Hash(String input) { return crypto.md5.convert(utf8.encode(input)).toString(); } + + static String generateSignature() { + + } + } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 4ae60764..e71a4266 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -20,6 +21,7 @@ import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; 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'; @@ -28,6 +30,7 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.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'; @@ -38,6 +41,14 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; 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'; + +// import 'package:flutter_amazonpaymentservices/environment_type.dart'; +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.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:provider/provider.dart'; @@ -453,11 +464,22 @@ class _AppDrawerState extends State { ), mHeight(12), InkWell( - onTap: () { - // Navigator.push(context, FadePage(page: CallPage())); + onTap: () async { + // var deviceId = await FlutterAmazonpaymentservices.getUDID; + // var signatureValue = "asD123@saereaccess_code=BsM6He4FMBaZ86W64kjZdevice_id=$deviceId" + "language=enmerchant_identifier=ipxnRXXqservice_command=SDK_TOKENasD123@saere"; + // var signatureValueSHA = signatureValue.toSha256; + // // GifLoaderDialogUtils.showMyDialog(context); - // HMGNetworkConnectivity(context).start(); - // locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); + // DoctorsListService service = new DoctorsListService(); + // service.getPayfortSDKTokenForPayment(deviceId, signatureValueSHA, isTest: true).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // print(res); + // startPaymentProcess(res['sdk_token']); + // }).catchError((err) { + // print(err); + // AppToast.showErrorToast(message: err); + // GifLoaderDialogUtils.hideDialog(context); + // }); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -495,6 +517,34 @@ class _AppDrawerState extends State { )); } + startPaymentProcess(String sdkToken) async { + // Map requestParam = {}; + // requestParam = { + // "amount": "100", + // "command": "PURCHASE", + // "currency": "SAR", + // "order_description": "Advance Payment", + // "customer_email": projectProvider.user.emailAddress, + // "customer_name": projectProvider.user.firstName + " " + projectProvider.user.lastName, + // "phone_number": projectProvider.user.mobileNumber, + // "language": projectProvider.isArabic ? "ar" : "en", + // "merchant_reference": DateTime.now().millisecondsSinceEpoch.toString(), + // "sdk_token": sdkToken, + // }; + // try { + // await FlutterAmazonpaymentservices.normalPay(requestParam, EnvironmentType.sandbox, isShowResponsePage: false).then((value) { + // if (value["status"] == 14) { + // AppToast.showSuccessToast(message: "Payment has been successful"); + // } else { + // AppToast.showErrorToast(message: value['response_message']); + // } + // }); + // } on PlatformException catch (e) { + // AppToast.showErrorToast(message: e.message); + // return; + // } + } + readQRCode() async { pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent; print(pharmacyLiveCareQRCode); @@ -512,7 +562,13 @@ class _AppDrawerState extends State { startPharmacyLiveCareProcess() { sharedPref.setString(LIVECARE_CLINIC_DATA, "Pharmacy LiveCare" + "-" + "501" + "-" + "7"); - Navigator.push(context, FadePage(page: LiveCareHome(isPharmacyLiveCare: true, pharmacyLiveCareQRCode: pharmacyLiveCareQRCode,))); + Navigator.push( + context, + FadePage( + page: LiveCareHome( + isPharmacyLiveCare: true, + pharmacyLiveCareQRCode: pharmacyLiveCareQRCode, + ))); } drawerNavigator(context, routeName) { diff --git a/pubspec.yaml b/pubspec.yaml index c19788d3..c4265c47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.022+4050022 +version: 4.5.024+4050024 environment: sdk: ">=2.7.0 <3.0.0" @@ -15,7 +15,7 @@ dependencies: sdk: flutter intl: ^0.17.0 # web view -# webview_flutter: ^2.3.1 + # webview_flutter: ^2.3.1 # http client http: ^0.13.4 @@ -23,7 +23,7 @@ dependencies: async: ^2.8.1 audio_wave: ^0.1.4 -# audio_session: ^0.1.13 + # audio_session: ^0.1.13 # State Management provider: ^6.0.1 @@ -54,7 +54,7 @@ dependencies: maps_launcher: ^2.0.1 url_launcher: ^6.0.15 shared_preferences: ^2.0.0 -# flutter_flexible_toast: ^0.1.4 + # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 firebase_messaging: ^14.1.0 firebase_analytics: ^10.0.5 @@ -95,10 +95,10 @@ dependencies: # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 -# flutter_polyline_points: ^1.0.0 + # flutter_polyline_points: ^1.0.0 location: ^4.3.0 # Qr code Scanner -# barcode_scan_fix: ^1.0.2 + # barcode_scan_fix: ^1.0.2 barcode_scan2: ^4.2.2 # Rating Stars @@ -108,7 +108,7 @@ dependencies: syncfusion_flutter_calendar: ^19.3.55 # SVG Images -# flutter_svg: ^0.23.0+1 + # flutter_svg: ^0.23.0+1 #Calendar Events manage_calendar_events: ^2.0.1 @@ -152,7 +152,7 @@ dependencies: #google maps places google_maps_place_picker_mb: ^3.0.0 -# google_maps_place_picker: ^2.1.0-nullsafety.3 + # google_maps_place_picker: ^2.1.0-nullsafety.3 map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 @@ -161,10 +161,10 @@ dependencies: native_device_orientation: ^1.0.0 wakelock: ^0.5.6 after_layout: ^1.1.0 -# twilio_programmable_video: ^0.11.0+1 + # twilio_programmable_video: ^0.11.0+1 cached_network_image: ^3.1.0+1 -# flutter_tts: -# path: flutter_tts-voice_enhancement + # flutter_tts: + # path: flutter_tts-voice_enhancement flutter_tts: ^3.6.1 wifi: ^0.1.5 @@ -175,7 +175,7 @@ dependencies: geofencing: ^0.1.0 speech_to_text: ^6.1.1 -# path: speech_to_text + # path: speech_to_text in_app_update: ^3.0.0 @@ -183,7 +183,7 @@ dependencies: badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 -# syncfusion_flutter_sliders: ^19.3.55 + # syncfusion_flutter_sliders: ^19.3.55 searchable_dropdown: ^1.1.3 dropdown_search: 0.4.9 youtube_player_flutter: ^8.0.0 @@ -191,28 +191,31 @@ dependencies: # Dep by Zohaib shimmer: ^2.0.0 carousel_slider: ^4.0.0 -# flutter_material_pickers: ^3.1.2 + # flutter_material_pickers: ^3.1.2 flutter_staggered_grid_view: ^0.4.1 -# flutter_hms_gms_availability: ^2.0.0 + # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 huawei_location: 6.0.0+302 # Marker Animation -# flutter_animarker: ^3.2.0 + # flutter_animarker: ^3.2.0 auto_size_text: ^3.0.0 equatable: ^2.0.3 -# signalr_core: ^1.1.1 + # signalr_core: ^1.1.1 wave: ^0.2.0 -# sms_retriever: ^1.0.0 + # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 -# flutter_callkit_incoming: ^1.0.3+3 -# firebase_core: 1.12.0 + # flutter_callkit_incoming: ^1.0.3+3 + # firebase_core: 1.12.0 + +# flutter_amazonpaymentservices: 0.0.6 +# crypto: dependency_overrides: - provider : ^5.0.0 -# permission_handler : ^10.2.0 + provider: ^5.0.0 + # permission_handler : ^10.2.0 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3