diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 4a6fbc03..67361ef5 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -6,6 +6,8 @@ -keep class com.ejada.** { *; } -keep class org.webrtc.** { *; } +-keep class com.builttoroam.devicecalendar.** { *; } + -ignorewarnings -keepattributes *Annotation* -keepattributes Exceptions diff --git a/assets/images/new/body_parts/male/back.png b/assets/images/new/body_parts/male/back.png new file mode 100644 index 00000000..224147ec Binary files /dev/null and b/assets/images/new/body_parts/male/back.png differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2d3d257b..21716fd1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -111,6 +111,8 @@ PODS: - GoogleUtilities/UserDefaults (~> 7.6) - nanopb (~> 2.30908.0) - Flutter (1.0.0) + - flutter_app_icon_badge (0.0.1): + - Flutter - flutter_hms_gms_availability (0.0.1): - Flutter - flutter_inappwebview (0.0.1): @@ -120,6 +122,8 @@ PODS: - flutter_inappwebview/Core (0.0.1): - Flutter - OrderedSet (~> 5.0) + - flutter_ios_voip_kit (0.0.1): + - Flutter - flutter_local_notifications (0.0.1): - Flutter - flutter_native_timezone (0.0.1): @@ -279,8 +283,10 @@ DEPENDENCIES: - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) + - flutter_app_icon_badge (from `.symlinks/plugins/flutter_app_icon_badge/ios`) - flutter_hms_gms_availability (from `.symlinks/plugins/flutter_hms_gms_availability/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) + - flutter_ios_voip_kit (from `.symlinks/plugins/flutter_ios_voip_kit/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - flutter_native_timezone (from `.symlinks/plugins/flutter_native_timezone/ios`) - flutter_nfc_kit (from `.symlinks/plugins/flutter_nfc_kit/ios`) @@ -370,10 +376,14 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter + flutter_app_icon_badge: + :path: ".symlinks/plugins/flutter_app_icon_badge/ios" flutter_hms_gms_availability: :path: ".symlinks/plugins/flutter_hms_gms_availability/ios" flutter_inappwebview: :path: ".symlinks/plugins/flutter_inappwebview/ios" + flutter_ios_voip_kit: + :path: ".symlinks/plugins/flutter_ios_voip_kit/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" flutter_native_timezone: @@ -463,8 +473,10 @@ SPEC CHECKSUMS: FirebaseInstallations: 830327b45345ffc859eaa9c17bcd5ae893fd5425 FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316 Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + flutter_app_icon_badge: 844847adbd7a1c6f325d6b41b942428981b839cc flutter_hms_gms_availability: babc50b18670e99780270bc18d9b17d0a07cd77e flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 + flutter_ios_voip_kit: a3b4c5bd0cfda5069b5605a6d1dc60ecf99c6299 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_native_timezone: 5f05b2de06c9776b4cc70e1839f03de178394d22 flutter_nfc_kit: 965c98c3fa68f5609f1cc89abb968fe1b8ffdbaa diff --git a/lib/analytics/flows/advance_payments.dart b/lib/analytics/flows/advance_payments.dart index db52eb59..22a7bce5 100644 --- a/lib/analytics/flows/advance_payments.dart +++ b/lib/analytics/flows/advance_payments.dart @@ -67,10 +67,8 @@ class AdvancePayments{ } // R046 - payment_success({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){ + payment_success({@required String hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){ logger('payment_success', parameters: { - 'appointment_type' : appointment_type, - 'clinic_type_online' : clinic, 'payment_method' : payment_method, 'payment_type' : payment_type, 'hospital_name' : hospital, @@ -79,4 +77,16 @@ class AdvancePayments{ 'transaction_currency' : txn_currency }); } + + payment_fail({@required String hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}){ + logger('payment_fail', parameters: { + 'payment_method' : payment_method, + 'payment_type' : payment_type, + 'hospital_name' : hospital, + 'transaction_amount' : txn_amount, + 'transaction_currency' : txn_currency, + 'error_type' : error_type + }); + } + } \ No newline at end of file diff --git a/lib/analytics/flows/appointments.dart b/lib/analytics/flows/appointments.dart index 6de4f48f..65fd415d 100644 --- a/lib/analytics/flows/appointments.dart +++ b/lib/analytics/flows/appointments.dart @@ -41,8 +41,8 @@ class Appointment{ // R018.1 book_appointment_select_clinic({@required String appointment_type, clinic}){ - // appointment_type: regular | livecare - // clinic_type : $clinic_type + // appointment_type: regular | livecare + // clinic_type : $clinic_type logger('book_appointment_select_clinic', parameters: { 'appointment_type' : appointment_type, 'clinic_type' : clinic @@ -101,15 +101,15 @@ class Appointment{ // R023 book_appointment_date_selection({@required String appointment_type, @required day, @required DoctorList doctor}){ logger('book_appointment_date_selection', parameters: { - 'appointment_type' : appointment_type, - 'clinic_type' : doctor.clinicName, - 'hospital_name' : doctor.projectName, - 'treatment_type' : GAnalytics.TREATMENT_TYPE ?? '', - 'doctor_name' : doctor.name, - 'doctor_nationality' : doctor.nationalityName, - 'doctor_gender' : doctor.genderDescription, - 'appointment_day' : day - }); + 'appointment_type' : appointment_type, + 'clinic_type' : doctor.clinicName, + 'hospital_name' : doctor.projectName, + 'treatment_type' : GAnalytics.TREATMENT_TYPE ?? '', + 'doctor_name' : doctor.name, + 'doctor_nationality' : doctor.nationalityName, + 'doctor_gender' : doctor.genderDescription, + 'appointment_day' : day + }); } // R024.1 @@ -244,6 +244,19 @@ class Appointment{ }); } + payment_fail({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_amount, txn_currency, error_type}){ + logger('payment_fail', parameters: { + 'appointment_type' : appointment_type, + 'payment_method' : payment_method, + 'payment_type' : payment_type, + 'hospital_name' : hospital, + 'clinic_type_online' : clinic, + 'transaction_amount' : txn_amount, + 'transaction_currency' : txn_currency, + 'error_type' : error_type + }); + } + // Note : - Payment flow beyond this step are same as listed under ‘Advance Payment’ section of this document appointment_detail_action({@required AppoitmentAllHistoryResultList appointment, @required String action}){ @@ -261,14 +274,13 @@ class Appointment{ // R053 // Note : - Payment flow beyond this step are same as listed under ‘Advance Payment’ section of this document - appointment_details_cancel({@required AppoitmentAllHistoryResultList appointment}){ + appointment_details_cancel({@required AppoitmentAllHistoryResultList appointment, appointment_type}){ logger('cancel_appointment', parameters: { 'flow_type' : GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE, - 'appointment_type' : appointment.appointmentType, + 'appointment_type' : appointment_type, 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, - 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, - 'payment_type' : 'appointment', + 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName }); } diff --git a/lib/analytics/flows/live_care.dart b/lib/analytics/flows/live_care.dart index 6d2f0c81..d85d82d8 100644 --- a/lib/analytics/flows/live_care.dart +++ b/lib/analytics/flows/live_care.dart @@ -89,13 +89,15 @@ class LiveCare{ } // R037 - livecare_immediate_consultation_payment_failed({@required String appointment_type, clinic, hospital, payment_method, payment_type, error_code, error_message}){ - // appointment_type - // clinic_type_online - // payment_method - // payment_type - // hospital_name - // error_code - // error_message + livecare_immediate_consultation_payment_failed({@required String appointment_type, clinic, payment_method, payment_type, txn_amount, txn_currency, error_message}){ + logger('livecare_immediate_consult_payment_fail', parameters: { + 'payment_method' : payment_method, + 'appointment_type' : appointment_type, + 'payment_type' : payment_type, + 'clinic_type_online' : clinic, + 'transaction_amount' : txn_amount, + 'transaction_currency' : txn_currency, + 'error_type' : error_message + }); } } \ No newline at end of file diff --git a/lib/analytics/flows/login_registration.dart b/lib/analytics/flows/login_registration.dart index 3a2894a4..200fe1bb 100644 --- a/lib/analytics/flows/login_registration.dart +++ b/lib/analytics/flows/login_registration.dart @@ -3,6 +3,8 @@ import 'package:flutter/cupertino.dart'; import '../google-analytics.dart'; class LoginRegistration{ + static int loginMethod; + static int verificationMethod; final GALogger logger; LoginRegistration(this.logger); @@ -51,10 +53,15 @@ class LoginRegistration{ } // R010:registration_confirmation - registration_confirmation({@required String by}){ + registration_confirmation(){ // verification_method: by - logger('registration_confirmation', parameters: { - 'verification_method' : by + logger('registration_confirmation'); + } + + registration_fail({@required String errorType}){ + // verification_method: by + logger('registration_fail', parameters: { + 'error_type' : errorType }); } @@ -66,20 +73,29 @@ class LoginRegistration{ } // R011:login_verify_otp | R009:registration_verification_option - verify_otp_method({@required int method, bool forRegistration = false}){ - var verification_method = ''; - if(method == 1) verification_method = 'sms'; - if(method == 2) verification_method = 'fingerprint'; - if(method == 3) verification_method = 'face id'; - if(method == 4) verification_method = 'whatsapp'; - + verify_otp_method({bool forRegistration = false}){ if(forRegistration == false) logger("login_verify_otp", parameters: { - 'login_method' : verification_method + 'login_method' : _getLoginMethod(), + 'verification_method' : _getVerificationMethod(), }); else logger("registration_verification_option", parameters: { - 'verification_method' : verification_method + 'verification_method' : _getVerificationMethod() + }); + } + + // R011:login_verify_otp | R009:registration_verification_option + login_verfication({bool forRegistration = false}){ + if(forRegistration == false) + logger("login_verfication", parameters: { + 'login_method' : _getLoginMethod(), + 'verification_method' : _getVerificationMethod(), + }); + else + logger("login_varification_register", parameters: { + 'login_method' : _getLoginMethod(), + 'verification_method' : _getVerificationMethod(), }); } @@ -94,14 +110,9 @@ class LoginRegistration{ } // R012.1, R014.1 - login_successful({@required int method}){ - var verification_method = ''; - if(method == 1) verification_method = 'sms'; - if(method == 2) verification_method = 'fingerprint'; - if(method == 3) verification_method = 'face id'; - if(method == 4) verification_method = 'whatsapp'; + login_successful(){ logger('login_successful', parameters: { - 'login_method' : verification_method + 'login_method' : _getVerificationMethod() }); } @@ -112,6 +123,13 @@ class LoginRegistration{ }); } + login_fail({error}){ + logger('login_unsuccessful', parameters: { + 'login_method' : loginMethod, + 'error': error + }); + } + // R013 recover_file_number(){ logger('recover_file_number'); @@ -121,4 +139,19 @@ class LoginRegistration{ login_with_other_account(){ logger('login_with_other_account'); } + + + _getLoginMethod(){ + if(loginMethod == 1) return 'national id'; + if(loginMethod == 2) return 'file number'; + return 'otp'; + } + + String _getVerificationMethod(){ + if(verificationMethod == 1) return 'sms'; + if(verificationMethod == 2) return 'fingerprint'; + if(verificationMethod == 3) return 'face id'; + if(verificationMethod == 4) return 'whatsapp'; + return "unknown"; + } } \ No newline at end of file diff --git a/lib/analytics/google-analytics.dart b/lib/analytics/google-analytics.dart index 081bd29e..a8252051 100644 --- a/lib/analytics/google-analytics.dart +++ b/lib/analytics/google-analytics.dart @@ -27,7 +27,7 @@ typedef GALogger = Function(String name, {Map parameters}); var _analytics = FirebaseAnalytics(); _logger(String name, {Map parameters}) async { - return; + // return; if (name != null && name.isNotEmpty) { if (name.contains(' ')) name = name.replaceAll(' ', '_'); diff --git a/lib/config/config.dart b/lib/config/config.dart index 4efd0690..60336685 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -318,6 +318,12 @@ var CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; var HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; +var ER_CREATE_ADVANCE_PAYMENT = + "services/Doctors.svc/REST/ER_CreateAdvancePaymentForClinic"; + +var ER_INSERT_ADVANCE_PAYMENT = + "services/Doctors.svc/REST/ER_InsertEROnlinePaymentDetails"; + var ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; @@ -721,6 +727,9 @@ var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamara/Home/GetInstallments'; +var GET_ONESIGNAL_VOIP_TOKEN = + 'https://onesignal.com/api/v1/players'; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b0c7213f..6bd1019b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -88,7 +88,7 @@ const Map localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'تعليمات'}, 'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'}, 'livecareAppo': {'en': 'LiveCare Appointment', 'ar': 'الموعد لايف كير'}, - 'agreeTo': {'en': 'I agree the', 'ar': 'أوافق على'}, + 'agreeTo': {'en': 'I agree to the', 'ar': 'أوافق على'}, 'termsConditoins': {'en': 'Terms and Conditions', 'ar': 'الأحكام والشروط'}, 'cancelAppoMsg': {'en': 'Are you sure you want to cancel this appointment?', 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟'}, 'changePayment': {'en': 'Change Payment Method', 'ar': 'تغيير آلية الدفع'}, @@ -1385,9 +1385,9 @@ const Map localizedValues = { "ancillary-orders": {"en": "Ancillary Orders", "ar": "الطلبات الاضافية"}, "onlineCheckInAgreement": { "en": - "The online check-in is for non-life threatening situationCall the red crescent (number) or go to the nearest emergency department if there are: signs of stroke or heart attack history of seizure or syncope there is limb or life threatening injury picture of severe injuries​", + "The online check-in is for non-life threatening situation. Call the red crescent (number) or go to the nearest emergency department if there are: \n\nsigns of stroke or heart attack \nhistory of seizure or syncope \nthere is limb or life threatening injury \npicture of severe injuries", "ar": - "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة" + "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة" }, "MRN": {"en": "MRN", "ar": "رقم الملف الطبي"}, "appointment-date": {"en": "Appointment Date", "ar": "تاريخ الموعد"}, @@ -1803,17 +1803,51 @@ const Map localizedValues = { "تتيح لك ميزة اختبار كوفيد19 حجز موعد في احد فروع مجموعة الحبيب الطبية ، حيث سيتم اخذ عينة المسحة ومعالجتها. بمجرد معالجة النتيجة ، سنخطرك عبر رسالة نصية قصيرة على رقم هاتفك المحمول المسجل وستكون نتيجة الاختبار متاحة أيضًا على التطبيق في قسم نتائج المختبر. يرجى ملاحظة أن هذه النتيجة متاحة لك فقط وليست متاحة للجمهور او اي شخص آخر. الرجاء الموافقة للتأكيد والمتابعة." }, "covidConsentHeader": {"en": "User Consent", "ar": "موافقة المستخدم"}, - "drawOverAppsPermission": {"en": "Please allow the Al-Habib Medical Group application to appear on the top of the screen when receiving the call from the doctor for LiveCare service.", "ar": "الرجاء السماح لتطبيق مجموعة الحبيب الطبية للظهورعلى سطح الشاشة عند استلام الاتصال من الطبيب لخدمة اللايف كير"}, - "cameraPermissionDialog": { "en": "Dr. Al Habib app needs to access Camera to enable virtual consultation between patient & doctor, attach images and scan QR for parking service.", "ar": "يحتاج تطبيق دكتور الحبيب الى صلاحية الوصول إلى الكاميرا لخدمة الاستشارة الافتراضية بين المريض والطبيب وإرفاق الصور ومسح رمز الاستجابة السريع لخدمة مواقف السيارات." }, - "galleryPermission": { "en": "Dr. Al Habib app needs to access Read & write external storage to upload images & documents in the E-Referral module and renew and update the insurance cards.", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول إلى معرض الصور وذلك لتحميل الصور والمستندات لخدمة الإحالة الإلكترونية وكذلك لخدمة تجديد بطاقات التأمين وتحديثها." }, - "locationPermissionDialog": { "en": "Dr. Al Habib app collects location data to show the nearest HMG hospitals and ER Locations and provides health care services to your location and Health weather indicators service and the medication delivery.", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الموقع لإظهار أقرب مستشفيات المجموعة، مواقع الطوارئ، تقديم خدمات الرعاية الصحية إلى موقعك، خدمة مؤشرات الطقس الصحية وكذلك خدمة توصيل الأدوية." }, - "calendarPermission": { "en": "Dr. Al Habib app collects calendar data to modify and set reminders for Appointments", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى التقويم وذلك لاضافة تذكيرات بالمواعيد في التقويم." }, - "recordAudioPermission": { "en": "Dr. Al Habib app needs audio permission to enable voice command features.", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الصوت لتفعيل خدمة الأوامر الصوتية." }, - "wifiPermission": { "en": "Dr. Al Habib app needs to access WiFi state permission to connect to the HMG WiFi network from within the app when you visit the hospital.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى الواي فاي للاتصال بشبكة الواي فاي في المجموعة عند زيارة المستشفى." }, - "physicalActivityPermission": { "en": "Dr. Al Habib app collects physical activity data to read heart rate, steps & distance from your smartwatch & send it to your doctor.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى بيانات النشاط البدني لقراءة معدل ضربات القلب والخطوات والمسافة من ساعتك الذكية وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." }, - "bluetoothPermission": { "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." }, + "drawOverAppsPermission": { + "en": "Please allow the Al-Habib Medical Group application to appear on the top of the screen when receiving the call from the doctor for LiveCare service.", + "ar": "الرجاء السماح لتطبيق مجموعة الحبيب الطبية للظهورعلى سطح الشاشة عند استلام الاتصال من الطبيب لخدمة اللايف كير" + }, + "cameraPermissionDialog": { + "en": "Dr. Al Habib app needs to access Camera to enable virtual consultation between patient & doctor, attach images and scan QR for parking service.", + "ar": "يحتاج تطبيق دكتور الحبيب الى صلاحية الوصول إلى الكاميرا لخدمة الاستشارة الافتراضية بين المريض والطبيب وإرفاق الصور ومسح رمز الاستجابة السريع لخدمة مواقف السيارات." + }, + "galleryPermission": { + "en": "Dr. Al Habib app needs to access Read & write external storage to upload images & documents in the E-Referral module and renew and update the insurance cards.", + "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول إلى معرض الصور وذلك لتحميل الصور والمستندات لخدمة الإحالة الإلكترونية وكذلك لخدمة تجديد بطاقات التأمين وتحديثها." + }, + "locationPermissionDialog": { + "en": + "Dr. Al Habib app collects location data to show the nearest HMG hospitals and ER Locations and provides health care services to your location and Health weather indicators service and the medication delivery.", + "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الموقع لإظهار أقرب مستشفيات المجموعة، مواقع الطوارئ، تقديم خدمات الرعاية الصحية إلى موقعك، خدمة مؤشرات الطقس الصحية وكذلك خدمة توصيل الأدوية." + }, + "calendarPermission": { + "en": "Dr. Al Habib app collects calendar data to modify and set reminders for Appointments", + "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى التقويم وذلك لاضافة تذكيرات بالمواعيد في التقويم." + }, + "recordAudioPermission": { + "en": "Dr. Al Habib app needs audio permission to enable voice command features.", + "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الصوت لتفعيل خدمة الأوامر الصوتية." + }, + "wifiPermission": { + "en": "Dr. Al Habib app needs to access WiFi state permission to connect to the HMG WiFi network from within the app when you visit the hospital.", + "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى الواي فاي للاتصال بشبكة الواي فاي في المجموعة عند زيارة المستشفى." + }, + "physicalActivityPermission": { + "en": "Dr. Al Habib app collects physical activity data to read heart rate, steps & distance from your smartwatch & send it to your doctor.", + "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى بيانات النشاط البدني لقراءة معدل ضربات القلب والخطوات والمسافة من ساعتك الذكية وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." + }, + "bluetoothPermission": { + "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", + "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." + }, "privacyPolicy": {"en": "Privacy Policy", "ar": "سياسة الخصوصية"}, "termsConditions": {"en": "Terms & Conditions", "ar": "الأحكام والشروط"}, "prescriptionDeliveryError": {"en": "This clinic does not support refill & delivery.", "ar": "هذه العيادة لا تدعم إعادة التعبئة والتسليم."}, - "liveCarePermissions": {"en": "LiveCare required Camera & Microphone permissions, Please allow these to proceed.", "ar": "هذه العيادة لا تدعم خدمة إعادة التعبئة والتسليم."}, + "liveCarePermissions": {"en": "LiveCare requires Camera & Microphone permissions, Please allow these to proceed.", "ar": "يتطلب لايف كير أذونات الكاميرا والميكروفون ، يرجى السماح لها بالمتابعة."}, + "lakumUnhold": { "en": "The account has already been activated", "ar": "لقد تم تفعيل الحساب من قبل" }, + "lakumDiscontinue": { "en": "The account is closed", "ar": "الحساب مغلق" }, + "lakumSuccess": { "en": "The account has been activated successfully", "ar": "تم تفعيل الحساب بنجاح" }, + "deleteAccount": { "en": "Deactivate my account", "ar": "الحساب احذف" }, + "deactivateAccount": { "en": "Are you sure you want to deactivate your account?", "ar": "هل أنت متأكد أنك تريد إلغاء تنشيط حسابك؟" }, + "accountDeactivated": { "en": "Your account has been deactivated successfully", "ar": "تم إلغاء تنشيط حسابك بنجاح" }, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index d5fb7e3b..9e5c4f27 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -3,10 +3,12 @@ const APP_LANGUAGE = 'language'; const USER_PROFILE = 'user-profile'; const PUSH_TOKEN = 'push-token'; const APNS_TOKEN = 'apns-token'; +const ONESIGNAL_APNS_TOKEN = 'onesignal-apns-token'; const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register'; const LOGIN_TOKEN_ID = 'register-data-for-register'; const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; const LAST_LOGIN = 'last-login'; +const ER_CHECKIN_RISK_SCORE = 'er-checkin-risk-score'; const ONLY_SMS = 'only-sms'; const AUTH_DATA = 'auth-data'; const IMEI_USER_DATA = 'imei-user-data'; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart index 7c621f35..9de08856 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart @@ -16,6 +16,7 @@ class CMCInsertPresOrderRequestModel { double longitude; int createdBy; int orderServiceID; + int projectID; List patientERCMCInsertServicesList; CMCInsertPresOrderRequestModel( @@ -36,6 +37,7 @@ class CMCInsertPresOrderRequestModel { this.longitude, this.createdBy, this.orderServiceID, + this.projectID, this.patientERCMCInsertServicesList}); CMCInsertPresOrderRequestModel.fromJson(Map json) { @@ -56,6 +58,7 @@ class CMCInsertPresOrderRequestModel { longitude = json['Longitude']; createdBy = json['CreatedBy']; orderServiceID = json['OrderServiceID']; + projectID = json['ProjectId']; if (json['PatientER_CMC_InsertServicesList'] != null) { patientERCMCInsertServicesList = new List(); @@ -84,6 +87,7 @@ class CMCInsertPresOrderRequestModel { data['longitude'] = this.longitude; // data['CreatedBy'] = this.createdBy; data['OrderServiceID'] = this.orderServiceID; + data['ProjectID'] = this.projectID; if (this.patientERCMCInsertServicesList != null) { data['procedures'] = this.patientERCMCInsertServicesList.map((v) => v.toJson()).toList(); diff --git a/lib/core/model/er/ErPatientShareModel.dart b/lib/core/model/er/ErPatientShareModel.dart index 4c6a4165..09e54de9 100644 --- a/lib/core/model/er/ErPatientShareModel.dart +++ b/lib/core/model/er/ErPatientShareModel.dart @@ -10,9 +10,9 @@ class ErPatientShareModel { dynamic insurancePolicyNo; String message; dynamic patientCardID; - double patientShare; - double patientShareWithTax; - double patientTaxAmount; + num patientShare; + num patientShareWithTax; + num patientTaxAmount; int policyId; String policyName; String procedureName; diff --git a/lib/core/model/prescriptions/prescription_report.dart b/lib/core/model/prescriptions/prescription_report.dart index c521bede..adad640e 100644 --- a/lib/core/model/prescriptions/prescription_report.dart +++ b/lib/core/model/prescriptions/prescription_report.dart @@ -7,7 +7,7 @@ class PrescriptionReport { String companyName; int days; String doctorName; - var doseDailyQuantity; + num doseDailyQuantity; String frequency; int frequencyNumber; String image; @@ -23,7 +23,7 @@ class PrescriptionReport { String patientName; String phoneOffice1; String prescriptionQR; - int prescriptionTimes; + num prescriptionTimes; String productImage; String productImageBase64; String productImageString; diff --git a/lib/core/model/prescriptions/prescription_report_enh.dart b/lib/core/model/prescriptions/prescription_report_enh.dart index 01a34c47..a07a30c4 100644 --- a/lib/core/model/prescriptions/prescription_report_enh.dart +++ b/lib/core/model/prescriptions/prescription_report_enh.dart @@ -5,7 +5,7 @@ class PrescriptionReportEnh { Null companyName; int days; String doctorName; - int doseDailyQuantity; + num doseDailyQuantity; String frequency; int frequencyNumber; Null image; @@ -22,7 +22,7 @@ class PrescriptionReportEnh { String patientName; String phoneOffice1; Null prescriptionQR; - int prescriptionTimes; + num prescriptionTimes; Null productImage; Null productImageBase64; String productImageString; 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 6d68653d..a461156e 100644 --- a/lib/core/model/radiology/request_send_rad_report_email.dart +++ b/lib/core/model/radiology/request_send_rad_report_email.dart @@ -25,6 +25,7 @@ class RequestSendRadReportEmail { String to; String tokenID; double versionID; + int invoiceLineItemNo; RequestSendRadReportEmail( {this.channel, @@ -81,6 +82,7 @@ class RequestSendRadReportEmail { to = json['To']; tokenID = json['TokenID']; versionID = json['VersionID']; + invoiceLineItemNo = json['InvoiceLineItemNo']; } Map toJson() { @@ -111,6 +113,7 @@ class RequestSendRadReportEmail { data['To'] = this.to; data['TokenID'] = this.tokenID; data['VersionID'] = this.versionID; + data['InvoiceLineItemNo'] = this.invoiceLineItemNo; return data; } } diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index c6c2d82f..e1bb4154 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -133,6 +133,8 @@ class CMCService extends BaseService { Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { hasError = false; String reqId = ""; + order.latitude = 0.0; + order.longitude = 0.0; await baseAppClient.post(ADD_CMC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; reqId = response['response'].toString(); diff --git a/lib/core/service/ancillary_orders_service.dart b/lib/core/service/ancillary_orders_service.dart index c068ad3e..36cac50e 100644 --- a/lib/core/service/ancillary_orders_service.dart +++ b/lib/core/service/ancillary_orders_service.dart @@ -10,6 +10,11 @@ class AncillaryOrdersService extends BaseService { List get ancillaryProcLists => _ancillaryProcLists; + String _insuranceCompanyName = ""; + String get insuranceCompanyName => _insuranceCompanyName; + String _insurancePolicyNumber = ""; + String get insurancePolicyNumber => _insurancePolicyNumber; + Future getOrders() async { Map body = Map(); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 50370b52..f874cf17 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -130,9 +129,9 @@ class BaseAppClient { } } - // body['IdentificationNo'] = 2076117163; - // body['MobileNo'] = "966503109207"; - // body['PatientID'] = 50121262; //3844083 + // body['IdentificationNo'] = 1098574195; + // body['MobileNo'] = "966565001080"; + // body['PatientID'] = 3235660; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 @@ -142,9 +141,9 @@ class BaseAppClient { body.removeWhere((key, value) => key == null || value == null); if (BASE_URL == "https://uat.hmgwebservices.com/") { - print("URL : $url"); + debugPrint("URL : $url"); final jsonBody = json.encode(body); - print(jsonBody); + debugPrint(jsonBody); } if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { @@ -410,7 +409,11 @@ class BaseAppClient { } Future navigateToAppUpdate(context, String text) async { - Navigator.pushReplacement(context, FadePage(page: AppUpdatePage(appUpdateText: text))); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => AppUpdatePage(appUpdateText: text)), + (Route route) => false, + ); } get(String endPoint, diff --git a/lib/core/service/er/EdOnlineServices.dart b/lib/core/service/er/EdOnlineServices.dart index 2df92d8a..12585e4c 100644 --- a/lib/core/service/er/EdOnlineServices.dart +++ b/lib/core/service/er/EdOnlineServices.dart @@ -1,19 +1,21 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/er/ErPatientShareModel.dart'; import 'package:diplomaticquarterapp/core/model/er/TriageQuestionsModel.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/cupertino.dart'; class EdOnlineServices extends BaseService { List triageQuestionsModelList = List(); ErPatientShareModel erPatientShareModel; Future getQuestions() async { - hasError =false; + hasError = false; triageQuestionsModelList.clear(); Map body = Map(); body['ProjectID'] = 15; - await baseAppClient.post(ER_GET_VISUAL_TRIAGE_QUESTIONS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(ER_GET_VISUAL_TRIAGE_QUESTIONS, onSuccess: (dynamic response, int statusCode) { triageQuestionsModelList.clear(); response['ER_TriageQuestionsList'].forEach((questions) { triageQuestionsModelList.add(TriageQuestionsModel.fromJson(questions)); @@ -24,26 +26,19 @@ class EdOnlineServices extends BaseService { }, body: body); } - Future getPatientPaymentInformation({var id}) async { - hasError =false; - await baseAppClient.post(ER_GetPatientPaymentInformationForERClinic, - onSuccess: (dynamic response, int statusCode) { - erPatientShareModel = - ErPatientShareModel.fromJson(response['ER_PatientShare']); + hasError = false; + await baseAppClient.post(ER_GetPatientPaymentInformationForERClinic, onSuccess: (dynamic response, int statusCode) { + erPatientShareModel = ErPatientShareModel.fromJson(response['ER_PatientShare']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map.from({"ProjectID":15,"ClinicID":10})); + }, body: Map.from({"ProjectID": 15, "ClinicID": 10})); } - Future saveQuestionsInformation( - {String notes, - String chiefComplaint, - int projectId, - DateTime selectedTime, - List selectedQuestions}) async { - hasError =false; + Future saveQuestionsInformation({String notes, String chiefComplaint, int projectId, DateTime selectedTime, List selectedQuestions}) async { + AppSharedPreferences sharedPref = AppSharedPreferences(); + hasError = false; Map body = Map(); List checklist = List(); @@ -53,27 +48,15 @@ class EdOnlineServices extends BaseService { if (user.age > 14) { selectedQuestions.forEach((element) { - int score = int.parse(element.adultPoints); + int score = int.parse((element.adultPoints != "" ? element.adultPoints : "0")); riskScore += score; - checklist.add(Map.from({ - "IsSelected": 1, - "ParameterCode": element.parameterCode, - "ParameterGroup": element.parameterGroup, - "ParameterType": element.parameterType, - "Score": score - })); + checklist.add(Map.from({"IsSelected": 1, "ParameterCode": element.parameterCode, "ParameterGroup": element.parameterGroup, "ParameterType": element.parameterType, "Score": score})); }); } else { selectedQuestions.forEach((element) { int score = int.parse(element.pediaPoints); riskScore += score; - checklist.add(Map.from({ - "IsSelected": 1, - "ParameterCode": element.parameterCode, - "ParameterGroup": element.parameterGroup, - "ParameterType": element.parameterType, - "Score": score - })); + checklist.add(Map.from({"IsSelected": 1, "ParameterCode": element.parameterCode, "ParameterGroup": element.parameterGroup, "ParameterType": element.parameterType, "Score": score})); }); } @@ -81,16 +64,16 @@ class EdOnlineServices extends BaseService { "Notes": notes, "ChiefComplaint": chiefComplaint, "PatientId": user.patientID, - "ProjectId": 15, + "ProjectId": projectId, "RiskScore": riskScore, "checklist": checklist.map((e) => e).toList() }; - await baseAppClient.post(ER_SAVE_TRIAGE_INFORMATION, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + sharedPref.setInt(ER_CHECKIN_RISK_SCORE, riskScore); + + await baseAppClient.post(ER_SAVE_TRIAGE_INFORMATION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } } diff --git a/lib/core/service/medical/radiology_service.dart b/lib/core/service/medical/radiology_service.dart index fceedf56..2147f31d 100644 --- a/lib/core/service/medical/radiology_service.dart +++ b/lib/core/service/medical/radiology_service.dart @@ -58,6 +58,7 @@ class RadiologyService extends BaseService { _requestSendRadReportEmail.projectID = finalRadiology.projectID; _requestSendRadReportEmail.clinicName = finalRadiology.clinicDescription; _requestSendRadReportEmail.invoiceNo = finalRadiology.invoiceNo; + _requestSendRadReportEmail.invoiceLineItemNo = finalRadiology.invoiceLineItemNo; _requestSendRadReportEmail.setupID = finalRadiology.setupID; _requestSendRadReportEmail.doctorName = finalRadiology.doctorName; _requestSendRadReportEmail.orderDate = diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index dd1030c6..98a5b1b7 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -24,6 +24,8 @@ class PrescriptionsViewModel extends BaseViewModel { List get prescriptionReportList => _prescriptionsService.prescriptionReportList; + + List get prescriptionReportListINP => _prescriptionsService.prescriptionReportListINP; List get prescriptionsList => _prescriptionsService.prescriptionsList; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index dd3d3a62..89ed969d 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -32,6 +32,7 @@ class ProjectViewModel extends BaseViewModel { String error = ''; dynamic searchvalue; bool isLogin = false; + int laserSelectionDuration; dynamic get searchValue => searchvalue; @@ -49,7 +50,6 @@ class ProjectViewModel extends BaseViewModel { isLoginChild ? privilegeChildUser : privilegeChildUser; List selectedBodyPartList = []; - int laserSelectionDuration = 0; StreamSubscription subscription; diff --git a/lib/main.dart b/lib/main.dart index 0be89cc5..6840d87d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -57,9 +57,12 @@ class _MyApp extends State { final GlobalKey navigatorKey = GlobalKey(); - Future checkForUpdate() async { // todo need to verify 'imp' + checkForUpdate() { // todo need to verify 'imp' InAppUpdate.checkForUpdate().then((info) { + print("checkForUpdate!!!"); + print(info.toString()); if (info.immediateUpdateAllowed) { + print("Immediate Allowed!!!"); InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString())); } }).catchError((e) { diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart index ab1bd2cc..fa001124 100644 --- a/lib/models/LiveCare/ApplePayInsertRequest.dart +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -6,6 +6,7 @@ class ApplePayInsertRequest { int customerID; String customerName; String deviceToken; + String voipToken; int doctorID; String projectID; String serviceID; @@ -43,6 +44,7 @@ class ApplePayInsertRequest { this.customerID, this.customerName, this.deviceToken, + this.voipToken, this.doctorID, this.projectID, this.serviceID, @@ -80,6 +82,7 @@ class ApplePayInsertRequest { customerID = json['CustomerID']; customerName = json['CustomerName']; deviceToken = json['DeviceToken']; + voipToken = json['VoipToken']; doctorID = json['DoctorID']; projectID = json['ProjectID']; serviceID = json['Service_ID']; @@ -119,6 +122,7 @@ class ApplePayInsertRequest { data['CustomerID'] = this.customerID; data['CustomerName'] = this.customerName; data['DeviceToken'] = this.deviceToken; + data['VoipToken'] = this.voipToken; data['DoctorID'] = this.doctorID; data['ProjectID'] = this.projectID; data['Service_ID'] = this.serviceID; diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index b6dfde7a..d67f8a8e 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -1,11 +1,9 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -90,23 +88,23 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { showDialog( context: context, builder: (cxt) => ConfirmWithMessageDialog( - message: TranslationBase.of(context).cancelOrderMsg, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - Future.delayed(new Duration(milliseconds: 300)).then((value) async { - GifLoaderDialogUtils.showMyDialog(_context); - await model.updateCmcPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - GifLoaderDialogUtils.hideDialog(_context); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - await model.getCmcAllPresOrders(); - GifLoaderDialogUtils.hideDialog(_context); - } - }); - }, - )); + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () async { + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(_context); + await model.updateCmcPresOrder(updatePresOrderRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + GifLoaderDialogUtils.hideDialog(_context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + await model.getCmcAllPresOrders(); + GifLoaderDialogUtils.hideDialog(_context); + } + }); + }, + )); } int status = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusId : 0; @@ -140,7 +138,6 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { margin: EdgeInsets.zero, clipBehavior: Clip.antiAlias, child: Container( - // decoration: containerColorRadiusLeft(Colors.white, 12), margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), decoration: BoxDecoration( @@ -180,8 +177,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { ), Expanded( child: Text( - // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), - widget.model.pendingOrder.projectName.trim().toString(), + widget.model.pendingOrder.projectName != null ? widget.model.pendingOrder.projectName.trim().toString() : "", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index e6eefefe..0b6f49dd 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -161,19 +162,26 @@ class _NewCMCStepOnePageState extends State { widget.cMCInsertPresOrderRequestModel.patientOutSA = projectViewModel.user.outSA; widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; - await widget.model.getCustomerInfo(); + navigateTo( + context, + NewCMCStepThreePage( + cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel, + model: widget.model, + ), + ); + // await widget.model.getCustomerInfo(); if (widget.model.state == ViewState.ErrorLocal) { Utils.showErrorToast(); } else { - navigateTo( - context, - NewCMCStepTowPage( - longitude: widget.longitude, - latitude: widget.latitude, - cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel, - model: widget.model, - ), - ); + // navigateTo( + // context, + // NewCMCStepTowPage( + // longitude: widget.longitude, + // latitude: widget.latitude, + // cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel, + // model: widget.model, + // ), + // ); } } }, 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 cc83abdb..ec020f49 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 @@ -3,19 +3,24 @@ import 'dart:async'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.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/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; class NewCMCStepThreePage extends StatefulWidget { @@ -31,6 +36,12 @@ class NewCMCStepThreePage extends StatefulWidget { class _NewCMCStepThreePageState extends State { Completer _controller = Completer(); + String projectDropdownValue; + List projectsList = []; + HospitalsModel selectedHospital; + final GlobalKey projectDropdownKey = GlobalKey(); + bool isLocationSelected = false; + static CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, @@ -53,6 +64,11 @@ class _NewCMCStepThreePageState extends State { zoom: 14.4746, ); } + WidgetsBinding.instance.addPostFrameCallback((_) { + // if (projectViewModel.isLogin) { + getProjectsList(); + // } + }); super.initState(); } @@ -100,53 +116,136 @@ class _NewCMCStepThreePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).orderDetails + " : ", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.46, - color: CustomColors.grey, + Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(top: 12), + padding: EdgeInsets.only(left: 0, right: 0, top: 0, bottom: 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectLocation, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + key: projectDropdownKey, + hint: new Text(TranslationBase.of(context).selectHospital), + value: selectedHospital, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item, + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) async { + setState(() { + selectedHospital = newValue; + projectDropdownValue = newValue.mainProjectID.toString(); + isLocationSelected = true; + widget.cmcInsertPresOrderRequestModel.projectID = newValue.mainProjectID; + // getDoctorsList(context); + }); + }, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], ), ), SizedBox( height: 6, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 200, - decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey), - clipBehavior: Clip.antiAlias, - child: Container( - decoration: cardRadius(12), - clipBehavior: Clip.antiAlias, - margin: const EdgeInsets.all(0), - // child: GoogleMap( - // mapType: MapType.normal, - // markers: markers, - // initialCameraPosition: _kGooglePlex, - // onMapCreated: (GoogleMapController controller) { - // _controller.complete(controller); - // }, - // ), - child: Image.network( - "https://maps.googleapis.com/maps/api/staticmap?center=" + - widget.cmcInsertPresOrderRequestModel.latitude.toString() + - "," + - widget.cmcInsertPresOrderRequestModel.longitude.toString() + - "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + - widget.cmcInsertPresOrderRequestModel.latitude.toString() + - "," + - widget.cmcInsertPresOrderRequestModel.longitude.toString() + - "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", - width: double.infinity, - height: double.infinity, - fit: BoxFit.cover, - ), - ), - ), - ), + isLocationSelected + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Stack( + children: [ + Container( + height: 200, + decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey), + clipBehavior: Clip.antiAlias, + child: Container( + decoration: cardRadius(12), + clipBehavior: Clip.antiAlias, + margin: const EdgeInsets.all(0), + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=" + + selectedHospital.latitude.toString() + + "," + + selectedHospital.longitude.toString() + + "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + + selectedHospital.latitude.toString() + + "," + + selectedHospital.longitude.toString() + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + ), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + InkWell( + onTap: () { + getDirections(); + }, + child: Container( + decoration: cardRadius(1000), + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.all(3.0), + child: SvgPicture.asset( + "assets/images/new/direction.svg", + width: 13, + height: 13, + ), + ), + mWidth(6), + Text( + TranslationBase.of(context).getDirections, + style: TextStyle( + color: Colors.black, + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ), + ), + ], + ), + ], + ), + ) + : Container(), SizedBox( height: 12, ), @@ -196,32 +295,89 @@ class _NewCMCStepThreePageState extends State { children: [ Container( width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).confirm, - color: CustomColors.green, - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - String requestId = await widget.model.insertCMCOrderRC(order: widget.cmcInsertPresOrderRequestModel); - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state != ViewState.ErrorLocal) { - //show scuccess dialog - showCMCConfirmDialog( - context, - requestId, - onClick: () { - Navigator.pop(context); - Navigator.pop(context); - }, - ); - } else { - AppToast.showErrorToast(message: widget.model.error); - } - }, - textColor: Theme.of(context).backgroundColor), + child: DefaultButton( + TranslationBase.of(context).confirm, + !isLocationSelected + ? null + : () async { + GifLoaderDialogUtils.showMyDialog(context); + String requestId = await widget.model.insertCMCOrderRC(order: widget.cmcInsertPresOrderRequestModel); + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state != ViewState.ErrorLocal) { + showCMCConfirmDialog( + context, + requestId, + onClick: () { + Navigator.pop(context); + Navigator.pop(context); + }, + ); + } else { + AppToast.showErrorToast(message: widget.model.error); + } + }, + color: CustomColors.green, + disabledColor: CustomColors.grey, + ), + // SecondaryButton( + // label: TranslationBase.of(context).confirm, + // color: CustomColors.green, + // onTap: () async { + // if(isLocationSelected) { + // GifLoaderDialogUtils.showMyDialog(context); + // String requestId = await widget.model.insertCMCOrderRC(order: widget.cmcInsertPresOrderRequestModel); + // GifLoaderDialogUtils.hideDialog(context); + // if (widget.model.state != ViewState.ErrorLocal) { + // showCMCConfirmDialog( + // context, + // requestId, + // onClick: () { + // Navigator.pop(context); + // Navigator.pop(context); + // }, + // ); + // } else { + // AppToast.showErrorToast(message: widget.model.error); + // } + // } else { + // Utils.showErrorToast("Please select hospital from the dropdown menu to continue"); + // } + // }, + // textColor: Theme.of(context).backgroundColor), ), ], ), ), ); } + + getDirections() { + if (isLocationSelected) { + MapsLauncher.launchCoordinates(double.parse(selectedHospital.latitude), double.parse(selectedHospital.longitude), selectedHospital.name); + } else { + Utils.showErrorToast("Please select address from the dropdown menu to get directions"); + } + } + + getProjectsList() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + List projectsListLocal = []; + service.getProjectsList(context).then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + res['ListProject'].forEach((v) { + projectsListLocal.add(new HospitalsModel.fromJson(v)); + }); + projectsList = projectsListLocal; + }); + } + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index ae3be830..87d55b72 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -213,17 +213,16 @@ class _NewCMCStepTowPageState extends State { longitude: longitude, onPick: () { isNeedToUpdate = true; - print("onPickonPick1"); }, ); }, )); if (isNeedToUpdate) { - print("onPickonPick2"); _selectedAddress = new AddressInfo(); _selectedAddress.address1 = widget.model.addressesList.last.address1; showCurrentLocation = false; setLatitudeAndLongitude(); + setState(() {}); } }, child: Padding( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index 78c1d140..39de5bf7 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -134,7 +134,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Expanded( child: Text( // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), - order.projectName.trim().toString(), + order.projectName != null ? order.projectName.trim().toString() : "", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index f8e377b7..7984cbbf 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -70,8 +70,6 @@ class _NewHomeHealthCareStepOnePageState extends State with SingleTic ), ], ), + mWidth(3), + Row( + children: [ + Text( + TranslationBase.of(context).insuranceCompany + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + model.ancillaryListsDetails[0].companyName.toString(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + mWidth(3), + Row( + children: [ + Text( + TranslationBase.of(context).policyNo + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + model.ancillaryListsDetails[0].insurancePolicyNo.toString(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), ], ), ), @@ -435,7 +481,7 @@ class _AnicllaryOrdersState extends State with SingleTic onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { @@ -504,7 +550,7 @@ class _AnicllaryOrdersState extends State with SingleTic DoctorsListService service = new DoctorsListService(); service.autoGenerateAncillaryOrdersInvoice(widget.orderNo, widget.projectID, widget.appoNo, selectedProcListAPI, AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); - showAlertDialog(res['AncillaryOrderInvoiceList'][0]['InvoiceNo']); + showAlertDialog(res['AncillaryOrderInvoiceList'][0]['InvoiceNo'], widget.projectID); }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: err); @@ -512,7 +558,7 @@ class _AnicllaryOrdersState extends State with SingleTic }); } - showAlertDialog(dynamic invoiceNo) { + showAlertDialog(dynamic invoiceNo, dynamic projectID) { AlertDialogBox( context: context, confirmMessage: TranslationBase.of(context).ancillaryOrderPaymentSuccess + invoiceNo.toString(), diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 51142817..28e46bdb 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -32,11 +32,7 @@ class ConfirmPaymentPage extends StatelessWidget { AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); - ConfirmPaymentPage( - {this.advanceModel, - this.patientInfoAndMobileNumber, - this.selectedPaymentMethod, - this.authenticatedUser}); + ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser}); @override Widget build(BuildContext context) { @@ -51,11 +47,9 @@ class ConfirmPaymentPage extends StatelessWidget { print("dialog dismissed"); print(value); if (value != null && value) { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = patientInfoAndMobileNumber.projectID; - openPayment(selectedPaymentMethod, authenticatedUser, - double.parse(advanceModel.amount), appo); + openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount), appo); } }); } @@ -161,14 +155,9 @@ class ConfirmPaymentPage extends StatelessWidget { disabled: model.state == ViewState.Busy, onTap: () { GifLoaderDialogUtils.showMyDialog(context); - model - .sendActivationCodeForAdvancePayment( - patientID: int.parse(advanceModel.fileNumber), - projectID: advanceModel.hospitalsModel.iD) - .then((value) { + model.sendActivationCodeForAdvancePayment(patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD).then((value) { GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.ErrorLocal && - model.state != ViewState.Error) showSMSDialog(); + if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); }); }, ), @@ -202,29 +191,11 @@ class ConfirmPaymentPage extends StatelessWidget { return 'assets/images/new-design/mada.png'; } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, - double amount, AppoitmentAllHistoryResultList appo) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - browser.openPaymentBrowser( - amount, - "Advance Payment", - Utils.getAdvancePaymentTransID( - authenticatedUser.projectID, authenticatedUser.patientID), - appo.projectID.toString(), - authenticatedUser.emailAddress, - paymentMethod, - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - browser, - false, - "3", - ""); + browser.openPaymentBrowser(amount, "Advance Payment", Utils.getAdvancePaymentTransID(authenticatedUser.projectID, authenticatedUser.patientID), appo.projectID.toString(), + authenticatedUser.emailAddress, paymentMethod, authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "3", ""); } onBrowserLoadStart(String url) { @@ -250,18 +221,13 @@ class ConfirmPaymentPage extends StatelessWidget { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - AppGlobal.context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print("Printing Payment Status Reponse!!!!"); print(res); @@ -282,17 +248,10 @@ class ConfirmPaymentPage extends StatelessWidget { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], AppGlobal.context) - .then((res) { + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString(), - appo); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString(), appo); }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: err); @@ -300,14 +259,10 @@ class ConfirmPaymentPage extends StatelessWidget { }); } - addAdvancedNumberRequest(String advanceNumber, String paymentReference, - String appointmentID, AppoitmentAllHistoryResultList appo) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, AppGlobal.context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res); navigateToHome(AppGlobal.context); diff --git a/lib/pages/Blood/user_agreement_page.dart b/lib/pages/Blood/user_agreement_page.dart index 319d868e..a5c086b3 100644 --- a/lib/pages/Blood/user_agreement_page.dart +++ b/lib/pages/Blood/user_agreement_page.dart @@ -14,6 +14,7 @@ class UserAgreementPage extends StatelessWidget { isShowAppBar: true, showNewAppBarTitle: true, showNewAppBar: true, + isShowDecPage: false, appBarTitle: TranslationBase.of(context).userAgreement, body: SingleChildScrollView( child: Html( diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 706a51d9..4e6fe0d6 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -65,7 +65,7 @@ class _BookConfirmState extends State { @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); - projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: widget.doctor.doctorTitle + " " + widget.doctor.name, isShowDecPage: false, @@ -271,19 +271,20 @@ class _BookConfirmState extends State { insertAppointment(context, DoctorList docObject, int initialSlotDuration) { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; - projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel).then((res) { + widget.service + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel) + .then((res) { if (res['MessageStatus'] == 1) { - projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); Future.delayed(new Duration(milliseconds: 500), () { getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); getToDoCount(); }); + projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); } else { GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); @@ -312,17 +313,17 @@ class _BookConfirmState extends State { AppToast.showErrorToast(message: err); print(err); }); + projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); } insertLiveCareScheduledAppointment(context, DoctorList docObject) { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; - projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'livecare', dateTime: timeSlot, doctor: widget.doctor); - + widget.selectedDate = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; + 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) { if (res['MessageStatus'] == 1) { - projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'livecare', dateTime: timeSlot, doctor: widget.doctor); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); @@ -330,6 +331,7 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); getToDoCount(); }); + projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'livecare', dateTime: timeSlot, doctor: widget.doctor); } else { GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); @@ -358,6 +360,8 @@ class _BookConfirmState extends State { AppToast.showErrorToast(message: err); print(err); }); + + projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'livecare', dateTime: timeSlot, doctor: widget.doctor); } getToDoCount() { @@ -375,12 +379,16 @@ class _BookConfirmState extends State { getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + projectViewModel.selectedBodyPartList.clear(); + projectViewModel.laserSelectionDuration = 0; print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); // AppToast.showErrorToast(message: err); + projectViewModel.selectedBodyPartList.clear(); + projectViewModel.laserSelectionDuration = 0; navigateToHome(context); print(err); }); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 693f98e9..de9b9c70 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -46,6 +46,7 @@ class _BookSuccessState extends State { AuthenticatedUser authUser; ProjectViewModel projectViewModel; + String selectedPaymentMethod = ""; @override initState() { @@ -198,8 +199,8 @@ class _BookSuccessState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { - projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: true); startPaymentProcess(); + projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: true); }, child: Text(TranslationBase.of(context).payNow.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), @@ -220,8 +221,8 @@ class _BookSuccessState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { - projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: false); navigateToHome(context); + projectViewModel.analytics.appointment.pay_now_for_appointment(appointment_type: 'regular', doctorDetail: widget.docObject, payNow: false); }, child: Text(TranslationBase.of(context).payLater.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), @@ -264,6 +265,7 @@ class _BookSuccessState extends State { appo.serviceID = widget.patientShareResponse.serviceID; appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; appo.doctorID = widget.patientShareResponse.doctorID; + appo.appointmentDate = widget.patientShareResponse.appointmentDate; if (appo.isLiveCareAppointment) insertLiveCareVIDARequest(appo); else @@ -424,6 +426,7 @@ class _BookSuccessState extends State { appo.serviceID = widget.patientShareResponse.serviceID; appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; appo.doctorID = widget.patientShareResponse.doctorID; + appo.appointmentDate = widget.patientShareResponse.appointmentDate; insertLiveCareVIDARequest(appo, isMoveHome: false); }).catchError((err) { // GifLoaderDialogUtils.hideDialog(context); @@ -457,7 +460,7 @@ class _BookSuccessState extends State { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo, {bool isMoveHome = true}) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) { + service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (isMoveHome) navigateToHome(context); @@ -538,15 +541,15 @@ class _BookSuccessState extends State { setState(() {}); }))).then((value) { if (value != null) { - projectViewModel.analytics.appointment.payment_method(appointment_type: 'regular', clinic: widget.docObject.clinicName, payment_method: value, payment_type: 'appointment'); openPayment(value, authUser, 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'); } }); } openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - + selectedPaymentMethod = paymentMethod[0]; widget.browser.openPaymentBrowser( amount, "Appointment check in", @@ -591,29 +594,40 @@ class _BookSuccessState extends State { } onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { - if (isPaymentMade) checkPaymentStatus(appo); + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + String txn_ref; + num amount; + String payment_method; + 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), context).then((res) { String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { - String txn_ref = res['Merchant_Reference']; - String amount = res['Amount']; - String payment_method = res['PaymentMethod']; - final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; + txn_ref = res['Merchant_Reference']; + amount = res['Amount']; + payment_method = res['PaymentMethod']; + createAdvancePayment(res, appo); projectViewModel.analytics.appointment.payment_success( appointment_type: 'regular', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref); - createAdvancePayment(res, appo); } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['Response_Message']); + projectViewModel.analytics.appointment.payment_fail( + appointment_type: 'regular', + payment_method: selectedPaymentMethod, + clinic: appo.clinicName, + hospital: appo.projectName, + txn_amount: widget.patientShareResponse.patientShareWithTax.toString(), + txn_currency: currency, + error_type: res['Response_Message']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err.toString()); print(err); }); } diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index eea41c4d..a99bf39a 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -127,7 +127,6 @@ class _DoctorProfileState extends State with TickerProviderStateM showConfirmMessageDialog: false, isNeedToShowButton: !widget.isLiveCareAppointment, onTap: () { - projectViewModel.analytics.appointment.book_appointment_schedule(appointment_type: 'regular', doctor: widget.doctor); Navigator.push( context, FadePage( @@ -142,6 +141,7 @@ class _DoctorProfileState extends State with TickerProviderStateM this.doctorSchedule = value; }); }); + projectViewModel.analytics.appointment.book_appointment_schedule(appointment_type: 'regular', doctor: widget.doctor); }, onRatingAndReviewTap: () { getDoctorRatingsDetails(); @@ -495,10 +495,10 @@ class _DoctorProfileState extends State with TickerProviderStateM void goToBookConfirm() async { if (DocAvailableAppointments.areSlotsAvailable) { - if (await sharedPref.getObject(USER_PROFILE) != null) { + if (projectViewModel.isLogin) { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; - projectViewModel.analytics.appointment.book_appointment_review(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); navigateToBookConfirm(context); + projectViewModel.analytics.appointment.book_appointment_review(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); } else { ConfirmDialog dialog = new ConfirmDialog( context: context, diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index 8085976c..e7971423 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -175,8 +175,8 @@ class _BookReminderPageState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFEAEAEA), onPressed: () { - projectViewModel.analytics.appointment.appointment_reminder(false); navigateToBookSuccess(context); + projectViewModel.analytics.appointment.appointment_reminder(false); }, child: Text(TranslationBase.of(context).no, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), ), @@ -197,7 +197,6 @@ class _BookReminderPageState extends State { disabledTextColor: Colors.white, disabledColor: CustomColors.green, onPressed: () async { - projectViewModel.analytics.appointment.appointment_reminder(true); print(widget.patientShareResponse.appointmentNo); showReminderDialog( context, @@ -211,6 +210,7 @@ class _BookReminderPageState extends State { navigateToBookSuccess(context); }, ); + projectViewModel.analytics.appointment.appointment_reminder(true); }, child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), ), diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index d7d78d89..46f8a6ce 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -13,7 +13,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; @@ -57,6 +56,7 @@ class _DocAvailableAppointmentsState extends State wit ScrollController _scrollController; var language; + bool isLiveCareSchedule; @override void didUpdateWidget(covariant DocAvailableAppointments oldWidget) { @@ -81,8 +81,8 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - - if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) + isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + if (isLiveCareSchedule != null && isLiveCareSchedule) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); @@ -233,23 +233,32 @@ class _DocAvailableAppointmentsState extends State wit final DateFormat formatter = DateFormat('HH:mm'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); for (var i = 0; i < freeSlotsResponse.length; i++) { - if ((widget.doctor.projectID == 2 && DateTime.now().timeZoneName == "+04") || widget.doctor.projectID == 3 && DateTime.now().timeZoneName == "+04") { - date = Jiffy(DateUtil.convertStringToDate(freeSlotsResponse[i])).subtract(hours: 1).dateTime; - } else { - date = DateUtil.convertStringToDate(freeSlotsResponse[i]); - } + date = (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(freeSlotsResponse[i]) + : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[i], widget.doctor.projectID); slotsList.add(FreeSlot(date, ['slot'])); docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); } _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); - DocAvailableAppointments.selectedAppoDateTime = DateUtil.convertStringToDate(freeSlotsResponse[0]); - selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language); + DocAvailableAppointments.selectedDate = dateFormatter.format((isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(freeSlotsResponse[0]) + : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID)); + DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(freeSlotsResponse[0]) + : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID); + selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted( + (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(freeSlotsResponse[0]) + : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID), + language); selectedDateJSON = freeSlotsResponse[0]; }); - openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); - _calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); + openTimeSlotsPickerForDate( + (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID), + docFreeSlots); + _calendarController.selectedDate = + (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID); _calendarController.displayDate = _calendarController.selectedDate; return _eventsParsed; } @@ -262,13 +271,13 @@ class _DocAvailableAppointmentsState extends State wit onPressed: () { final timeslot = dayEvents[index]; DocAvailableAppointments.selectedAppoDateTime = timeslot.end; - projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); setState(() { selectedButtonIndex = index; DocAvailableAppointments.selectedTime = dayEvents[index].isoTime; print(DocAvailableAppointments.selectedTime); }); + projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); }, child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), ); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index 8522a915..04db5bed 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -239,6 +239,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat result = LinkedHashSet.from(arr).toList(); numAll = result.length; + projectViewModel.laserSelectionDuration = _duration; navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -264,6 +265,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat int duration = 0; if (_isFullBody) { _duration = int.parse(fullBody.timeDuration); + projectViewModel.laserSelectionDuration = duration; return _duration; } diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 1b8641a0..0c7a9546 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -23,7 +23,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'LaserClinic.dart'; @@ -219,6 +218,7 @@ class _SearchByClinicState extends State { dropdownValue = result.clinicID.toString(); setState(() { if (!isDentalSelectedAndSupported()) { + dropdownValue = ""; projectDropdownValue = ""; getDoctorsList(context); } else {} @@ -230,7 +230,6 @@ class _SearchByClinicState extends State { onTap: () { showClickListDialog(context, clinicsList, onSelection: (ListClinicCentralized clincs) { selectedClinic = clincs; - projectViewModel.analytics.appointment.book_appointment_select_clinic(appointment_type: 'regular', clinic: clincs.clinicDescription); Navigator.pop(context); setState(() { dropdownTitle = clincs.clinicDescription; @@ -238,12 +237,12 @@ class _SearchByClinicState extends State { clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); if (dropdownValue == "253-false-0-0") { Navigator.push(context, FadePage(page: LaserClinic())); - } else if (!isDentalSelectedAndSupported() && !nearestAppo) { + } else if (!isDentalSelectedAndSupported()) { projectDropdownValue = ""; getDoctorsList(context); - } else { - } + } else {} }); + projectViewModel.analytics.appointment.book_appointment_select_clinic(appointment_type: 'regular', clinic: clincs.clinicDescription); }); }, child: Container( @@ -325,7 +324,7 @@ class _SearchByClinicState extends State { child: new Text(item.name), ); }).toList(), - onChanged: (newValue) async{ + onChanged: (newValue) async { setState(() { selectedHospital = newValue; projectDropdownValue = newValue.mainProjectID.toString(); @@ -494,29 +493,32 @@ class _SearchByClinicState extends State { getProjectsList() { ClinicListService service = new ClinicListService(); List projectsListLocal = []; - service.getProjectsList(context).then((res) { - if (res['MessageStatus'] == 1) { - setState(() { - res['ListProject'].forEach((v) { - projectsListLocal.add(new HospitalsModel.fromJson(v)); - }); - projectsList = projectsListLocal; + service + .getProjectsList(context) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + res['ListProject'].forEach((v) { + projectsListLocal.add(new HospitalsModel.fromJson(v)); + }); + projectsList = projectsListLocal; + }); + filterClinic(); + isProjectLoaded = true; + } else { + isProjectLoaded = false; + } + }) + .catchError((err) {}) + .catchError((err) { + print(err); }); - filterClinic(); - isProjectLoaded = true; - } else { - isProjectLoaded = false; - } - }).catchError((err) { - }).catchError((err) { - print(err); - }); } // TODO Mosa_REMARk to come back later getDoctorsList(BuildContext context) { SearchInfo searchInfo = new SearchInfo(); - if (dropdownValue.split("-")[0] == "17") { + if (dropdownValue != null) if (dropdownValue.split("-")[0] == "17") { searchInfo.ProjectID = int.parse(projectDropdownValue); searchInfo.ClinicID = int.parse(dropdownValue.split("-")[0]); searchInfo.hospital = selectedHospital; @@ -633,6 +635,7 @@ class _SearchByClinicState extends State { .then((value) { setState(() { dropdownValue = null; + dropdownTitle = ""; }); getProjectsList(); }); diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 836bae7d..05e0ddc1 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -147,8 +147,8 @@ class _SearchByDoctorState extends State { } _searchDoctor(BuildContext context) { - projectViewModel.analytics.appointment.book_appointment_doctor_search(query: doctorNameController.text); getDoctorsList(context); + projectViewModel.analytics.appointment.book_appointment_doctor_search(query: doctorNameController.text); } navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) { diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 89ce6699..d3ae44ab 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -77,7 +77,6 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String text = "2 hours"; } - locator().appointment.appointment_reminder_time(reminde_before: text); if (onMultiDateSuccess == null) { CalendarUtils calendarUtils = await CalendarUtils.getInstance(); calendarUtils @@ -92,6 +91,7 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String } else { onMultiDateSuccess(i); } + locator().appointment.appointment_reminder_time(reminde_before: text); }, ), ); diff --git a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart index 0dc23227..ef4bf39a 100644 --- a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart +++ b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart @@ -273,6 +273,7 @@ class CovidDirveThruQuestionsState extends State { all = all && (element["ans"] == 1 || element["ans"] == 0); }); if (all) if (qa[0]["ans"] == 1) { + sharedPref.setObject(COVID_QA_LIST, qa); openPassportUpdatePage(); } else { sharedPref.setObject(COVID_QA_LIST, qa); diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index e1ddad8e..85e913e8 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -86,69 +86,63 @@ class _CovidDrivethruLocationState extends State { margin: EdgeInsets.only(top: 6.0), child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 14.0, color: Colors.black, letterSpacing: -0.56)), ), - InkWell( - onTap: () { - // dropdownKey.currentState; - // openDropdown(clinicDropdownKey); - }, - child: Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(top: 12), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).selectLocation, - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), + Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(top: 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectLocation, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, ), - Container( - height: 20, - child: DropdownButtonHideUnderline( - child: DropdownButton( - onTap: () { - print("Clicked"); - }, - key: locationDropdownKey, - hint: new Text( - TranslationBase.of(context).selectAddress, - ), - value: selectedProject, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - items: projectsList.map((DriveThroughTestingCenterModel item) { - return new DropdownMenuItem( - value: item, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text(item.projectName), getCovidTestTypeImage(item)], - ), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - selectedProject = newValue; - setProjectLocation(newValue); - }); - }, + ), + Container( + height: 20, + child: DropdownButtonHideUnderline( + child: DropdownButton( + onTap: () { + print("Clicked"); + }, + key: locationDropdownKey, + hint: new Text( + TranslationBase.of(context).selectAddress, ), + value: selectedProject, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + items: projectsList.map((DriveThroughTestingCenterModel item) { + return new DropdownMenuItem( + value: item, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text(item.projectName), getCovidTestTypeImage(item)], + ), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + selectedProject = newValue; + setProjectLocation(newValue); + }); + }, ), ), - ], - ), + ), + ], ), - Icon(Icons.keyboard_arrow_down), - ], - ), + ), + Icon(Icons.keyboard_arrow_down), + ], ), ), ], diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index 3c8c95b9..f934c932 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -14,13 +14,11 @@ 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/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class CovidPaymentSummary extends StatefulWidget { @@ -229,8 +227,7 @@ class _CovidPaymentSummaryState extends State { widget.patientShareResponse.appointmentNo, widget.patientShareResponse.clinicID, widget.patientShareResponse.doctorID, - widget.selectedInstallmentPlan - ); + widget.selectedInstallmentPlan); } onBrowserLoadStart(String url) { @@ -256,16 +253,7 @@ class _CovidPaymentSummaryState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) { - checkPaymentStatus(appo); - } else { - print("onBrowserExit Payment Not made"); - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route route) => false, - ); - } + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { @@ -280,6 +268,11 @@ class _CovidPaymentSummaryState extends State { } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['Response_Message']); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route route) => false, + ); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 4c5144ef..ad4815d9 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -4,12 +4,32 @@ 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:youtube_player_flutter/youtube_player_flutter.dart'; -class NotificationsDetailsPage extends StatelessWidget { +class NotificationsDetailsPage extends StatefulWidget { final GetNotificationsResponseModel notification; NotificationsDetailsPage({this.notification}); + @override + State createState() => _NotificationsDetailsPageState(); +} + +class _NotificationsDetailsPageState extends State { + YoutubePlayerController _controller; + + @override + void initState() { + _controller = YoutubePlayerController( + initialVideoId: getVideoURL(), + flags: YoutubePlayerFlags( + autoPlay: true, + mute: false, + ), + ); + super.initState(); + } + getDateForm(String date) { DateTime d = DateUtil.convertStringToDate(date); String monthName = DateUtil.getMonth(d.month).toString(); @@ -27,6 +47,15 @@ class NotificationsDetailsPage extends StatelessWidget { return monthName + ',${d.day},${d.year}, $hour'; } + String getVideoURL() { + if (widget.notification.videoURL != null && widget.notification.notificationType == "2") { + String videoId; + videoId = YoutubePlayer.convertUrlToId(widget.notification.videoURL); + print(videoId); // BBAyRBTfsOU + return videoId; + } + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -40,9 +69,9 @@ class NotificationsDetailsPage extends StatelessWidget { padding: EdgeInsets.all(21), children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.notification.createdOn)) + " " + - DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.notification.createdOn), false), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -50,10 +79,18 @@ class NotificationsDetailsPage extends StatelessWidget { letterSpacing: -0.64, ), ), - if (notification.messageTypeData.length != 0) + if (widget.notification.notificationType == "2") + Padding( + padding: const EdgeInsets.only(top: 18), + child: YoutubePlayer( + controller: _controller, + showVideoProgressIndicator: true, + ), + ), + if (widget.notification.messageTypeData.length != 0 && widget.notification.notificationType != "2") Padding( padding: const EdgeInsets.only(top: 18), - child: Image.network(notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) { + child: Image.network(widget.notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) { if (loadingProgress == null) return child; return Center( child: SizedBox( @@ -66,7 +103,7 @@ class NotificationsDetailsPage extends StatelessWidget { ), SizedBox(height: 18), Text( - notification.message.trim(), + widget.notification.message.trim(), style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/pages/ErService/EdOnline/DdServicesPage.dart b/lib/pages/ErService/EdOnline/DdServicesPage.dart index dc2e8d78..4276e4ca 100644 --- a/lib/pages/ErService/EdOnline/DdServicesPage.dart +++ b/lib/pages/ErService/EdOnline/DdServicesPage.dart @@ -42,37 +42,10 @@ class _DdServicesPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: 'ED Online', + showNewAppBarTitle: true, isShowDecPage: true, isShowAppBar: true, - // appBarTitle: AppBar( - // elevation: 0, - // textTheme: TextTheme( - // headline6: TextStyle( - // color: Theme.of(context).textTheme.headline1.color, - // fontWeight: FontWeight.bold), - // ), - // title: Text( - // 'ED Online', - // style: TextStyle( - // fontWeight: FontWeight.bold, - // color: Theme.of(context).textTheme.headline1.color, - // fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), - // // bold: true, - // // color: Colors.white, - // ), - // leading: Builder( - // builder: (BuildContext context) { - // return IconButton( - // icon: Icon(Icons.arrow_back), - // color: Theme.of(context).textTheme.headline1.color, - // onPressed: () { - // showConfirmMessage(context); - // }, - // ); - // }, - // ), - // centerTitle: true, - // ), + showNewAppBar: true, body: PageView( physics: NeverScrollableScrollPhysics(), controller: pageController, @@ -89,6 +62,7 @@ class _DdServicesPageState extends State { EdOnlineQuestionsPage( changePageViewIndex: _changePageViewIndex, selectedQuestions: selectedQuestions, + selectedHospital: triageInformationRequest.selectedHospital, ), EdOnlineNotesPage( changePageViewIndex: _changePageViewIndex, diff --git a/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart b/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart index fd0c8e9a..95ef8026 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart @@ -20,17 +20,15 @@ class EdOnlineNotesPage extends StatefulWidget { final List selectedQuestions; final Function changePageViewIndex; TriageInformationRequest triageInformationRequest; - EdOnlineNotesPage( - {Key key, this.selectedQuestions, this.changePageViewIndex,this.triageInformationRequest}) - ; + + EdOnlineNotesPage({Key key, this.selectedQuestions, this.changePageViewIndex, this.triageInformationRequest}); @override _EdOnlineNotesPageState createState() => _EdOnlineNotesPageState(); } class _EdOnlineNotesPageState extends State { - TextEditingController _chiefComplaintsTextController = - TextEditingController(); + TextEditingController _chiefComplaintsTextController = TextEditingController(); TextEditingController _noteTextController = TextEditingController(); DateTime selectedTime; final _formKey = GlobalKey(); @@ -83,13 +81,11 @@ class _EdOnlineNotesPageState extends State { padding: EdgeInsets.all(12), width: double.infinity, // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(selectedTime == null ?TranslationBase.of(context).errorExpectedArrivalTime:TranslationBase.of(context).expectedArrivalTime), + Texts(selectedTime == null ? TranslationBase.of(context).errorExpectedArrivalTime : TranslationBase.of(context).expectedArrivalTime), Texts(getDate(context)), ], ), @@ -116,7 +112,7 @@ class _EdOnlineNotesPageState extends State { children: [ Expanded( child: Container( - margin: EdgeInsets.only(left: 5,right: 5), + margin: EdgeInsets.only(left: 5, right: 5), child: SecondaryButton( textColor: Colors.white, color: Theme.of(context).primaryColor, @@ -125,10 +121,12 @@ class _EdOnlineNotesPageState extends State { ), ), ), - SizedBox(width: 10,), + SizedBox( + width: 10, + ), Expanded( child: Container( - margin: EdgeInsets.only(left: 5,right: 5), + margin: EdgeInsets.only(left: 5, right: 5), child: SecondaryButton( textColor: Colors.white, color: Theme.of(context).primaryColor, @@ -137,21 +135,21 @@ class _EdOnlineNotesPageState extends State { onTap: () async { if (_formKey.currentState.validate()) { GifLoaderDialogUtils.showMyDialog(context); - model.saveQuestionsInformation( - chiefComplaint: - _chiefComplaintsTextController.text.toString(), - notes: _noteTextController.text.toString(), - selectedQuestions: widget.selectedQuestions, - projectId: widget.triageInformationRequest.projectID,selectedTime: selectedTime).then((value) { + model + .saveQuestionsInformation( + chiefComplaint: _chiefComplaintsTextController.text.toString(), + notes: _noteTextController.text.toString(), + selectedQuestions: widget.selectedQuestions, + projectId: widget.triageInformationRequest.projectID, + selectedTime: selectedTime) + .then((value) { GifLoaderDialogUtils.hideDialog(context); - if(model.state == ViewState.ErrorLocal) + if (model.state == ViewState.ErrorLocal) AppToast.showErrorToast(message: model.error); - else - { - widget.changePageViewIndex(4); - } - - }).catchError((onError){ + else { + widget.changePageViewIndex(4); + } + }).catchError((onError) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: onError.toString()); }); diff --git a/lib/pages/ErService/EdOnline/EdOnlineQuestionsPage.dart b/lib/pages/ErService/EdOnline/EdOnlineQuestionsPage.dart index e3eb1c4c..c825917a 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineQuestionsPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineQuestionsPage.dart @@ -1,10 +1,13 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/TriageQuestionsModel.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/EdOnlineViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.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/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -15,16 +18,13 @@ class EdOnlineQuestionsPage extends StatefulWidget { final Function changePageViewIndex; List selectedQuestions; - EdOnlineQuestionsPage({Key key, this.selectedHospital,this.selectedQuestions, this.changePageViewIndex}); - + EdOnlineQuestionsPage({Key key, this.selectedHospital, this.selectedQuestions, this.changePageViewIndex}); @override _EdOnlineQuestionsPageState createState() => _EdOnlineQuestionsPageState(); } class _EdOnlineQuestionsPageState extends State { - - @override Widget build(BuildContext context) { return BaseView( @@ -37,90 +37,160 @@ class _EdOnlineQuestionsPageState extends State { children: [ ...List.generate( model.triageQuestionsModelList.length, - (index) => - InkWell( - onTap: (){ - setState(() { - if (widget.selectedQuestions - .contains(model.triageQuestionsModelList[index])) { - widget.selectedQuestions - .remove(model.triageQuestionsModelList[index]); - } else { - widget.selectedQuestions - .add(model.triageQuestionsModelList[index]); - } - }); - }, - child: Row( - children: [ - Checkbox( - value: widget.selectedQuestions.contains(model.triageQuestionsModelList[index]), - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (widget.selectedQuestions - .contains(model.triageQuestionsModelList[index])) { - widget.selectedQuestions - .remove(model.triageQuestionsModelList[index]); - } else { - widget.selectedQuestions - .add(model.triageQuestionsModelList[index]); - } - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - model.triageQuestionsModelList[index].question, - fontSize: 15, - ), - ), + (index) => InkWell( + onTap: () { + setState(() { + if (widget.selectedQuestions.contains(model.triageQuestionsModelList[index])) { + widget.selectedQuestions.remove(model.triageQuestionsModelList[index]); + } else { + widget.selectedQuestions.add(model.triageQuestionsModelList[index]); + } + }); + }, + child: Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + children: [ + Checkbox( + value: widget.selectedQuestions.contains(model.triageQuestionsModelList[index]), + activeColor: Color(0xffD02127), + tristate: false, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onChanged: (bool newValue) { + setState(() { + if (widget.selectedQuestions.contains(model.triageQuestionsModelList[index])) { + widget.selectedQuestions.remove(model.triageQuestionsModelList[index]); + } else { + widget.selectedQuestions.add(model.triageQuestionsModelList[index]); + } + }); + }), + SizedBox(width: 6), + Expanded( + child: Text( + model.triageQuestionsModelList[index].question, + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), - ], - ), + ), + ], ), - + ), + ), ), - SizedBox(height: 80,) + SizedBox( + height: 120, + ) ], ), ), - bottomSheet: Padding( - padding: const EdgeInsets.all(8.0), + bottomSheet: Container( + color: CustomColors.appBackgroudGreyColor, child: Container( - height: 56, + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, child: Row( - children: [ + mainAxisAlignment: MainAxisAlignment.end, + children: [ Expanded( - child: Container( - margin: EdgeInsets.only(left: 5,right: 5), - child: SecondaryButton( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xffc5272d), textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).back.toUpperCase(), - onTap: () => widget.changePageViewIndex(1), + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + widget.changePageViewIndex(0); + }, + child: Text(TranslationBase.of(context).back, style: TextStyle(fontSize: 16.0)), ), ), ), - SizedBox(width: 10,), + mWidth(7), Expanded( - child: Container( - margin: EdgeInsets.only(left: 5,right: 5), - child: SecondaryButton( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: CustomColors.green, textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).next.toUpperCase(), - disabled: widget.selectedQuestions.isEmpty, - onTap: () => widget.changePageViewIndex(3), + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: widget.selectedQuestions.isEmpty + ? null + : () { + GifLoaderDialogUtils.showMyDialog(context); + model + .saveQuestionsInformation( + chiefComplaint: "", notes: "", selectedQuestions: widget.selectedQuestions, projectId: widget.selectedHospital.iD, selectedTime: DateTime.now()) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: model.error); + else { + widget.changePageViewIndex(4); + } + }).catchError((onError) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: onError.toString()); + }); + // widget.changePageViewIndex(4); + }, + child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 16.0)), ), ), ), - ], ), ), ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Container( + // height: 56, + // child: Row( + // children: [ + // Expanded( + // child: Container( + // margin: EdgeInsets.only(left: 5, right: 5), + // child: SecondaryButton( + // textColor: Colors.white, + // color: Theme.of(context).primaryColor, + // label: TranslationBase.of(context).back.toUpperCase(), + // onTap: () => widget.changePageViewIndex(1), + // ), + // ), + // ), + // SizedBox( + // width: 10, + // ), + // Expanded( + // child: Container( + // margin: EdgeInsets.only(left: 5, right: 5), + // child: SecondaryButton( + // textColor: Colors.white, + // color: Theme.of(context).primaryColor, + // label: TranslationBase.of(context).next.toUpperCase(), + // disabled: widget.selectedQuestions.isEmpty, + // onTap: () => widget.changePageViewIndex(3), + // ), + // ), + // ), + // ], + // ), + // ), + // ), ), ); } diff --git a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart index b8498e7c..76eace88 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart @@ -1,32 +1,37 @@ import 'package:diplomaticquarterapp/core/model/er/TriageInformationRequest.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/EdOnlineViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -import '../../../Constants.dart'; - +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class EdOnlineSelectedHospitalPage extends StatefulWidget { final Function changePageViewIndex; TriageInformationRequest triageInformationRequest; - EdOnlineSelectedHospitalPage( - {Key key, this.changePageViewIndex,this.triageInformationRequest}) - : super(key: key); + EdOnlineSelectedHospitalPage({Key key, this.changePageViewIndex, this.triageInformationRequest}) : super(key: key); @override - _EdOnlineSelectedHospitalPageState createState() => - _EdOnlineSelectedHospitalPageState(); + _EdOnlineSelectedHospitalPageState createState() => _EdOnlineSelectedHospitalPageState(); } -class _EdOnlineSelectedHospitalPageState - extends State { +class _EdOnlineSelectedHospitalPageState extends State { + HospitalsModel selectedProject; + final GlobalKey locationDropdownKey = GlobalKey(); + ProjectViewModel projectViewModel; + int _selected = 0; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getHospitals(), builder: (_, model, w) => AppScaffold( @@ -35,67 +40,129 @@ class _EdOnlineSelectedHospitalPageState physics: BouncingScrollPhysics(), child: Column( children: [ - ...List.generate( - model.hospitals.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, + Container( + margin: EdgeInsets.all(12.0), + child: Text(TranslationBase.of(context).onlineCheckInAgreement, style: TextStyle(fontSize: 14.0, color: Colors.black, letterSpacing: -0.56)), + ), + Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.all(12.0), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.triageInformationRequest.selectedHospital = model.hospitals[index]; - widget.triageInformationRequest.projectID = model.hospitals[index].iD; - }); - }, - child: ListTile( - title: Text(model.hospitals[index].name + - ' ${model.hospitals[index].distanceInKilometers} ' + - TranslationBase.of(context).km), - leading: Radio( - value: model.hospitals[index], - groupValue: widget.triageInformationRequest.selectedHospital, - activeColor: secondaryColor, - onChanged: (value) { + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectLocation, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 20, + child: DropdownButtonHideUnderline( + child: DropdownButton( + onTap: () { + print("Clicked"); + }, + key: locationDropdownKey, + hint: new Text( + TranslationBase.of(context).selectHospital, + ), + value: selectedProject, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + items: model.hospitals.map((HospitalsModel item) { + return new DropdownMenuItem( + value: item, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text(item.name + " - " + item.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_)], + ), + ); + }).toList(), + onChanged: (newValue) { setState(() { - widget.triageInformationRequest.selectedHospital = model.hospitals[index]; - widget.triageInformationRequest.projectID = model.hospitals[index].iD; + selectedProject = newValue; + widget.triageInformationRequest.selectedHospital = selectedProject; }); }, ), ), ), - ) - ], + ], + ), ), - SizedBox( - height: 5.0, + Icon(Icons.keyboard_arrow_down), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Radio( + value: 1, + groupValue: _selected, + onChanged: onRadioChanged, + ), + Text( + TranslationBase.of(context).agreeTo, + style: new TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: CustomColors.textColor, + ), + ), + mWidth(4), + InkWell( + onTap: () { + launch("https://hmg.com/en/Pages/Privacy.aspx"); + }, + child: Text( + TranslationBase.of(context).termsConditoins, + style: new TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: CustomColors.accentColor, + ), + ), ), ], ), - ) + ), ], ), ), bottomSheet: Container( - height: 76, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SecondaryButton( - // textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).next.toUpperCase(), - disabled: widget.triageInformationRequest.selectedHospital==null, - onTap: () => widget.changePageViewIndex(1)), + color: CustomColors.appBackgroudGreyColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).next, + (widget.triageInformationRequest.selectedHospital == null || _selected == 0) + ? null + : () { + widget.changePageViewIndex(2); + }, + color: CustomColors.green, + disabledColor: CustomColors.grey2, ), ), ), ); } + + void onRadioChanged(int value) { + setState(() { + _selected = value; + }); + } } diff --git a/lib/pages/ErService/EdOnline/EdPaymentInformationPage.dart b/lib/pages/ErService/EdOnline/EdPaymentInformationPage.dart index c510196b..d64e3c6c 100644 --- a/lib/pages/ErService/EdOnline/EdPaymentInformationPage.dart +++ b/lib/pages/ErService/EdOnline/EdPaymentInformationPage.dart @@ -1,29 +1,45 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/EdOnlineViewModel.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/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/theme/colors.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/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; 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 EdPaymentInformationPage extends StatefulWidget { final HospitalsModel selectedHospital; const EdPaymentInformationPage({Key key, this.selectedHospital}) : super(key: key); + @override - _EdPaymentInformationPageState createState() => - _EdPaymentInformationPageState(); + _EdPaymentInformationPageState createState() => _EdPaymentInformationPageState(); } class _EdPaymentInformationPageState extends State { + MyInAppBrowser browser; + ProjectViewModel projectViewModel; + String transID = ""; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientPaymentInformation(), + onModelReady: (model) async => await model.getPatientPaymentInformation(), builder: (_, model, w) => AppScaffold( baseViewModel: model, body: SingleChildScrollView( @@ -31,82 +47,201 @@ class _EdPaymentInformationPageState extends State { child: Column( children: [ Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: Colors.white), - margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 5.0), - padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0), - child: Column( - children: [ - Container( - alignment: Alignment.center, - margin: - EdgeInsets.only(left: 0.0, right: 20.0, top: 30.0), - child: Text(TranslationBase.of(context).testFee, + decoration: cardRadius(12), + margin: EdgeInsets.fromLTRB(12.0, 30.0, 12.0, 5.0), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).payment, style: TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.bold)), - ), - if(model.erPatientShareModel!=null) - Table( - children: [ - TableRow(children: [ - TableCell( - child: - Texts(TranslationBase.of(context).testFee)), - TableCell( - child: Texts(model - .erPatientShareModel.patientShare - .toStringAsFixed(2))), - ]), - TableRow(children: [ - TableCell( - child: Texts( - TranslationBase.of(context).patientTaxToDo)), - TableCell( - child: Texts(model - .erPatientShareModel.patientTaxAmount - .toStringAsFixed(2))), - ]), - TableRow(children: [ - TableCell( - child: Texts(TranslationBase.of(context) - .patientShareTotalToDo)), - TableCell( - child: Texts(model - .erPatientShareModel.patientShareWithTax - .toStringAsFixed(2))), - ]), - ], - ), - ], + color: Colors.black, + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + )), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareToDo), + ), + Expanded( + child: _getNormalText(model.erPatientShareModel.patientShare.toStringAsFixed(2) ?? "0", isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[200]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientTaxToDo), + ), + Expanded( + child: _getNormalText(model.erPatientShareModel.patientTaxAmount.toStringAsFixed(2) ?? "0", isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[200]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + ), + Expanded( + child: _getNormalText(model.erPatientShareModel.patientShareWithTax.toStringAsFixed(2) ?? "0", isBold: true), + ) + ], + ), + ), + ], + ), ), ), + mHeight(50.0), + Text( + TranslationBase.of(context).payOptions, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), ], ), ), bottomSheet: Container( - height: 76, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SecondaryButton( - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).next.toUpperCase(), - onTap: () { - Navigator.push(context, FadePage(page: PaymentMethod())).then( - (value) { - //TODO Haroun call API here - }, - ); - }, - ), + color: CustomColors.appBackgroudGreyColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).payNow.toUpperCase(), + () { + Navigator.push(context, FadePage(page: PaymentMethod( + onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) { + setState(() {}); + }, + ))).then( + (value) { + //TODO Haroun call API here + print(value); + if (value != null) { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + appo.projectID = widget.selectedHospital.iD; + openPayment(value[0], projectViewModel.user, model.erPatientShareModel.patientShareWithTax, appo); + } + }, + ); + }, + color: CustomColors.green, + disabledColor: CustomColors.grey2, ), ), ), ); } + _getNormalText(text, {bool isBold = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold ? 12 : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } + + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); + transID = Utils.getAdvancePaymentTransID(widget.selectedHospital.iD, projectViewModel.user.patientID); + browser.openPaymentBrowser(amount, "ER Online Check-In", transID, appo.projectID.toString(), authenticatedUser.emailAddress, paymentMethod, authenticatedUser.patientType, + authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "3", ""); + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + checkPaymentStatus(appo); + } + + checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + service.checkPaymentStatus(transID, AppGlobal.context).then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + print("Printing Payment Status Reponse!!!!"); + print(res); + String paymentInfo = res['Response_Message']; + if (paymentInfo == 'Success') { + ER_createAdvancePayment(res, appo); + } else { + AppToast.showErrorToast(message: res['Response_Message']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + ER_createAdvancePayment(payment_res, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + service.ER_createAdvancePayment(appo, appo.projectID.toString(), payment_res['Amount'], payment_res['Fort_id'], payment_res['PaymentMethod'], AppGlobal.context).then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + ER_InsertEROnlinePaymentDetails(payment_res, appo); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + ER_InsertEROnlinePaymentDetails(payment_res, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + service.ER_InsertEROnlinePaymentDetails(appo, appo.projectID.toString(), payment_res['Amount'], payment_res['Fort_id'], payment_res['PaymentMethod'], AppGlobal.context).then((res) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showSuccessToast(message: TranslationBase.of(context).success); + Navigator.of(context).pop(); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); + print(err); + }); + } } diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 88b21b11..e733ca89 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -9,6 +9,7 @@ import 'package:provider/provider.dart'; import '../../uitl/translations_delegate_base.dart'; import 'AmbulanceReq.dart'; +import 'EdOnline/DdServicesPage.dart'; import 'NearestEr.dart'; class ErOptions extends StatefulWidget { @@ -86,6 +87,7 @@ class _ErOptionsState extends State { ), InkWell( onTap: () { + if (projectViewModel.havePrivilege(81)) Navigator.push(context, FadePage(page: DdServicesPage())); // Navigator.push(context, FadePage(page: DdServicesPage())); }, child: MedicalProfileItem( @@ -93,7 +95,7 @@ class _ErOptionsState extends State { imagePath: 'assets/images/new-design/AM.PNG', subTitle: TranslationBase.of(context).service, isPngImage: true, - isEnable: false, + isEnable: projectViewModel.havePrivilege(81), ), ), ], diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 01cbfacc..8726ac31 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -105,7 +105,7 @@ class _AppointmentDetailsState extends State with SingleTick "", widget.appo.projectName, DateUtil.convertStringToDate(widget.appo.appointmentDate), - widget.appo.startTime.substring(0, 5), + widget.appo.isLiveCareAppointment ? DateUtil.convertStringToDate(widget.appo.appointmentDate).toString().split(" ")[1].substring(0, 5) : widget.appo.startTime.substring(0, 5), null, widget.appo.doctorRate, widget.appo.actualDoctorRate, @@ -153,6 +153,7 @@ class _AppointmentDetailsState extends State with SingleTick if (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || + widget.appo.clinicID == 253 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { @@ -170,6 +171,7 @@ class _AppointmentDetailsState extends State with SingleTick widget.appo.clinicID == 23 || widget.appo.clinicID == 47 || widget.appo.clinicID == 265 || + widget.appo.clinicID == 253 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment ? Tab( @@ -572,9 +574,9 @@ class _AppointmentDetailsState extends State with SingleTick service.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - projectViewModel.analytics.appointment.appointment_details_confirm(appointment: widget.appo); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); Navigator.of(context).pop(); + projectViewModel.analytics.appointment.appointment_details_confirm(appointment: widget.appo); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -615,6 +617,7 @@ class _AppointmentDetailsState extends State with SingleTick } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } + projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo, appointment_type: widget.appo.isLiveCareAppointment ? "livecare" : "regular"); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index b65c5235..cccff881 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -378,7 +378,8 @@ class _MyAppointmentsState extends State with SingleTickerProvid date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate), isSortByClinic: _isSortByClinic, rating: _appointmentResult.actualDoctorRate + 0.0, - appointmentTime: _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 : null diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index 17cae84e..c84f4760 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -98,8 +98,8 @@ class _SchedulePageState extends State { itemBuilder: (context, index2) => InkWell( onTap: () { final weekDay = weeks[index][index2]['DayName']; - projectViewModel.analytics.appointment.book_appointment_date_selection(appointment_type: 'regular', day: weekDay, doctor: doctorList); openBookAppointment(weeks[index][index2]); + projectViewModel.analytics.appointment.book_appointment_date_selection(appointment_type: 'regular', day: weekDay, doctor: doctorList); }, child: Row( children: [ diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 34192260..7d9a82ae 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -98,18 +98,17 @@ class _AppointmentActionsState extends State { _handleButtonClicks(AppoDetailsButton, ToDoCountProviderModel model) { switch (AppoDetailsButton.caller) { case "openReschedule": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'reschedule appointment'); widget.tabController.animateTo((widget.tabController.index + 1) % 2); setState(() { widget.enableFooterButton(); }); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'reschedule appointment'); break; case "navigateToProject": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'hospital location'); openMap(double.parse(widget.appo.latitude), double.parse(widget.appo.longitude)); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'hospital location'); break; case "addReminder": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'add reminder'); showReminderDialog( context, DateUtil.convertStringToDate(widget.appo.appointmentDate), @@ -121,45 +120,46 @@ class _AppointmentActionsState extends State { AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); }, ); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'add reminder'); break; case "goToTodoList": // Navigator.of(context).pop(); - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'todo list'); navigateToToDoPage(context, model); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'todo list'); break; case "askDoc": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'ask doctor'); askYourDoc(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'ask doctor'); break; case "radiology": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'radiology'); openAppointmentRadiology(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'radiology'); break; case "labResult": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'lab result'); openAppointmentLabResults(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'lab result'); break; case "prescriptions": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'prescriptions'); openPrescriptionReport(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'prescriptions'); break; case "Survey": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'survey'); rateAppointment(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'survey'); break; case "Insurance": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'insurance'); navigateToInsuranceApprovals(widget.appo.appointmentNo); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'insurance'); break; case "VitalSigns": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'vital sign'); navigateToVitalSigns(widget.appo.appointmentNo, widget.appo.projectID); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'vital sign'); break; case "insertComplaint": - locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'raise complaint'); navigateToInsertComplaint(); + locator().appointment.appointment_detail_action(appointment: widget.appo, action: 'raise complaint'); break; } } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 5dacf8db..1b842624 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -214,7 +214,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { borderRadius: BorderRadius.circular(6), ), child: Text( - getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, + getNextActionText(widget.appoList[index].nextAction), + textAlign: TextAlign.center, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), @@ -246,8 +247,24 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ MyRichText(TranslationBase.of(context).clinic + ": ", widget.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), + // MyRichText(TranslationBase.of(context).appointmentDate + ": ", + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), + + // Timezone changes + widget.appoList[index].isLiveCareAppointment + ? MyRichText( + TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + " " + + DateUtil.convertStringToDate(widget.appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), + projectViewModel.isArabic) + : MyRichText( + TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + + " " + + widget.appoList[index].startTime.substring(0, 5), + projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -640,11 +657,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } Future navigateToAppointmentDetails(context, AppoitmentAllHistoryResultList appo) async { - projectViewModel.analytics.todoList.to_do_list_more_details(appo); GAnalytics.APPOINTMENT_DETAIL_FLOW_TYPE = 'todo list'; Navigator.push(context, FadePage(page: AppointmentDetails(appo: appo, parentIndex: appo.patientStatusType == 42 ? 1 : 0))).then((value) { getPatientAppointmentHistory(); }); + projectViewModel.analytics.todoList.to_do_list_more_details(appo); } getOBGyneOrdersList() { @@ -798,8 +815,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); service.generateAppointmentQR(patientShareResponse, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - projectViewModel.analytics.todoList.to_do_list_check_in(appo); navigateToQR(context, res['AppointmentQR'], patientShareResponse, appo); + projectViewModel.analytics.todoList.to_do_list_check_in(appo); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); @@ -813,7 +830,6 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } openPaymentDialog(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) { - projectViewModel.analytics.todoList.to_do_list_pay_now(appo); showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { @@ -833,12 +849,14 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { pageBuilder: (context, animation1, animation2) {}) .then((value) { if (value != null) { - projectViewModel.analytics.todoList.to_do_list_confirm_payment_details(appo); navigateToPaymentMethod(context, value, appo); + projectViewModel.analytics.todoList.to_do_list_confirm_payment_details(appo); } else { projectViewModel.analytics.todoList.to_do_list_cancel_payment_details(appo); } }); + + projectViewModel.analytics.todoList.to_do_list_pay_now(appo); } openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { @@ -890,19 +908,36 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + String txn_ref; + num amount; + String payment_method; + 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), context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { + txn_ref = res['Merchant_Reference']; + amount = res['Amount']; + payment_method = res['PaymentMethod']; createAdvancePayment(res, appo); + projectViewModel.analytics.appointment.payment_success( + appointment_type: 'regular', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref); } else { AppToast.showErrorToast(message: res['Response_Message']); + projectViewModel.analytics.appointment.payment_fail( + appointment_type: 'regular', + payment_method: payment_method, + clinic: appo.clinicName, + hospital: appo.projectName, + txn_amount: "$amount", + txn_currency: currency, + error_type: res['Response_Message']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -959,8 +994,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (value != null) { final appType = appo.isLiveCareAppointment ? 'livecare' : 'regular'; - projectViewModel.analytics.appointment.payment_method(appointment_type: appType, clinic: appo.clinicName, payment_method: value, payment_type: 'appointment'); 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'); } }); } @@ -971,13 +1006,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - projectViewModel.analytics.todoList.to_do_list_confirm_appointment(appo); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); if (appo.isLiveCareAppointment) { insertLiveCareVIDARequest(appo); } else { getPatientAppointmentHistory(); } + projectViewModel.analytics.todoList.to_do_list_confirm_appointment(appo); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -990,7 +1025,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) { + service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 46cad3aa..3c1e8745 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -199,55 +199,55 @@ class _PaymentMethodState extends State { ), ), if (projectViewModel.havePrivilege(90)) - // Container( - // width: double.infinity, - // child: InkWell( - // onTap: () { - // updateSelectedPaymentMethod("TAMARA"); - // }, - // child: Card( - // elevation: 0.0, - // margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - // color: Colors.white, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: selectedPaymentMethod == "TAMARA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), - // ), - // child: Padding( - // padding: const EdgeInsets.all(12.0), - // child: Row( - // children: [ - // Container( - // width: 24, - // height: 24, - // decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "TAMARA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), - // ), - // mWidth(12), - // Container( - // height: 60.0, - // padding: EdgeInsets.all(0.0), - // width: 60, - // child: Image.asset("assets/images/new/payment/tamara.png"), - // ), - // mFlex(1), - // if (selectedPaymentMethod == "TAMARA") - // Container( - // decoration: containerRadius(CustomColors.green, 200), - // padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), - // child: Text( - // TranslationBase.of(context).paymentSelected, - // style: TextStyle( - // color: Colors.white, - // fontSize: 11, - // ), - // ), - // ), - // ], - // ), - // ), - // ), - // ), - // ), + Container( + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("TAMARA"); + }, + child: Card( + elevation: 0.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: selectedPaymentMethod == "TAMARA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "TAMARA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(0.0), + width: 60, + child: Image.asset("assets/images/new/payment/tamara.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "TAMARA") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), + ), + ), + ), + ), if (widget.isShowInstallments && projectViewModel.havePrivilege(91)) Container( width: double.infinity, @@ -382,6 +382,7 @@ class _PaymentMethodState extends State { ], ), ), + if(tamaraInstallmentDetails != null) Column( children: [ ...List.generate( diff --git a/lib/pages/appUpdatePage/app_update_page.dart b/lib/pages/appUpdatePage/app_update_page.dart index 1296ac38..7ef1b6ff 100644 --- a/lib/pages/appUpdatePage/app_update_page.dart +++ b/lib/pages/appUpdatePage/app_update_page.dart @@ -4,10 +4,11 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:in_app_update/in_app_update.dart'; import 'package:url_launcher/url_launcher.dart'; class AppUpdatePage extends StatefulWidget { - String appUpdateText; + final String appUpdateText; AppUpdatePage({@required this.appUpdateText}); @@ -59,9 +60,9 @@ class _AppUpdatePageState extends State { textAlign: TextAlign.center, style: TextStyle( color: Colors.grey[600], - fontSize: 16.0, + fontSize: 14.0, height: 1.5, - fontWeight: FontWeight.bold))), + fontWeight: FontWeight.w600))), Container( margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: ButtonTheme( @@ -93,7 +94,17 @@ class _AppUpdatePageState extends State { openAppUpdateLink() { if (Platform.isAndroid) { - _launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg"); + // _launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg"); + InAppUpdate.checkForUpdate().then((info) { + print("checkForUpdate!!!"); + print(info.toString()); + if (info.immediateUpdateAllowed) { + print("Immediate Allowed!!!"); + InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString())); + } + }).catchError((e) { + print(e.toString()); + }); } if (Platform.isIOS) { _launchURL("https://itunes.apple.com/app/id733503978"); diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 6828b56f..dd12a5cd 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'dart:math' as math; import 'package:auto_size_text/auto_size_text.dart'; @@ -16,7 +15,6 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medic import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/packages_offers_tab_pager.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -25,9 +23,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:pay/pay.dart'; class HomePageFragment2 extends StatefulWidget { DashboardViewModel model; @@ -104,7 +100,6 @@ class _HomePageFragment2State extends State { onLoginClick: () { widget.onLoginClick(); projectViewModel.analytics.loginRegistration.login_register_initiate(); - // navigateTo(context, CallHomePage()); }, ), // height: MediaQuery.of(context).size.width / 2.6, @@ -242,8 +237,12 @@ class _HomePageFragment2State extends State { ), FlatButton( onPressed: () { - projectViewModel.analytics.hmgServices.viewAll(); + // AppSharedPreferences().getAll().then((value){ + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + // }); Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); + projectViewModel.analytics.hmgServices.viewAll(); }, child: Text( TranslationBase.of(context).viewAllServices, @@ -289,10 +288,9 @@ class _HomePageFragment2State extends State { flex: 1, child: InkWell( onTap: () { - projectViewModel.analytics.offerPackages.log(); AuthenticatedUser user = projectViewModel.user; - if(projectViewModel.havePrivilege(82) || bypassPrivilageCheck) - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesOfferTabPage(user))); + if (projectViewModel.havePrivilege(82) || bypassPrivilageCheck) Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesOfferTabPage(user))); + projectViewModel.analytics.offerPackages.log(); }, child: Stack( children: [ diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index cfd097be..51ed948c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -17,10 +18,10 @@ import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.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'; 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/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; @@ -41,7 +42,6 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart'; -import 'package:flutter_ios_voip_kit/call_state_type.dart'; import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -171,7 +171,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { } changeCurrentTab(int tab) { - projectViewModel.analytics.bottomTabNavigation.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin); if (!projectViewModel.isLogin) { if (tab == 3) { List imagesInfo = []; @@ -247,6 +246,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { // currentTab = tab; } }); + + projectViewModel.analytics.bottomTabNavigation.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin); } getToDoCount() { @@ -449,8 +450,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { } } - - dummyCall() async { final server = await SelectionDialog( @@ -479,7 +478,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { "appointmenttime": "09:00", "type": "video", "session_id": - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", "identity": "Haroon1", "name": "SmallDailyStandup", "videoUrl": "video", @@ -660,8 +659,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { ? FloatingButton( elevation: true, onTap: () { - projectViewModel.analytics.appointment.book_appointment(); changeCurrentTab(2); + projectViewModel.analytics.appointment.book_appointment(); }, ) : null); @@ -692,7 +691,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { authService.selectDeviceImei(token).then((SelectDeviceIMEIRES value) => setUserValues(value)); if (authenticatedUserObject.isLogin) { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - projectViewModel.analytics.setUser(data); if (data != null) { authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); authService.getDashboard().then((value) => { @@ -706,9 +704,23 @@ class _LandingPageState extends State with WidgetsBindingObserver { }), }); } + projectViewModel.analytics.setUser(data); } else { projectViewModel.analytics.setUser(null); } + if (Platform.isIOS) { + String voipToken = await sharedPref.getString(APNS_TOKEN); + getOneSignalVOIPToken(voipToken); + } + } + + getOneSignalVOIPToken(String voipToken) { + LiveCareService service = new LiveCareService(); + service.getOneSignalVOIPToken(voipToken, context).then((res) { + AppSharedPreferences().setString(ONESIGNAL_APNS_TOKEN, res['id']); + }).catchError((err) { + print(err); + }); } void showUserConsent() { diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 9903835f..4f6af3f0 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -60,102 +60,102 @@ class ServicesView extends StatelessWidget { LiveCareHome.isLiveCareTypeSelected = false; }); } else if (index == 1) { - locator().hmgServices.logServiceName('covid-test drive-thru'); showCovidDialog(context); + locator().hmgServices.logServiceName('covid-test drive-thru'); } else if (index == 2) { - locator().hmgServices.logServiceName('online payments'); Navigator.push(context, FadePage(page: PaymentService())); + locator().hmgServices.logServiceName('online payments'); } else if (index == 3) { - locator().hmgServices.logServiceName('home health care'); Navigator.push(context, FadePage(page: HomeHealthCarePage())); + locator().hmgServices.logServiceName('home health care'); } else if (index == 4) { - locator().hmgServices.logServiceName('comprehensive medical checkup'); Navigator.push(context, FadePage(page: CMCPage())); + locator().hmgServices.logServiceName('comprehensive medical checkup'); } else if (index == 5) { - locator().hmgServices.logServiceName('emergency service'); Navigator.push(context, FadePage(page: ErOptions(isAppbar: true))); + locator().hmgServices.logServiceName('emergency service'); } else if (index == 6) { - locator().hmgServices.logServiceName('e-referral service'); Navigator.push(context, FadePage(page: EReferralPage())); + locator().hmgServices.logServiceName('e-referral service'); } else if (index == 7) { - locator().hmgServices.logServiceName('water consumption'); Navigator.push(context, FadePage(page: H2OPage())); + locator().hmgServices.logServiceName('water consumption'); } else if (index == 8) { - locator().hmgServices.logServiceName('find us reach us'); Navigator.push(context, FadePage(page: ContactUsPage())); + locator().hmgServices.logServiceName('find us reach us'); } else if (index == 9) { - locator().hmgServices.logServiceName('my medical details'); Navigator.push( context, FadePage( page: MedicalProfilePageNew(), ), ); + locator().hmgServices.logServiceName('my medical details'); } else if (index == 10) { - locator().hmgServices.logServiceName('book appointment'); Navigator.push( context, FadePage( page: Search(), ), ); + locator().hmgServices.logServiceName('book appointment'); } else if (index == 11) { - locator().hmgServices.logServiceName('al habib pharmacy'); getPharmacyToken(context); + locator().hmgServices.logServiceName('al habib pharmacy'); } else if (index == 12) { - locator().hmgServices.logServiceName('update insurance'); Navigator.push( context, FadePage( page: InsuranceUpdate(), ), ); + locator().hmgServices.logServiceName('update insurance'); } else if (index == 13) { - locator().hmgServices.logServiceName('my family files'); Navigator.push( context, FadePage( page: MyFamily(), ), ); + locator().hmgServices.logServiceName('my family files'); } else if (index == 14) { - locator().hmgServices.logServiceName('my child vaccines'); Navigator.push( context, FadePage(page: ChildInitialPage()), ); + locator().hmgServices.logServiceName('my child vaccines'); } else if (index == 15) { // Navigator.pop(context); - locator().hmgServices.logServiceName('todo list'); LandingPage.shared.switchToDoFromHMGServices(); + locator().hmgServices.logServiceName('todo list'); } else if (index == 16) { - locator().hmgServices.logServiceName('blood donation'); Navigator.push( context, FadePage(page: BloodDonationPage()), ); + locator().hmgServices.logServiceName('blood donation'); } else if (index == 17) { - locator().hmgServices.logServiceName('health calculator'); Navigator.push( context, FadePage( page: (HealthCalculators()), ), ); + locator().hmgServices.logServiceName('health calculator'); } else if (index == 18) { - locator().hmgServices.logServiceName('heath converters'); Navigator.push( context, FadePage( page: HealthConverter(), ), ); + locator().hmgServices.logServiceName('heath converters'); } else if (index == 19) { - locator().hmgServices.logServiceName('smart watches'); Navigator.push( context, FadePage(page: SmartWatchInstructions()), ); + locator().hmgServices.logServiceName('smart watches'); } else if (index == 20) { locator().hmgServices.logServiceName('car parcking service'); Navigator.push( @@ -165,10 +165,9 @@ class ServicesView extends StatelessWidget { ), ); } else if (index == 21) { - locator().hmgServices.logServiceName('virtual tour'); launch("https://hmgwebservices.com/vt_mobile/html/index.html"); + locator().hmgServices.logServiceName('virtual tour'); } else if (index == 22) { - locator().hmgServices.logServiceName('latest news'); Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) => MyWebView( @@ -177,6 +176,7 @@ class ServicesView extends StatelessWidget { ), ), ); + locator().hmgServices.logServiceName('latest news'); } }, child: Container( diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index 4ae09885..3bd667d3 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -294,8 +294,8 @@ class _LiveCarePatmentPageState extends State { return false; }); } else { - projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); Navigator.pop(context, true); + projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); } } else { openPermissionsDialog(); diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 4c350123..4c8fadce 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -114,11 +114,11 @@ class _LiveCareTypeSelectState extends State { return InkWell( onTap: () { if (_loginIndex == 1) { - projectViewModel.analytics.liveCare.livecare_immediate_consultation(); Navigator.pop(context, "immediate"); + projectViewModel.analytics.liveCare.livecare_immediate_consultation(); } else { - projectViewModel.analytics.liveCare.livecare_schedule_video_call(); Navigator.pop(context, "schedule"); + projectViewModel.analytics.liveCare.livecare_schedule_video_call(); } }, child: Container( diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 99fa8610..d6fb745a 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -164,8 +164,6 @@ class _State extends State { getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { - locator().liveCare.livecare_clinic_schedule(clinic: patientERGetClinicsList.serviceName); - LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { @@ -207,5 +205,7 @@ class _State extends State { GifLoaderDialogUtils.hideDialog(context); print(err); }); + + locator().liveCare.livecare_clinic_schedule(clinic: patientERGetClinicsList.serviceName); } } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 1b2b4384..7f74a9fd 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -73,6 +73,9 @@ class _clinic_listState extends State { ProjectViewModel projectViewModel; + String selectedPaymentMethod = ""; + String amount = ""; + @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); @@ -106,8 +109,6 @@ class _clinic_listState extends State { } void startLiveCare() { - projectViewModel.analytics.liveCare.livecare_immediate_consultation_clinic(clinic: selectedClinicName); - bool isError = false; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); @@ -128,6 +129,7 @@ class _clinic_listState extends State { isError = true; AppToast.showErrorToast(message: err); }); + projectViewModel.analytics.liveCare.livecare_immediate_consultation_clinic(clinic: selectedClinicName); } showLiveCareCancelDialog(String msg, res) { @@ -235,41 +237,41 @@ class _clinic_listState extends State { dialog.showAlertDialog(context); } - showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - - showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: LiveCareInfoDialog(), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}) - .then((value) { - if (value) { - if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { - addNewCallForPatientER(authUser.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); - } else { - navigateToPaymentMethod(getERAppointmentFeesList, context); - } - } - }); - } + // showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { + // if (await this.sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + // setState(() { + // authUser = data; + // }); + // } + // + // showGeneralDialog( + // barrierColor: Colors.black.withOpacity(0.5), + // transitionBuilder: (context, a1, a2, widget) { + // final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + // return Transform( + // transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + // child: Opacity( + // opacity: a1.value, + // child: LiveCareInfoDialog(), + // ), + // ); + // }, + // transitionDuration: Duration(milliseconds: 500), + // barrierDismissible: true, + // barrierLabel: '', + // context: context, + // pageBuilder: (context, animation1, animation2) {}) + // .then((value) { + // if (value) { + // if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + // addNewCallForPatientER(authUser.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); + // } else { + // navigateToPaymentMethod(getERAppointmentFeesList, context); + // } + // } + // }); + // } Future navigateToPaymentMethod(GetERAppointmentFeesList getERAppointmentFeesList, context) async { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); @@ -290,8 +292,8 @@ class _clinic_listState extends State { }))).then((value) { print(value); if (value != null) { - projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value, payment_type: 'appointment'); openPayment(value, authUser, double.parse(getERAppointmentFeesList.total), appo); + projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); } }); } @@ -299,6 +301,9 @@ class _clinic_listState extends State { openPayment(List paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); + selectedPaymentMethod = paymentMethod[0]; + this.amount = amount.toString(); + browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod[0], authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID, "", "", "", "", paymentMethod[1]); } @@ -326,19 +331,26 @@ class _clinic_listState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + String amount; + String payment_method; + final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; + amount = res['Amount'].toString(); + payment_method = res['PaymentMethod']; if (paymentInfo == 'Success') { addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); } else { AppToast.showErrorToast(message: res['Response_Message']); + projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed( + appointment_type: 'livecare', payment_type: 'appointment', payment_method: selectedPaymentMethod, txn_amount: this.amount, txn_currency: currency, error_message: res['Response_Message']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -384,7 +396,7 @@ class _clinic_listState extends State { liveCareOfflineClinicsListResponse.add(clinic); } }); - if(liveCareClinicIDs != null) { + if (liveCareClinicIDs != null) { selectedClinicID = int.parse(liveCareClinicIDs.split("-")[2]); selectedClinicName = liveCareClinicIDs.split("-")[0]; } else { @@ -603,8 +615,6 @@ class _clinic_listState extends State { } void startScheduleLiveCare() { - projectViewModel.analytics.liveCare.livecare_schedule_video_call_clinic(clinic: selectedClinicName); - List doctorsList = []; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); @@ -642,6 +652,7 @@ class _clinic_listState extends State { AppToast.showErrorToast(message: err); print(err); }); + projectViewModel.analytics.liveCare.livecare_schedule_video_call_clinic(clinic: selectedClinicName); } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 887efb5c..2006a900 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/analytics/flows/login_registration.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; @@ -41,6 +42,7 @@ import 'package:provider/provider.dart'; class ConfirmLogin extends StatefulWidget { final Function changePageViewIndex; final fromRegistration; + const ConfirmLogin({Key key, this.changePageViewIndex, this.fromRegistration = false}) : super(key: key); @override @@ -274,8 +276,8 @@ class _ConfirmLogin extends State { DefaultButton( TranslationBase.of(context).useAnotherAccount, () { - projectViewModel.analytics.loginRegistration.login_with_other_account(); Navigator.of(context).pushNamed(LOGIN_TYPE); + projectViewModel.analytics.loginRegistration.login_with_other_account(); }, ), ], @@ -300,6 +302,7 @@ class _ConfirmLogin extends State { } int login_method = 0; + authenticateUser(int type, {int isActive}) { GifLoaderDialogUtils.showMyDialog(context); if (type == 2 || type == 3) { @@ -308,6 +311,10 @@ class _ConfirmLogin extends State { this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type; login_method = type; + LoginRegistration.verificationMethod = type; + // if(!widget.fromRegistration) + projectViewModel.analytics.loginRegistration.login_verfication(forRegistration: widget.fromRegistration); + switch (type) { case 1: this.loginWithSMS(type); @@ -579,11 +586,12 @@ class _ConfirmLogin extends State { else { // Navigator.of(context).pop(), - projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result), GifLoaderDialogUtils.hideDialog(context), Future.delayed(Duration(seconds: 1), () { AppToast.showErrorToast(message: result); }), + projectViewModel.analytics.loginRegistration.login_fail(error: result), + projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result), } }) .catchError((err) { @@ -621,6 +629,7 @@ class _ConfirmLogin extends State { sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), checkIfUserAgreedBefore(result), + projectViewModel.analytics.loginRegistration.login_successful(), } } else @@ -628,10 +637,12 @@ class _ConfirmLogin extends State { // Navigator.of(context).pop(), GifLoaderDialogUtils.hideDialog(context), Future.delayed(Duration(seconds: 1), () { - projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result); AppToast.showErrorToast(message: result); startSMSService(tempType); }), + + projectViewModel.analytics.loginRegistration.login_fail(error: result), + projectViewModel.analytics.errorTracking.log('otp_verification_at_confirm_login', error: result) } }) .catchError((err) { @@ -728,6 +739,7 @@ class _ConfirmLogin extends State { }); } else { authenticateUser(_flag, isActive: _loginIndex); + projectViewModel.analytics.loginRegistration.verify_otp_method(forRegistration: widget.fromRegistration); } }, child: Container( diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index 94ce51e5..051313cc 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -74,8 +74,8 @@ class _ForgotPassword extends State { width: double.infinity, child: FlatButton( onPressed: () { - locator().loginRegistration.recover_file_number(); sendPatientIDBySMS(); + locator().loginRegistration.recover_file_number(); }, child: Text( TranslationBase.of(context).submit, diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index af461044..61756ac8 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/analytics/flows/login_registration.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -63,8 +64,8 @@ class LoginType extends StatelessWidget { text: TranslationBase.of(context).forgotPassword, style: TextStyle(decoration: TextDecoration.underline, fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffC9272B), letterSpacing: -0.48, height: 18 / 12), recognizer: TapGestureRecognizer()..onTap = () { - locator().loginRegistration.forget_file_number(); Navigator.of(context).push(FadePage(page: ForgotPassword())); + locator().loginRegistration.forget_file_number(); }, ), ), @@ -76,8 +77,8 @@ class LoginType extends StatelessWidget { width: double.infinity, child: FlatButton( onPressed: () { - locator().loginRegistration.register_now(); Navigator.of(context).push(FadePage(page: RegisterNew())); + locator().loginRegistration.register_now(); }, child: Text( TranslationBase.of(context).registerNow, @@ -240,8 +241,9 @@ class LoginType extends StatelessWidget { return InkWell( onTap: () { LoginType.loginType = _flag; - locator().loginRegistration.login_start(method: type); + LoginRegistration.loginMethod = _flag; Navigator.of(_context).push(FadePage(page: Login())); + locator().loginRegistration.login_start(method: type); }, child: Container( padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 84a16f15..b504c77d 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -30,6 +30,7 @@ import 'package:flutter/rendering.dart'; import 'package:provider/provider.dart'; class Login extends StatefulWidget { + @override _Login createState() => _Login(); } @@ -282,6 +283,7 @@ class _Login extends State { }, cancelFunction: () => {}); dialog.showAlertDialog(context); + projectViewModel.analytics.loginRegistration.login_fail(error: err.toString()); }); } @@ -381,6 +383,5 @@ class _Login extends State { // setState(() { // nationalIDorFile.text = voipToken; // }); - } } diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index a38514a3..5caba584 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -1,7 +1,4 @@ import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -280,7 +277,8 @@ class _RegisterInfo extends State { children: [ Expanded( child: Padding( - padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).cancel, () { + padding: EdgeInsets.all(10), + child: DefaultButton(TranslationBase.of(context).cancel, () { Navigator.of(context).pop(); locator().loginRegistration.registration_cancel(step: page == 1 ? 'personal info' : 'other details'); }, textColor: Colors.white, color: Color(0xffD02127))), @@ -288,17 +286,10 @@ class _RegisterInfo extends State { Expanded( child: Padding( padding: EdgeInsets.all(10), - child: DefaultButton( - page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register, - (){ - nextPage(); - page == 1 - ? locator().loginRegistration.registration_personal_info() - : locator().loginRegistration.registration_patient_info(); - - }, - textColor: Colors.white, color: isValid() == true && page == 2 || page == 1 ? Color(0xff359846) : Colors.grey) - ), + child: DefaultButton(page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register, () { + nextPage(); + page == 1 ? locator().loginRegistration.registration_personal_info() : locator().loginRegistration.registration_patient_info(); + }, textColor: Colors.white, color: isValid() == true && page == 2 || page == 1 ? Color(0xff359846) : Colors.grey)), ), ], ))); @@ -356,6 +347,7 @@ class _RegisterInfo extends State { sharedPref.setString(TOKEN, result.authenticationTokenID), AppToast.showSuccessToast(message: TranslationBase.of(context).successRegister), checkIfUserAgreedBefore(result), + projectViewModel.analytics.loginRegistration.registration_confirmation() } }) .catchError((err) { @@ -368,6 +360,7 @@ class _RegisterInfo extends State { okFunction: () => {ConfirmDialog.closeAlertDialog(context)}, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); + projectViewModel.analytics.loginRegistration.registration_fail(errorType: err); }); } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 9e771f14..090f60fb 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/analytics/flows/login_registration.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_reponse.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart'; @@ -165,8 +167,8 @@ class _Register extends State { child: Padding( padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).next, (){ - locator().loginRegistration.registration_enter_details(); startRegistration(); + locator().loginRegistration.registration_enter_details(); }, textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Color(0xff359846))), ), ], @@ -341,6 +343,7 @@ class _Register extends State { okFunction: () { AlertDialogBox.closeAlertDialog(context); sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); + LoginRegistration.loginMethod = 1; // 1=NationalID, by default from Registration Navigator.of(context).push(FadePage(page: Login())); }, cancelFunction: () {}) diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index b4845915..8b9e282f 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -81,8 +81,8 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - locator().loginRegistration.visited_alhabib_group(false), Navigator.of(context).push(FadePage(page: RegisterNew())), + locator().loginRegistration.visited_alhabib_group(false), }, color: CustomColors.accentColor, textColor: Colors.white, @@ -93,8 +93,8 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).yes, () => { - locator().loginRegistration.visited_alhabib_group(true), Navigator.of(context).push(FadePage(page: LoginType())), + locator().loginRegistration.visited_alhabib_group(true), }, color: CustomColors.green, ), diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 520dfcef..ae45b3dc 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -316,7 +316,6 @@ class _AdvancePaymentPageState extends State { GifLoaderDialogUtils.showMyDialog(context); - projectViewModel.analytics.advancePayments.wallet_payment_details(); model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { @@ -332,8 +331,6 @@ class _AdvancePaymentPageState extends State { ), ).then( (value) { - projectViewModel.analytics.advancePayments.payment_method(method: value[0].toString().toLowerCase(), type: 'wallet'); - Navigator.push( context, FadePage( @@ -346,10 +343,12 @@ class _AdvancePaymentPageState extends State { ), ), ); + projectViewModel.analytics.advancePayments.payment_method(method: value[0].toString().toLowerCase(), type: 'wallet'); }, ); } }); + projectViewModel.analytics.advancePayments.wallet_payment_details(); }, color: Color(0xffD02127), textColor: Colors.white, diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index fcb893a2..4dbf6b8f 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -51,6 +51,8 @@ class _ConfirmPaymentPageState extends State { String transID = ""; + String tamaraPaymentStatus; + String tamaraOrderID; Pay _payClient; @override @@ -209,10 +211,8 @@ class _ConfirmPaymentPageState extends State { child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), () { - projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); - if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); } else { GifLoaderDialogUtils.showMyDialog(context); model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { @@ -220,6 +220,7 @@ class _ConfirmPaymentPageState extends State { if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model); }); } + projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); // startApplePay(); // if() @@ -378,6 +379,14 @@ class _ConfirmPaymentPageState extends State { print("onBrowserLoadStart"); print(url); + if (widget.selectedPaymentMethod == "TAMARA") { + Uri uri = new Uri.dataFromString(url); + tamaraPaymentStatus = uri.queryParameters['paymentStatus']; + tamaraOrderID = uri.queryParameters['orderId']; + print(tamaraPaymentStatus); + print(tamaraOrderID); + } + MyInAppBrowser.successURLS.forEach((element) { if (url.contains(element)) { if (browser.isOpened()) browser.close(); @@ -397,19 +406,49 @@ class _ConfirmPaymentPageState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + if (widget.selectedPaymentMethod == "TAMARA" && tamaraPaymentStatus != null && tamaraPaymentStatus == "approved") { + var res = { + "Amount": double.parse(widget.advanceModel.amount), + "ErrorMessage": null, + "Fort_id": tamaraOrderID, + "Merchant_Reference": "5058637919318707883366", + "PaymentMethod": "TAMARA", + "Response_Message": "Success" + }; + createAdvancePayment(res, appo); + } else { + checkPaymentStatus(appo); + } } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + String txn_ref; + String amount; + String payment_method; + final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; GifLoaderDialogUtils.showMyDialog(AppGlobal.context); DoctorsListService service = new DoctorsListService(); service.checkPaymentStatus(transID, AppGlobal.context).then((res) { String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { + txn_ref = res['Merchant_Reference']; + amount = res['Amount'].toString(); + payment_method = res['PaymentMethod']; createAdvancePayment(res, appo); + projectViewModel.analytics.advancePayments.payment_success( + payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref, hospital: widget.advanceModel.hospitalsModel.name); } else { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: res['Response_Message']); + amount = widget.advanceModel.amount; + payment_method = widget.selectedPaymentMethod; + projectViewModel.analytics.advancePayments.payment_fail( + payment_type: 'wallet', + payment_method: payment_method, + txn_amount: "$amount", + txn_currency: currency, + hospital: widget.advanceModel.hospitalsModel.name, + error_type: res['Response_Message']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 70b81b02..a7a6d5d7 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -178,8 +178,8 @@ class MyBalancePage extends StatelessWidget { DefaultButton( TranslationBase.of(context).createAdvancedPayment, () { - projectViewModel.analytics.advancePayments.wallet_recharge(service_type: 'alhabib wallet'); Navigator.push(context, FadePage(page: AdvancePaymentPage())); + projectViewModel.analytics.advancePayments.wallet_recharge(service_type: 'alhabib wallet'); }, ).insideContainer, ], diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 6e817f8c..601e0a86 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; @@ -40,7 +41,7 @@ class PrescriptionItemsPage extends StatelessWidget { baseViewModel: model, showNewAppBar: true, showNewAppBarTitle: true, - body: Column( + body: model.state != ViewState.Busy ? Column( children: [ Expanded( child: SingleChildScrollView( @@ -56,7 +57,7 @@ class PrescriptionItemsPage extends StatelessWidget { "", prescriptions.name, DateUtil.convertStringToDate(prescriptions.appointmentDate), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate : model.prescriptionReportListINP[0].orderDate)), prescriptions.nationalityFlagURL, prescriptions.doctorRate, prescriptions.actualDoctorRate, @@ -406,7 +407,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), ), ], - ), + ) : Container(), ), ); } diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index 83dc69bc..da21d7f9 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -59,8 +59,8 @@ class PaymentService extends StatelessWidget { medical.add( InkWell( onTap: () { - projectViewModel.analytics.advancePayments.payment_services(service_type: 'payment service'); Navigator.push(context, FadePage(page: AdvancePaymentPage())); + projectViewModel.analytics.advancePayments.payment_services(service_type: 'payment service'); }, child: MedicalProfileItem( title: TranslationBase.of(context).payment, @@ -76,8 +76,8 @@ class PaymentService extends StatelessWidget { medical.add( InkWell( onTap: () { - projectViewModel.analytics.advancePayments.payment_services(service_type: 'online check-in appointment'); navigateToToDoPage(context); + projectViewModel.analytics.advancePayments.payment_services(service_type: 'online check-in appointment'); }, child: MedicalProfileItem( title: TranslationBase.of(context).onlineCheckIn, @@ -93,8 +93,8 @@ class PaymentService extends StatelessWidget { medical.add( InkWell( onTap: () { - projectViewModel.analytics.advancePayments.payment_services(service_type: 'alhabib wallet'); Navigator.push(context, FadePage(page: MyBalancePage())); + projectViewModel.analytics.advancePayments.payment_services(service_type: 'alhabib wallet'); }, child: MedicalProfileItem( title: TranslationBase.of(context).hmg, diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index d74bfa87..0d68b329 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -163,14 +163,13 @@ class PaymentBottomWidget extends StatelessWidget { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) { AppToast.showSuccessToast(message: "شكراً\nPayment status for your order is Paid"); // Navigator.pop(context); // Navigator.pop(context); - } else { - AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); - // Navigator.pop(context); - // Navigator.pop(context); - } + // } else { + // AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + // // Navigator.pop(context); + // // Navigator.pop(context); + // } } } diff --git a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart index bcd367ff..ec20d414 100644 --- a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart +++ b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart @@ -2,20 +2,18 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'lacum-registration-page.dart'; - class LakumActivationVidaPage extends StatelessWidget { ProjectViewModel projectViewModel; - TextEditingController _identificationNumberController = - new TextEditingController(); + TextEditingController _identificationNumberController = new TextEditingController(); @override Widget build(BuildContext context) { @@ -50,10 +48,7 @@ class LakumActivationVidaPage extends StatelessWidget { padding: const EdgeInsets.all(8.0), child: TextField( controller: _identificationNumberController, - decoration: new InputDecoration( - hintText: TranslationBase.of(context) - .enterIdentificationNumber, - ), + decoration: new InputDecoration(hintText: TranslationBase.of(context).enterIdentificationNumber, focusColor: CustomColors.green), keyboardType: TextInputType.number, style: TextStyle( fontSize: 16, @@ -67,39 +62,38 @@ class LakumActivationVidaPage extends StatelessWidget { margin: EdgeInsets.only(top: 4), child: BorderedButton( TranslationBase.of(context).accountActivation, - backgroundColor: - _identificationNumberController.text != null && - _identificationNumberController.text != "" - ? Color(0xff60686b) - : Color(0xffb0b4b5), + // backgroundColor: _identificationNumberController.text != null && _identificationNumberController.text != "" ? CustomColors.green : Color(0xffb0b4b5), textColor: Colors.white, + backgroundColor: CustomColors.green, + borderColor: CustomColors.green, fontSize: 16, hPadding: 8, vPadding: 12, - handler: _identificationNumberController.text != null || - _identificationNumberController.text != "" + handler: _identificationNumberController.text != null || _identificationNumberController.text != "" ? () { - model - .checkLacumAccountActivation( - _identificationNumberController.text) - .then((_) => { - if (model.state == ViewState.Idle) - { - Navigator.push( - context, - FadePage( - page: LakumRegistrationPage( - _identificationNumberController - .text))) - .then((status) => { - if (status == 200) - {model.makeAccountActivate(projectViewModel.user.patientIdentificationNo)} - // back to previous page - }) - } + model.checkLacumAccountActivation(_identificationNumberController.text).then((_) { + if (model.state == ViewState.Idle) { + if (model.lacumInformation.status != "Hold") { + AppToast.showErrorToast(message: TranslationBase.of(context).lakumUnhold); + if (model.lacumInformation.status != "Discontinue") { + AppToast.showErrorToast(message: TranslationBase.of(context).lakumDiscontinue); + } + } else { + if (model.lacumInformation.status == "Hold") { + model.makeAccountActivate(projectViewModel.user.patientIdentificationNo).then((value) { + AppToast.showSuccessToast(message: TranslationBase.of(context).lakumSuccess); + Navigator.of(context).pop(); }); + } + } + // Navigator.push(context, FadePage(page: LakumRegistrationPage(_identificationNumberController.text))).then((status) => { + // if (status == 200) {model.makeAccountActivate(projectViewModel.user.patientIdentificationNo)} + // // back to previous page + // }) + } + }); } - : () {}, + : null, ), ), ], diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 8769b00a..51c43443 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -9,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -31,16 +31,13 @@ class _ProfileSettings extends State with TickerProviderStateMi @override void initState() { - super.initState(); } Widget build(BuildContext context) { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => { - getSettings() - }, + onModelReady: (model) => {getSettings()}, builder: (_, model, wi) => Container( child: model.user != null ? Column( @@ -217,6 +214,16 @@ class _ProfileSettings extends State with TickerProviderStateMi inputWidget(TranslationBase.of(context).emergencyName, "", emergencyContactName), mHeight(8), inputWidget(TranslationBase.of(context).emergencyContact, "", emergencyContact), + mHeight(10), + InkWell( + onTap: () { + deactivateAccount(); + }, + child: Text( + TranslationBase.of(context).deleteAccount, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.64, color: Color(0xffD02127), decoration: TextDecoration.underline), + ), + ), mHeight(8), ], ), @@ -330,11 +337,33 @@ class _ProfileSettings extends State with TickerProviderStateMi ); } + deactivateAccount() { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).deactivateAccount, + okText: TranslationBase.of(context).yes, + cancelText: TranslationBase.of(context).no, + okFunction: () { + Navigator.of(context).pop(); + callDeactivateAccountAPI(); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + callDeactivateAccountAPI() { + GifLoaderDialogUtils.showMyDialog(context); + Map request = {}; + request["IsActive"] = false; + authService.deactivateAccount(request).then((result) { + AppToast.showSuccessToast(message: TranslationBase.of(context).accountDeactivated); + GifLoaderDialogUtils.hideDialog(context); + + }); + } + getSettings() { - // GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - authService.getSettings().then((result) => { - // GifLoaderDialogUtils.hideDialog(AppGlobal.context), - setValue(result["PateintInfoForUpdateList"][0])}); + authService.getSettings().then((result) => {setValue(result["PateintInfoForUpdateList"][0])}); } setValue(value) { diff --git a/lib/pages/videocall-webrtc-rnd/utils/turn.dart b/lib/pages/videocall-webrtc-rnd/utils/turn.dart index f91fef80..c9c9d7f3 100644 --- a/lib/pages/videocall-webrtc-rnd/utils/turn.dart +++ b/lib/pages/videocall-webrtc-rnd/utils/turn.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'dart:async'; import 'dart:io'; -Future getTurnCredential(String host) async { +Future getTurnCredential(String host, int port) async { HttpClient client = HttpClient(context: SecurityContext()); client.badCertificateCallback = (X509Certificate cert, String host, int port) { diff --git a/lib/pages/videocall-webrtc-rnd/webrtc/signaling.dart b/lib/pages/videocall-webrtc-rnd/webrtc/signaling.dart index 438b42de..aaf5b680 100644 --- a/lib/pages/videocall-webrtc-rnd/webrtc/signaling.dart +++ b/lib/pages/videocall-webrtc-rnd/webrtc/signaling.dart @@ -251,7 +251,7 @@ class Signaling { if (_turnCredential == null) { try { - _turnCredential = await getTurnCredential(_host); + _turnCredential = await getTurnCredential(_host, 8086); /* { "username": "1584195784:mbzrxpgjys", @@ -403,7 +403,7 @@ class Signaling { 'to': session.remote_user?.id, 'from': session.local_user.id, 'candidate': { - 'sdpMLineIndex': candidate.sdpMlineIndex, + 'sdpMLineIndex': candidate.sdpMlineIndex, // sdpMlineIndex or sdpMLineIndex 'sdpMid': candidate.sdpMid, 'candidate': candidate.candidate, }, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 7003f376..76c7becb 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -364,18 +364,20 @@ class DoctorsListService extends BaseService { "PatientType": authUser.patientType }; - if(clinicID == 253) { + if (clinicID == 253) { List procedureID = projectViewModel.selectedBodyPartList.map((element) => element.id.toString()).toList(); request["GeneralProcedureList"] = procedureID; - request["InitialSlotDuration"] = projectViewModel.laserSelectionDuration; + if (procedureID.length == 1 && procedureID[0] == "1") { + request["InitialSlotDuration"] = 90; + } else { + request["InitialSlotDuration"] = projectViewModel.laserSelectionDuration; + } } dynamic localRes; await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - projectViewModel.selectedBodyPartList.clear(); - projectViewModel.laserSelectionDuration = 0; }, onFailure: (String error, int statusCode) { throw error; }, body: request); @@ -480,10 +482,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - request = { - "ProjectID": projectID, - "AppointmentNo": appoID - }; + request = {"ProjectID": projectID, "AppointmentNo": appoID}; dynamic localRes; @@ -708,7 +707,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, BuildContext context) async { + Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, String appoDate, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -728,6 +727,7 @@ class DoctorsListService extends BaseService { request = { "AppointmentNo": appoNo, + "AppointmentDate": appoDate, "ClinicID": clinicID, "ProjectID": projectID, "ServiceID": serviceID, @@ -747,7 +747,8 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, - "PatientType": authUser.patientType + "PatientType": authUser.patientType, + "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), }; dynamic localRes; @@ -985,11 +986,13 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, - "PatientType": authUser.patientType + "PatientType": authUser.patientType, + "DeviceToken": await sharedPref.getString(PUSH_TOKEN), + "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), }; // request.DeviceToken = this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false); - // request.Latitude = this.cs.sharedService.getSharedData('userLat', false); + // request.Latitude = this.cs.szharedService.getSharedData('userLat', false); // request.Longitude = this.cs.sharedService.getSharedData('userLong', false); // request.ServiceID = apptData.ServiceID; // request.ProjectID = apptData.ProjectID; @@ -1378,6 +1381,91 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future ER_createAdvancePayment(AppoitmentAllHistoryResultList appo, String projectID, double payedAmount, String paymentReference, String paymentMethodName, 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, + "PatientTypeID": authUser.patientType, + "ERAdvanceAmount": { + "ProjectId": projectID, + "PatientId": authUser.patientID, + "ClinicId": 10, + "DepositorName": authUser.firstName + " " + authUser.lastName, + "MemberId": authUser.patientID, + "NationalityID": authUser.nationalityID, + "PaymentAmount": payedAmount, + "PaymentDate": DateUtil.convertDateToString(DateTime.now()), + "PaymentMethodName": paymentMethodName, + "PaymentReferenceNumber": paymentReference, + "SourceType": 2 + } + }; + dynamic localRes; + await baseAppClient.post(ER_CREATE_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future ER_InsertEROnlinePaymentDetails( + AppoitmentAllHistoryResultList appo, String projectID, double payedAmount, String paymentReference, String paymentMethodName, 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, + "PatientTypeID": authUser.patientType, + "EROnlineCheckinPaymentDetails": { + "CheckinDate": DateUtil.convertDateToString(DateTime.now()), + "ExpectedArrivalTime": DateUtil.convertDateToString(DateTime.now()), + "ProjectId": projectID, + "PatientId": authUser.patientID, + "ClinicId": 10, + "FormId": 15, + "DepositorName": authUser.firstName + " " + authUser.lastName, + "MemberId": authUser.patientID, + "NationalityID": authUser.nationalityID, + "PaymentAmount": payedAmount, + "PaymentDate": DateUtil.convertDateToString(DateTime.now()), + "PaymentMethodName": paymentMethodName, + "PaymentReferenceNumber": paymentReference, + "TriageScore": await sharedPref.getInt(ER_CHECKIN_RISK_SCORE) + } + }; + dynamic localRes; + await baseAppClient.post(ER_INSERT_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { + localRes = response; + sharedPref.remove(ER_CHECKIN_RISK_SCORE); + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientHealthDataStats(int medCategoryId, int medCategoryStsId, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index dc3a5813..ce49243c 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -2,6 +2,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.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'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request_register.dart'; @@ -14,9 +16,12 @@ import 'package:diplomaticquarterapp/models/Authentication/register_user_requet. import 'package:diplomaticquarterapp/models/Authentication/registered_authenticated_user_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; + import '../../locator.dart'; // SharedPreferences sharedPref = new SharedPreferences(); @@ -47,6 +52,8 @@ const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate'; const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo'; +const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_InsertUpdate'; + class AuthProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; @@ -468,12 +475,6 @@ class AuthProvider with ChangeNotifier { Future getDashboard() async { Map request = {}; - // request['VersionID'] = VERSION_ID; - // request['Channel'] = CHANNEL; - // request['IPAdress'] = IP_ADDRESS; - // request['generalid'] = GENERAL_ID; - // request['LanguageID'] = LANGUAGE_ID; - // request['DeviceTypeID'] = DeviceTypeID; dynamic localRes; try { @@ -495,16 +496,14 @@ class AuthProvider with ChangeNotifier { dynamic localRes; try { await new BaseAppClient().post(PROFILE_SETTING, onSuccess: (dynamic response, int statusCode) { - localRes = response; //CheckActivationCode.fromJson(); + localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; return Future.value(error); - // throw error; }, body: {}); return Future.value(localRes); } catch (error) { throw error; - //return Future.value(error); } } @@ -512,16 +511,41 @@ class AuthProvider with ChangeNotifier { dynamic localRes; try { await new BaseAppClient().post(SAVE_SETTING, onSuccess: (dynamic response, int statusCode) { - localRes = response; //CheckActivationCode.fromJson(); + localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; return Future.value(error); - // throw error; }, body: request); return Future.value(localRes); } catch (error) { throw error; - //return Future.value(error); } } + + Future deactivateAccount(request) async { + dynamic localRes; + try { + await new BaseAppClient().post(DEACTIVATE_ACCOUNT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); + logout(); + return Future.value(localRes); + } catch (error) { + throw error; + } + } + + logout() async { + await sharedPref.remove(LOGIN_TOKEN_ID); + await sharedPref.remove(PHARMACY_CUSTOMER_ID); + await authenticatedUserObject.getUser(); + Provider.of(AppGlobal.context, listen: false).isLogin = false; + var model = Provider.of(AppGlobal.context, listen: false); + model.setState(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 b30960b4..dee399ed 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -201,7 +201,7 @@ class LiveCareService extends BaseService { Map request; String deviceToken; - String voipToken = await sharedPref.getString(APNS_TOKEN); + String voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); getDeviceToken().then((value) { print(value); deviceToken = value; @@ -314,4 +314,19 @@ class LiveCareService extends BaseService { return Future.value(localRes); } + Future getOneSignalVOIPToken(String voipToken, BuildContext context) async { + Map request; + + // request = {"app_id": "eb8e49e5-dec7-4ed2-8d6a-4df8cb301406", "identifier": voipToken, "device_type": 0, "test_type": 1}; + request = { "app_id": "eb8e49e5-dec7-4ed2-8d6a-4df8cb301406", "identifier": voipToken, "device_type": 0 }; + + dynamic localRes; + + await baseAppClient.post(GET_ONESIGNAL_VOIP_TOKEN, isExternal: true, isAllowAny: true, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/splashPage.dart b/lib/splashPage.dart index a8a8d029..b5dc28bb 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -44,7 +44,8 @@ class _SplashScreenState extends State { AppSharedPreferences().getAll().then((value){ - debugPrint(jsonEncode(value)); + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); }); } @@ -92,10 +93,10 @@ class _SplashScreenState extends State { SizedBox( height: 7, ), - Text( - "Version 1.1.0", - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10), - ), + // Text( + // "Version 1.1.0", + // style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10), + // ), SizedBox( height: 18, ) diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index ae943617..b79ea3ef 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -62,8 +62,11 @@ class CalendarUtils { TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime, _currentLocation); - print("eventId " + eventId); - Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description); + print("eventId: " + eventId); + print("writableCalendars-name: " + writableCalendars.name); + print("writableCalendars-Id: " + writableCalendars.id); + print("writableCalendarsToString: " + writableCalendars.toString()); + Event event = Event(writableCalendars.id, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description); deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { print("catchError " + e.toString()); }).whenComplete(() { diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 1c9db2f5..cac6a07d 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -10,11 +10,34 @@ class DateUtil { const end = "+0300)"; final startIndex = date.indexOf(start); final endIndex = date.indexOf(end, startIndex + start.length); + return DateTime.fromMillisecondsSinceEpoch(int.parse( + date.substring(startIndex + start.length, endIndex), + )); + } else + return DateTime.now(); + } + + static DateTime convertStringToDateSaudiTimezone(String date, int projectId) { + if (date != null) { + const start = "/Date("; + const end = "+0300)"; + final startIndex = date.indexOf(start); + final endIndex = date.indexOf(end, startIndex + start.length); + // if (projectId == 2 || projectId == 3) { + // return DateTime.fromMillisecondsSinceEpoch( + // int.parse( + // date.substring(startIndex + start.length, endIndex), + // ), + // isUtc: true) + // .add(Duration(hours: 4)); + // } else { return DateTime.fromMillisecondsSinceEpoch( - int.parse( - date.substring(startIndex + start.length, endIndex), - ) - ); + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + isUtc: true) + .add(Duration(hours: 3)); + // } } else return DateTime.now(); } @@ -53,7 +76,7 @@ class DateUtil { static String convertDateToString(DateTime date) { const start = "/Date("; - const end = "+0300)"; + const end = "+0300)/"; int milliseconds = date.millisecondsSinceEpoch; return start + "$milliseconds" + end; @@ -88,22 +111,16 @@ class DateUtil { static String convertDateMSToJsonDate(utc) { var dt = new DateTime.fromMicrosecondsSinceEpoch(utc); - return "/Date(" + - (dt.millisecondsSinceEpoch * 1000).toString() + - '+0300' + - ")/"; + return "/Date(" + (dt.millisecondsSinceEpoch * 1000).toString() + '+0300' + ")/"; } /// check Date /// [dateString] String we want to convert static String checkDate(DateTime checkedTime) { DateTime currentTime = DateTime.now(); - if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month) && - (currentTime.day == checkedTime.day)) { + if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) { return "Today"; - } else if ((currentTime.year == checkedTime.year) && - (currentTime.month == checkedTime.month)) { + } else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) { if ((currentTime.day - checkedTime.day) == 1) { return "YESTERDAY"; } else if ((currentTime.day - checkedTime.day) == -1) { @@ -121,16 +138,11 @@ class DateUtil { static String getDateFormatted(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString(); + return DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString(); } - static String getISODateFormat(DateTime dateTime){ // 2020-04-30T00:00:00.000 + static String getISODateFormat(DateTime dateTime) { + // 2020-04-30T00:00:00.000 return dateTime.toIso8601String(); } @@ -304,6 +316,7 @@ class DateUtil { else return ""; } + /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted Arabic static String getMonthDayYearDateFormattedAr(DateTime dateTime) { @@ -315,62 +328,30 @@ class DateUtil { /// get data formatted like Thursday, Apr 26,2020 /// [dateTime] convert DateTime to date formatted - static String getWeekDayMonthDayYearDateFormatted( - DateTime dateTime, String lang) { + static String getWeekDayMonthDayYearDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? getWeekDayEnglish(dateTime.weekday) + - ", " + - getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - " " + - dateTime.year.toString() - : getWeekDayArabic(dateTime.weekday) + - ", " + - dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + ? getWeekDayEnglish(dateTime.weekday) + ", " + getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString() + : getWeekDayArabic(dateTime.weekday) + ", " + dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } - static String getMonthDayYearLangDateFormatted( - DateTime dateTime, String lang) { + static String getMonthDayYearLangDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - " " + - dateTime.year.toString() - : dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + ? getMonth(dateTime.month) + " " + dateTime.day.toString() + " " + dateTime.year.toString() + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } /// get data formatted like 26/4/2020 - static String getDayMonthYearLangDateFormatted( - DateTime dateTime, String lang) { + static String getDayMonthYearLangDateFormatted(DateTime dateTime, String lang) { if (dateTime != null) return lang == 'en' - ? dateTime.day.toString() + - " " + - getMonth(dateTime.month) + - - " " + - dateTime.year.toString() - : dateTime.day.toString() + - " " + - getMonthArabic(dateTime.month) + - " " + - dateTime.year.toString(); + ? dateTime.day.toString() + " " + getMonth(dateTime.month) + " " + dateTime.year.toString() + : dateTime.day.toString() + " " + getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); else return ""; } @@ -386,11 +367,7 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime) { if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString(); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString(); else return ""; } @@ -422,13 +399,7 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) { if (dateTime != null) - return dateTime.day.toString() + - "/" + - dateTime.month.toString() + - "/" + - dateTime.year.toString() + - " " + - DateFormat('HH:mm').format(dateTime); + return dateTime.day.toString() + "/" + dateTime.month.toString() + "/" + dateTime.year.toString() + " " + DateFormat('HH:mm').format(dateTime); else return ""; } @@ -452,18 +423,12 @@ class DateUtil { return ""; } - static String getFormattedDate(DateTime dateTime, String formattedString){ - return DateFormat(formattedString) - .format(dateTime); + static String getFormattedDate(DateTime dateTime, String formattedString) { + return DateFormat(formattedString).format(dateTime); } static convertISODateToJsonDate(String isoDate) { - return "/Date(" + - DateFormat('mm-dd-yyy') - .parse(isoDate) - .millisecondsSinceEpoch - .toString() + - ")/"; + return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/"; } static String getDay(DayOfWeek dayOfWeek) { diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index eae84e38..458c59b8 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -4,7 +4,7 @@ import '../widgets/Loader/gif_loader_container.dart'; class GifLoaderDialogUtils { static showMyDialog(BuildContext context) { - showDialog(context: context, builder: (cxt) => GifLoaderContainer()); + showDialog(context: context, barrierDismissible: false, builder: (cxt) => GifLoaderContainer()); } static hideDialog(BuildContext context) { diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index b448bff4..a8b06051 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notificatio import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app-permissions.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -271,8 +272,6 @@ class PushNotificationHandler { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async { print("Firebase onMessageOpenedApp!!!"); - // Utils.showPermissionConsentDialog(context, "onMessageOpenedApp", (){}); - // newMessage(message); if (Platform.isIOS) await Future.delayed(Duration(milliseconds: 3000)).then((value) { newMessage(message); @@ -282,9 +281,15 @@ class PushNotificationHandler { }); FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { + print("Push Notification onTokenRefresh: " + fcm_token); onToken(fcm_token); }); + FirebaseMessaging.instance.getToken(vapidKey: 'BHRJG8sIzcysWxPw3B6xQjz_85nUuCfU6EAmpH18kyUTmB2cj35IdFwCyWSab80SA1v6oBSWVh-p6PcHPw_y00Y').then((String token) { + print("Push Notification getToken: " + token); + onToken(token); + }); + FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); } } @@ -306,6 +311,10 @@ class PushNotificationHandler { notification.createdOn = DateUtil.convertDateToString(DateTime.now()); notification.messageTypeData = remoteMessage.data['picture']; notification.message = remoteMessage.data['message']; + notification.notificationType = remoteMessage.data["NotificationType"].toString(); + if (remoteMessage.data["NotificationType"] == "2") { + notification.videoURL = remoteMessage.data["VideoUrl"]; + } await NavigationService.navigateToPage(NotificationsDetailsPage( notification: notification, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 7b44b24a..1b9475ed 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2853,6 +2853,12 @@ class TranslationBase { String get termsConditions => localizedValues["termsConditions"][locale.languageCode]; String get liveCarePermissions => localizedValues["liveCarePermissions"][locale.languageCode]; String get prescriptionDeliveryError => localizedValues["prescriptionDeliveryError"][locale.languageCode]; + String get lakumUnhold => localizedValues["lakumUnhold"][locale.languageCode]; + String get lakumDiscontinue => localizedValues["lakumDiscontinue"][locale.languageCode]; + String get lakumSuccess => localizedValues["lakumSuccess"][locale.languageCode]; + String get deleteAccount => localizedValues["deleteAccount"][locale.languageCode]; + String get deactivateAccount => localizedValues["deactivateAccount"][locale.languageCode]; + String get accountDeactivated => localizedValues["accountDeactivated"][locale.languageCode]; } diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index 75083d1a..4c2c40cf 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -29,14 +29,17 @@ class _GifLoaderContainerState extends State with TickerProv @override Widget build(BuildContext context) { - return Center( - //progress-loading.gif - child: Container( - // margin: EdgeInsets.only(bottom: 40), - child: GifImage( - controller: controller1, - image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), - ), - )); + return WillPopScope( + onWillPop: () async => false, + child: Center( + //progress-loading.gif + child: Container( + // margin: EdgeInsets.only(bottom: 40), + child: GifImage( + controller: controller1, + image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + ), + )), + ); } } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 72a8dbed..f95241ed 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -404,8 +404,8 @@ class _AppDrawerState extends State { InkWell( child: DrawerItem(TranslationBase.of(context).rateApp, Icons.star, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider), onTap: () { - locator().hamburgerMenu.logMenuItemClick('rate our app'); openAppReviewDialog(); + locator().hamburgerMenu.logMenuItemClick('rate our app'); // if (Platform.isIOS) { // launch("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); // } else { @@ -453,9 +453,9 @@ class _AppDrawerState extends State { InkWell( onTap: () { Navigator.push(context, FadePage(page: CallPage())); - locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); GifLoaderDialogUtils.showMyDialog(context); HMGNetworkConnectivity(context).start(); + locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -551,11 +551,9 @@ class _AppDrawerState extends State { } login() async { - locator().hamburgerMenu.logMenuItemClick('login'); var data = await sharedPref.getObject(IMEI_USER_DATA); sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); - locator().loginRegistration.login_register_initiate(); if (data != null) { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { @@ -577,6 +575,8 @@ class _AppDrawerState extends State { ); }); } + locator().loginRegistration.login_register_initiate(); + locator().hamburgerMenu.logMenuItemClick('login'); } Future getFamilyFiles() async { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index b258a7ff..e5b2cc16 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -20,18 +21,19 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT } var _InAppBrowserOptions = InAppBrowserClassOptions( - inAppWebViewGroupOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)), - crossPlatform: InAppBrowserOptions(hideUrlBar: true), - ios: IOSInAppBrowserOptions( - hideToolbarBottom: false, - toolbarBottomBackgroundColor: Colors.white, - )); + inAppWebViewGroupOptions: InAppWebViewGroupOptions( + crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), + ios: IOSInAppWebViewOptions( + applePayAPIEnabled: true, + )), + crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), + ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; // 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/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT + 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 @@ -51,9 +53,9 @@ class MyInAppBrowser extends InAppBrowser { static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; - static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails']; + static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails', 'redirectToApplePay']; - static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails']; + static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails', 'redirectToApplePay']; final Function onExitCallback; final Function onLoadStartCallback; @@ -160,14 +162,15 @@ class MyInAppBrowser extends InAppBrowser { applePayInsertRequest.clinicID = (clinicID != null && clinicID != "") ? clinicID : 0; applePayInsertRequest.currency = authenticatedUser.outSA == 1 ? "AED" : "SAR"; applePayInsertRequest.customerEmail = emailId; - applePayInsertRequest.customerID = authenticatedUser.patientID; - applePayInsertRequest.customerName = authenticatedUser.firstName; - applePayInsertRequest.deviceToken = await sharedPref.getString(PUSH_TOKEN); + applePayInsertRequest.customerID = num.parse(patientID); + applePayInsertRequest.customerName = patientName; + applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = (doctorID != null && doctorID != "") ? doctorID : 0; applePayInsertRequest.projectID = projId; applePayInsertRequest.serviceID = servID; applePayInsertRequest.channelID = 3; - applePayInsertRequest.patientID = authenticatedUser.patientID; + applePayInsertRequest.patientID = num.parse(patientID); applePayInsertRequest.patientTypeID = authenticatedUser.patientType; applePayInsertRequest.patientOutSA = authenticatedUser.outSA; applePayInsertRequest.appointmentDate = (appoDate != null && appoDate != "") ? appoDate : null; @@ -187,8 +190,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']; - safariBrowser.open(url: Uri.parse(url)); - // this.browser.openUrl(url: url, options: _InAppBrowserOptions); + // safariBrowser.open(url: Uri.parse(url)); + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); }).catchError((err) { print(err); if (context != null) GifLoaderDialogUtils.hideDialog(context); @@ -220,7 +223,7 @@ class MyInAppBrowser extends InAppBrowser { if (order.customValuesXml.contains("ApplePay")) { safariBrowser.open(url: Uri.parse(value)); } else { - this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value))); + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value)), options: _InAppBrowserOptions); } }); } @@ -249,8 +252,12 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); - // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN) + "," + await sharedPref.getString(APNS_TOKEN)); - form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + 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 AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)); + // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index a39b9d6a..6865ece5 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:badges/badges.dart'; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -16,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/pr import 'package:diplomaticquarterapp/pages/search_products_page.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.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/navigation_service.dart'; @@ -404,6 +406,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { else IconButton( onPressed: () { + AppSharedPreferences().remove(IS_LIVECARE_APPOINTMENT); Navigator.pushAndRemoveUntil( context, MaterialPageRoute(builder: (context) => LandingPage()), diff --git a/pubspec.yaml b/pubspec.yaml index 0165c607..6bc27e53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.4.94+404094 +version: 4.4.99+404099 environment: sdk: ">=2.7.0 <3.0.0" @@ -135,7 +135,7 @@ dependencies: flutter_local_notifications: ^9.1.4 #device_calendar - device_calendar: ^4.0.1 + device_calendar: ^4.2.0 #Handle Geolocation geolocator: ^7.7.1 @@ -183,6 +183,7 @@ dependencies: syncfusion_flutter_sliders: ^19.3.55 searchable_dropdown: ^1.1.3 dropdown_search: 0.4.9 + youtube_player_flutter: ^8.0.0 # Dep by Zohaib shimmer: ^2.0.0 @@ -202,8 +203,6 @@ dependencies: sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 - payfort_plugin: ^0.3.1 - dependency_overrides: provider : ^5.0.0 permission_handler : ^6.0.1+1