diff --git a/Application.kt b/Application.kt new file mode 100644 index 00000000..0708653a --- /dev/null +++ b/Application.kt @@ -0,0 +1,35 @@ +//package com.cloud.diplomaticquarterapp +package com.ejada.hmg + +import io.flutter.app.FlutterApplication +import io.flutter.plugin.common.PluginRegistry +import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback +import io.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService + +class Application : FlutterApplication(), PluginRegistrantCallback { + override fun onCreate() { + super.onCreate() + FlutterFirebaseMessagingService.setPluginRegistrant(this) + } + + override fun registerWith(registry: PluginRegistry) { + io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); + } +} + +//import io.flutter.app.FlutterApplication +//import io.flutter.plugin.common.PluginRegistry +//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback +//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService +// +//class Application : FlutterApplication(), PluginRegistrantCallback { +// override fun onCreate() { +// super.onCreate() +// FlutterFirebaseMessagingService.setPluginRegistrant(this) +// } +// +// override fun registerWith(registry: PluginRegistry?) { +// FirebaseCloudMessagingPluginRegistrant.registerWith(registry) +// } +//} \ No newline at end of file diff --git a/FirebaseCloudMessagingPluginRegistrant.kt b/FirebaseCloudMessagingPluginRegistrant.kt new file mode 100644 index 00000000..9ac064cb --- /dev/null +++ b/FirebaseCloudMessagingPluginRegistrant.kt @@ -0,0 +1,23 @@ +//package com.cloud.diplomaticquarterapp +package com.ejada.hmg + +import io.flutter.plugin.common.PluginRegistry +import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin + +object FirebaseCloudMessagingPluginRegistrant { + fun registerWith(registry: PluginRegistry?) { + if (alreadyRegisteredWith(registry)) { + return + } + FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) + } + + private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean { + val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName + if (registry?.hasPlugin(key)!!) { + return true + } + registry.registrarFor(key) + return false + } +} \ No newline at end of file diff --git a/android/app/agconnect-services-new.json b/android/app/agconnect-services-new.json new file mode 100644 index 00000000..fce77eec --- /dev/null +++ b/android/app/agconnect-services-new.json @@ -0,0 +1,74 @@ +{ + "agcgw":{ + "backurl":"connect-drcn.hispace.hicloud.com", + "url":"connect-drcn.dbankcloud.cn", + "websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com", + "websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn" + }, + "agcgw_all":{ + "CN":"connect-drcn.dbankcloud.cn", + "CN_back":"connect-drcn.hispace.hicloud.com", + "DE":"connect-dre.dbankcloud.cn", + "DE_back":"connect-dre.hispace.hicloud.com", + "RU":"connect-drru.dbankcloud.cn", + "RU_back":"connect-drru.hispace.hicloud.com", + "SG":"connect-dra.dbankcloud.cn", + "SG_back":"connect-dra.hispace.hicloud.com" + }, + "client":{ + "cp_id":"2640966000002322881", + "product_id":"736430079244816567", + "client_id":"563735388191982656", + "client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF", + "project_id":"736430079244816567", + "app_id":"102857389", + "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", + "package_name":"com.ejada.hmg" + }, + "oauth_client":{ + "client_id":"102857389", + "client_type":1 + }, + "app_info":{ + "app_id":"102857389", + "package_name":"com.ejada.hmg" + }, + "service":{ + "analytics":{ + "collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn", + "collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn", + "collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn", + "collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "resource_id":"p1", + "channel_id":"" + }, + "search":{ + "url":"https://search-drcn.cloud.huawei.com" + }, + "cloudstorage":{ + "storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn" + }, + "ml":{ + "mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn" + } + }, + "region":"CN", + "configuration_version":"3.0", + "appInfos":[ + { + "package_name":"com.ejada.hmg", + "client":{ + "app_id":"102857389" + }, + "app_info":{ + "package_name":"com.ejada.hmg", + "app_id":"102857389" + }, + "oauth_client":{ + "client_type":1, + "client_id":"102857389" + } + } + ] +} \ No newline at end of file diff --git a/android/app/agconnect-services.json b/android/app/agconnect-services.json new file mode 100644 index 00000000..cfdaf83b --- /dev/null +++ b/android/app/agconnect-services.json @@ -0,0 +1,14 @@ +{ + "client":{ + "appType":"1", + "cp_id":"2640966000002322881", + "product_id":"736430079244816567", + "client_id":"563735388191982656", + "client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF", + "project_id":"736430079244816567", + "app_id":"102857389", + "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", + "package_name":"com.ejada.hmg" + }, + "configuration_version":"1.0" +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 5fd11eb3..25230849 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,6 +22,7 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' +apply plugin: 'com.huawei.agconnect' apply plugin: 'kotlin-android' apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" @@ -51,12 +52,21 @@ android { } + signingConfigs { + config{ + storeFile file('key') + keyAlias 'HMG' + storePassword 'HmGsa123' + keyPassword 'HmGsa123' + } + } + buildTypes { - debug {} + debug { + signingConfig signingConfigs.config + } release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.config } staging { // Specifies a sorted list of fallback build types that the @@ -97,6 +107,13 @@ dependencies { implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0' implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android - implementation 'com.google.android.gms:play-services-basement:17.5.0' + implementation 'com.google.android.gms:play-services-basement:17.5.0' + + + implementation "com.opentok.android:opentok-android-sdk:2.19.1" + + compile 'com.facebook.stetho:stetho:1.5.1' + implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' + } diff --git a/android/app/google-services.json b/android/app/google-services.json old mode 100755 new mode 100644 diff --git a/android/app/key b/android/app/key new file mode 100644 index 00000000..15b9f5d1 Binary files /dev/null and b/android/app/key differ diff --git a/speech_to_text_/ios/Assets/.gitkeep b/android/app/keystores/keystore similarity index 100% rename from speech_to_text_/ios/Assets/.gitkeep rename to android/app/keystores/keystore diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b90d91e3..61472941 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,6 +22,8 @@ + + @@ -36,7 +38,7 @@ @@ -99,7 +101,7 @@ + android:value="AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/icon.png b/assets/images/new/icon.png new file mode 100644 index 00000000..e802ae3e Binary files /dev/null and b/assets/images/new/icon.png differ diff --git a/assets/images/new/latest news.svg b/assets/images/new/latest news.svg new file mode 100644 index 00000000..5b9cd805 --- /dev/null +++ b/assets/images/new/latest news.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/logo.svg b/assets/images/new/logo.svg new file mode 100644 index 00000000..e777d9ee --- /dev/null +++ b/assets/images/new/logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/logout.svg b/assets/images/new/logout.svg new file mode 100644 index 00000000..b767fbff --- /dev/null +++ b/assets/images/new/logout.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/mass/health_BMI.svg b/assets/images/new/mass/health_BMI.svg new file mode 100644 index 00000000..081110d8 --- /dev/null +++ b/assets/images/new/mass/health_BMI.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/medical file.svg b/assets/images/new/medical file.svg new file mode 100644 index 00000000..0849b7a0 --- /dev/null +++ b/assets/images/new/medical file.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/medical_file.svg b/assets/images/new/medical_file.svg new file mode 100644 index 00000000..7130396a --- /dev/null +++ b/assets/images/new/medical_file.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/menu.svg b/assets/images/new/menu.svg new file mode 100644 index 00000000..05654cdb --- /dev/null +++ b/assets/images/new/menu.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/my family.svg b/assets/images/new/my family.svg new file mode 100644 index 00000000..41d0b8a9 --- /dev/null +++ b/assets/images/new/my family.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/national_id.svg b/assets/images/new/national_id.svg new file mode 100644 index 00000000..a76fd982 --- /dev/null +++ b/assets/images/new/national_id.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/not_found.svg b/assets/images/new/not_found.svg new file mode 100644 index 00000000..80aed53a --- /dev/null +++ b/assets/images/new/not_found.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/notifications.svg b/assets/images/new/notifications.svg new file mode 100644 index 00000000..5866a81b --- /dev/null +++ b/assets/images/new/notifications.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/parking details.svg b/assets/images/new/parking details.svg new file mode 100644 index 00000000..dc25eb0e --- /dev/null +++ b/assets/images/new/parking details.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/passport.svg b/assets/images/new/passport.svg new file mode 100644 index 00000000..883287fb --- /dev/null +++ b/assets/images/new/passport.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/new/payment/Apple_Pay.png b/assets/images/new/payment/Apple_Pay.png new file mode 100644 index 00000000..1dc75042 Binary files /dev/null and b/assets/images/new/payment/Apple_Pay.png differ diff --git a/assets/images/new/payment/Mada.png b/assets/images/new/payment/Mada.png new file mode 100644 index 00000000..905a5ba8 Binary files /dev/null and b/assets/images/new/payment/Mada.png differ diff --git a/assets/images/new/payment/Mastercard.png b/assets/images/new/payment/Mastercard.png new file mode 100644 index 00000000..5d8b1fa5 Binary files /dev/null and b/assets/images/new/payment/Mastercard.png differ diff --git a/assets/images/new/payment/installments.png b/assets/images/new/payment/installments.png new file mode 100644 index 00000000..b2b231bf Binary files /dev/null and b/assets/images/new/payment/installments.png differ diff --git a/assets/images/new/payment/visa.png b/assets/images/new/payment/visa.png new file mode 100644 index 00000000..3a6d90dd Binary files /dev/null and b/assets/images/new/payment/visa.png differ diff --git a/assets/images/new/paymentMethods.png b/assets/images/new/paymentMethods.png new file mode 100644 index 00000000..a2836f13 Binary files /dev/null and b/assets/images/new/paymentMethods.png differ diff --git a/assets/images/new/reach us.svg b/assets/images/new/reach us.svg new file mode 100644 index 00000000..b4634170 --- /dev/null +++ b/assets/images/new/reach us.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/reach_us.svg b/assets/images/new/reach_us.svg new file mode 100644 index 00000000..b4634170 --- /dev/null +++ b/assets/images/new/reach_us.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/referral.svg b/assets/images/new/referral.svg new file mode 100644 index 00000000..fb6b8591 --- /dev/null +++ b/assets/images/new/referral.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/respiration_rate.svg b/assets/images/new/respiration_rate.svg new file mode 100644 index 00000000..f544f547 --- /dev/null +++ b/assets/images/new/respiration_rate.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/active_medication.svg b/assets/images/new/services/active_medication.svg new file mode 100644 index 00000000..aa6eeaea --- /dev/null +++ b/assets/images/new/services/active_medication.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/services/add_reminder.svg b/assets/images/new/services/add_reminder.svg new file mode 100644 index 00000000..5866a81b --- /dev/null +++ b/assets/images/new/services/add_reminder.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/services/allergies_diagnosed.svg b/assets/images/new/services/allergies_diagnosed.svg new file mode 100644 index 00000000..258658c8 --- /dev/null +++ b/assets/images/new/services/allergies_diagnosed.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/appointment_list.svg b/assets/images/new/services/appointment_list.svg new file mode 100644 index 00000000..40f61dea --- /dev/null +++ b/assets/images/new/services/appointment_list.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/services/ask_doctor.svg b/assets/images/new/services/ask_doctor.svg new file mode 100644 index 00000000..90b7f300 --- /dev/null +++ b/assets/images/new/services/ask_doctor.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/services/balance_credit.svg b/assets/images/new/services/balance_credit.svg new file mode 100644 index 00000000..268f284f --- /dev/null +++ b/assets/images/new/services/balance_credit.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/new/services/bmi.svg b/assets/images/new/services/bmi.svg new file mode 100644 index 00000000..ce3be188 --- /dev/null +++ b/assets/images/new/services/bmi.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/services/bmr_calc.svg b/assets/images/new/services/bmr_calc.svg new file mode 100644 index 00000000..991cdd08 --- /dev/null +++ b/assets/images/new/services/bmr_calc.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/new/services/body_fat_calc.svg b/assets/images/new/services/body_fat_calc.svg new file mode 100644 index 00000000..552715b9 --- /dev/null +++ b/assets/images/new/services/body_fat_calc.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/services/calories_calc.svg b/assets/images/new/services/calories_calc.svg new file mode 100644 index 00000000..2d4de2fa --- /dev/null +++ b/assets/images/new/services/calories_calc.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/images/new/services/carbs_proteitn_fat.svg b/assets/images/new/services/carbs_proteitn_fat.svg new file mode 100644 index 00000000..ba1c7005 --- /dev/null +++ b/assets/images/new/services/carbs_proteitn_fat.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/services/chatbot.svg b/assets/images/new/services/chatbot.svg new file mode 100644 index 00000000..cf2a5092 --- /dev/null +++ b/assets/images/new/services/chatbot.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/services/delivery.svg b/assets/images/new/services/delivery.svg new file mode 100644 index 00000000..2b350b8b --- /dev/null +++ b/assets/images/new/services/delivery.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/services/eye_measurement.svg b/assets/images/new/services/eye_measurement.svg new file mode 100644 index 00000000..563329c5 --- /dev/null +++ b/assets/images/new/services/eye_measurement.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/new/services/hosp_location.svg b/assets/images/new/services/hosp_location.svg new file mode 100644 index 00000000..4d55f56b --- /dev/null +++ b/assets/images/new/services/hosp_location.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/new/services/ideal_weight_calc.svg b/assets/images/new/services/ideal_weight_calc.svg new file mode 100644 index 00000000..60d7ecbe --- /dev/null +++ b/assets/images/new/services/ideal_weight_calc.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/insurance_approval.svg b/assets/images/new/services/insurance_approval.svg new file mode 100644 index 00000000..f6a5885f --- /dev/null +++ b/assets/images/new/services/insurance_approval.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/services/insurance_card.svg b/assets/images/new/services/insurance_card.svg new file mode 100644 index 00000000..81d91b5e --- /dev/null +++ b/assets/images/new/services/insurance_card.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/new/services/internet_connection.svg b/assets/images/new/services/internet_connection.svg new file mode 100644 index 00000000..09176400 --- /dev/null +++ b/assets/images/new/services/internet_connection.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/invoice_list.svg b/assets/images/new/services/invoice_list.svg new file mode 100644 index 00000000..18fe134f --- /dev/null +++ b/assets/images/new/services/invoice_list.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/services/lab_result.svg b/assets/images/new/services/lab_result.svg new file mode 100644 index 00000000..e8507595 --- /dev/null +++ b/assets/images/new/services/lab_result.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/services/medical_report.svg b/assets/images/new/services/medical_report.svg new file mode 100644 index 00000000..186af7a6 --- /dev/null +++ b/assets/images/new/services/medical_report.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/new/services/medicine_prescription.svg b/assets/images/new/services/medicine_prescription.svg new file mode 100644 index 00000000..21cadf7c --- /dev/null +++ b/assets/images/new/services/medicine_prescription.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/services/monthly_report.svg b/assets/images/new/services/monthly_report.svg new file mode 100644 index 00000000..d218855a --- /dev/null +++ b/assets/images/new/services/monthly_report.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/new/services/my_doc.svg b/assets/images/new/services/my_doc.svg new file mode 100644 index 00000000..8bec48a5 --- /dev/null +++ b/assets/images/new/services/my_doc.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/online_payment.svg b/assets/images/new/services/online_payment.svg new file mode 100644 index 00000000..238417d8 --- /dev/null +++ b/assets/images/new/services/online_payment.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/services/ovulation.svg b/assets/images/new/services/ovulation.svg new file mode 100644 index 00000000..29650a70 --- /dev/null +++ b/assets/images/new/services/ovulation.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/services/radiology.svg b/assets/images/new/services/radiology.svg new file mode 100644 index 00000000..8f1d8a46 --- /dev/null +++ b/assets/images/new/services/radiology.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/raise_comp.svg b/assets/images/new/services/raise_comp.svg new file mode 100644 index 00000000..74a87bae --- /dev/null +++ b/assets/images/new/services/raise_comp.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/reschedule.svg b/assets/images/new/services/reschedule.svg new file mode 100644 index 00000000..28dbc920 --- /dev/null +++ b/assets/images/new/services/reschedule.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/services/sick_leave.svg b/assets/images/new/services/sick_leave.svg new file mode 100644 index 00000000..4d8eea5d --- /dev/null +++ b/assets/images/new/services/sick_leave.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/services/smart_watch.svg b/assets/images/new/services/smart_watch.svg new file mode 100644 index 00000000..236f64b4 --- /dev/null +++ b/assets/images/new/services/smart_watch.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/new/services/survey.svg b/assets/images/new/services/survey.svg new file mode 100644 index 00000000..69fb7ad0 --- /dev/null +++ b/assets/images/new/services/survey.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/new/services/tracker.svg b/assets/images/new/services/tracker.svg new file mode 100644 index 00000000..7d727cee --- /dev/null +++ b/assets/images/new/services/tracker.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/new/services/vaccine_list.svg b/assets/images/new/services/vaccine_list.svg new file mode 100644 index 00000000..7096feb3 --- /dev/null +++ b/assets/images/new/services/vaccine_list.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/new/services/vital_signs.svg b/assets/images/new/services/vital_signs.svg new file mode 100644 index 00000000..fe476c3c --- /dev/null +++ b/assets/images/new/services/vital_signs.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/smart watch.svg b/assets/images/new/smart watch.svg new file mode 100644 index 00000000..0667e31d --- /dev/null +++ b/assets/images/new/smart watch.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/new/strips.svg b/assets/images/new/strips.svg new file mode 100644 index 00000000..d93430bc --- /dev/null +++ b/assets/images/new/strips.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/images/new/temperature.svg b/assets/images/new/temperature.svg new file mode 100644 index 00000000..3330c310 --- /dev/null +++ b/assets/images/new/temperature.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/todo.svg b/assets/images/new/todo.svg new file mode 100644 index 00000000..be869c1d --- /dev/null +++ b/assets/images/new/todo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/tooth.svg b/assets/images/new/tooth.svg new file mode 100644 index 00000000..2b2e3430 --- /dev/null +++ b/assets/images/new/tooth.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/update insurance card.svg b/assets/images/new/update insurance card.svg new file mode 100644 index 00000000..0139e27d --- /dev/null +++ b/assets/images/new/update insurance card.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/verify_face.svg b/assets/images/new/verify_face.svg new file mode 100644 index 00000000..e50d1a60 --- /dev/null +++ b/assets/images/new/verify_face.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/verify_sms.svg b/assets/images/new/verify_sms.svg new file mode 100644 index 00000000..ae5fa9f7 --- /dev/null +++ b/assets/images/new/verify_sms.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/new/verify_thumb.svg b/assets/images/new/verify_thumb.svg new file mode 100644 index 00000000..e626bafc --- /dev/null +++ b/assets/images/new/verify_thumb.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/verify_whatsapp.svg b/assets/images/new/verify_whatsapp.svg new file mode 100644 index 00000000..09ac85c9 --- /dev/null +++ b/assets/images/new/verify_whatsapp.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/new/virtual tour.svg b/assets/images/new/virtual tour.svg new file mode 100644 index 00000000..733f433e --- /dev/null +++ b/assets/images/new/virtual tour.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/weight.svg b/assets/images/new/weight.svg new file mode 100644 index 00000000..013e6450 --- /dev/null +++ b/assets/images/new/weight.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/offer_ar.png b/assets/images/offer_ar.png deleted file mode 100644 index 1fdbf749..00000000 Binary files a/assets/images/offer_ar.png and /dev/null differ diff --git a/assets/images/online_payments_bg.png b/assets/images/online_payments_bg.png deleted file mode 100644 index 72f8e331..00000000 Binary files a/assets/images/online_payments_bg.png and /dev/null differ diff --git a/assets/images/pharmacy/Group 1206.svg b/assets/images/pharmacy/Group 1206.svg deleted file mode 100644 index ef8f7473..00000000 --- a/assets/images/pharmacy/Group 1206.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/assets/images/pharmacy/Group 1207.svg b/assets/images/pharmacy/Group 1207.svg deleted file mode 100644 index fd2ffd41..00000000 --- a/assets/images/pharmacy/Group 1207.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/assets/images/pharmacy/Logo Parmacy-green.png b/assets/images/pharmacy/Logo Parmacy-green.png deleted file mode 100644 index 72862b33..00000000 Binary files a/assets/images/pharmacy/Logo Parmacy-green.png and /dev/null differ diff --git a/assets/images/pharmacy/Redheart.svg b/assets/images/pharmacy/Redheart.svg deleted file mode 100644 index 3bba67fa..00000000 --- a/assets/images/pharmacy/Redheart.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/images/pharmacy/aramex_shipping_logo.svg b/assets/images/pharmacy/aramex_shipping_logo.svg deleted file mode 100644 index 30cc03b8..00000000 --- a/assets/images/pharmacy/aramex_shipping_logo.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - diff --git a/assets/images/pharmacy/arrow-left-png.png b/assets/images/pharmacy/arrow-left-png.png deleted file mode 100644 index 18d58c87..00000000 Binary files a/assets/images/pharmacy/arrow-left-png.png and /dev/null differ diff --git a/assets/images/pharmacy/arrow-right-png.png b/assets/images/pharmacy/arrow-right-png.png deleted file mode 100644 index 19af7c0b..00000000 Binary files a/assets/images/pharmacy/arrow-right-png.png and /dev/null differ diff --git a/assets/images/pharmacy/arrow.png b/assets/images/pharmacy/arrow.png deleted file mode 100644 index 19af7c0b..00000000 Binary files a/assets/images/pharmacy/arrow.png and /dev/null differ diff --git a/assets/images/pharmacy/arrow_lef.png b/assets/images/pharmacy/arrow_lef.png deleted file mode 100644 index 19af7c0b..00000000 Binary files a/assets/images/pharmacy/arrow_lef.png and /dev/null differ diff --git a/assets/images/pharmacy/delete_red_icon.svg b/assets/images/pharmacy/delete_red_icon.svg deleted file mode 100644 index 8897a683..00000000 --- a/assets/images/pharmacy/delete_red_icon.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/images/pharmacy/edit_icon.svg b/assets/images/pharmacy/edit_icon.svg deleted file mode 100644 index df7cca2f..00000000 --- a/assets/images/pharmacy/edit_icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/pharmacy/heart-empty.svg b/assets/images/pharmacy/heart-empty.svg deleted file mode 100644 index a682a44e..00000000 --- a/assets/images/pharmacy/heart-empty.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/pharmacy/hmg_shipping_greenlogo.svg b/assets/images/pharmacy/hmg_shipping_greenlogo.svg deleted file mode 100644 index 449712a5..00000000 --- a/assets/images/pharmacy/hmg_shipping_greenlogo.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/assets/images/pharmacy/hmg_shipping_logo.svg b/assets/images/pharmacy/hmg_shipping_logo.svg deleted file mode 100644 index 8e9db3d6..00000000 --- a/assets/images/pharmacy/hmg_shipping_logo.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - diff --git a/assets/images/pharmacy/offers_banner.png b/assets/images/pharmacy/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy/offers_banner.png differ diff --git a/assets/images/pharmacy/offers_banner_ar.png b/assets/images/pharmacy/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy/offers_banner_ar.png differ diff --git a/assets/images/pharmacy/pill_reminder_icon.svg b/assets/images/pharmacy/pill_reminder_icon.svg deleted file mode 100644 index f4fb4ddc..00000000 --- a/assets/images/pharmacy/pill_reminder_icon.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/pharmacy/success_check_icon.svg b/assets/images/pharmacy/success_check_icon.svg deleted file mode 100644 index ed1379b8..00000000 --- a/assets/images/pharmacy/success_check_icon.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/images/pharmacy/user.svg b/assets/images/pharmacy/user.svg deleted file mode 100644 index 8e978105..00000000 --- a/assets/images/pharmacy/user.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/pharmacy/user_icon.svg b/assets/images/pharmacy/user_icon.svg deleted file mode 100644 index 8e978105..00000000 --- a/assets/images/pharmacy/user_icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/pharmacy/wishklist_icon.svg b/assets/images/pharmacy/wishklist_icon.svg deleted file mode 100644 index cd0ce16d..00000000 --- a/assets/images/pharmacy/wishklist_icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/images/pharmacy_module/offers_banner.png b/assets/images/pharmacy_module/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner.png differ diff --git a/assets/images/pharmacy_module/offers_banner_ar.png b/assets/images/pharmacy_module/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner_ar.png differ diff --git a/assets/images/powerd-by2.jpg b/assets/images/powerd-by2.jpg deleted file mode 100644 index 93bdbb18..00000000 Binary files a/assets/images/powerd-by2.jpg and /dev/null differ diff --git a/assets/images/rectangle.png b/assets/images/rectangle.png deleted file mode 100644 index e4bdb0b6..00000000 Binary files a/assets/images/rectangle.png and /dev/null differ diff --git a/assets/images/robort.png b/assets/images/robort.png deleted file mode 100644 index 320afcbc..00000000 Binary files a/assets/images/robort.png and /dev/null differ diff --git a/assets/images/roboticon.png b/assets/images/roboticon.png deleted file mode 100644 index 5b04e287..00000000 Binary files a/assets/images/roboticon.png and /dev/null differ diff --git a/assets/images/search_medicine_icon.png b/assets/images/search_medicine_icon.png deleted file mode 100644 index 349620a5..00000000 Binary files a/assets/images/search_medicine_icon.png and /dev/null differ diff --git a/assets/images/siri-ianzhao.gif b/assets/images/siri-ianzhao.gif deleted file mode 100644 index 8d1c644f..00000000 Binary files a/assets/images/siri-ianzhao.gif and /dev/null differ diff --git a/assets/images/svg/discount_ar.svg b/assets/images/svg/discount_ar.svg deleted file mode 100644 index d9d6ec27..00000000 --- a/assets/images/svg/discount_ar.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - مصخ - - - - diff --git a/assets/images/svg/discount_en.svg b/assets/images/svg/discount_en.svg deleted file mode 100644 index 294cf19c..00000000 --- a/assets/images/svg/discount_en.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/svg/symptom.svg b/assets/images/svg/symptom.svg deleted file mode 100644 index aa670da1..00000000 --- a/assets/images/svg/symptom.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/images/svg/tamara.svg b/assets/images/svg/tamara.svg new file mode 100644 index 00000000..acc21074 --- /dev/null +++ b/assets/images/svg/tamara.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/images/test-weight.png b/assets/images/test-weight.png deleted file mode 100644 index 934b2467..00000000 Binary files a/assets/images/test-weight.png and /dev/null differ diff --git a/assets/images/undraw_connected_world_wuay.png b/assets/images/undraw_connected_world_wuay.png deleted file mode 100644 index f1bd3f00..00000000 Binary files a/assets/images/undraw_connected_world_wuay.png and /dev/null differ diff --git a/assets/images/weight_icon.png b/assets/images/weight_icon.png deleted file mode 100644 index 5c640114..00000000 Binary files a/assets/images/weight_icon.png and /dev/null differ diff --git a/assets/tracker/devices.png b/assets/tracker/devices.png deleted file mode 100644 index f00f9d95..00000000 Binary files a/assets/tracker/devices.png and /dev/null differ diff --git a/google-services_HMG.json b/google-services_HMG.json old mode 100755 new mode 100644 diff --git a/heartrate_icon.png b/heartrate_icon.png deleted file mode 100644 index e228bea4..00000000 Binary files a/heartrate_icon.png and /dev/null differ diff --git a/help/.gitignore b/help/.gitignore deleted file mode 100644 index 9d532b18..00000000 --- a/help/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json diff --git a/help/.metadata b/help/.metadata deleted file mode 100644 index 107fcb7b..00000000 --- a/help/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 8874f21e79d7ec66d0457c7ab338348e31b17f1d - channel: stable - -project_type: app diff --git a/help/README.md b/help/README.md deleted file mode 100644 index 4ac021c0..00000000 --- a/help/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# help - -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/help/android/.gitignore b/help/android/.gitignore deleted file mode 100644 index 0a741cb4..00000000 --- a/help/android/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java - -# Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app -key.properties diff --git a/help/android/app/build.gradle b/help/android/app/build.gradle deleted file mode 100644 index f44ed6c9..00000000 --- a/help/android/app/build.gradle +++ /dev/null @@ -1,63 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 29 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.help" - minSdkVersion 16 - targetSdkVersion 29 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/help/android/app/src/debug/AndroidManifest.xml b/help/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index fa2c5cd4..00000000 --- a/help/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/help/android/app/src/main/AndroidManifest.xml b/help/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 125d6242..00000000 --- a/help/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt b/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt deleted file mode 100644 index 75298a08..00000000 --- a/help/android/app/src/main/kotlin/com/example/help/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.help - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/help/android/app/src/main/res/drawable/launch_background.xml b/help/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f8..00000000 --- a/help/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/help/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/help/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/help/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/help/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/help/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/help/android/app/src/main/res/values/styles.xml b/help/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 1f83a33f..00000000 --- a/help/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/help/android/app/src/profile/AndroidManifest.xml b/help/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index fa2c5cd4..00000000 --- a/help/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/help/android/build.gradle b/help/android/build.gradle deleted file mode 100644 index 3100ad2d..00000000 --- a/help/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/help/android/gradle.properties b/help/android/gradle.properties deleted file mode 100644 index 94adc3a3..00000000 --- a/help/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/help/android/gradle/wrapper/gradle-wrapper.properties b/help/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 296b146b..00000000 --- a/help/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Jun 23 08:50:38 CEST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/help/android/settings.gradle b/help/android/settings.gradle deleted file mode 100644 index 44e62bcf..00000000 --- a/help/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/help/ios/.gitignore b/help/ios/.gitignore deleted file mode 100644 index e96ef602..00000000 --- a/help/ios/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -*.mode1v3 -*.mode2v3 -*.moved-aside -*.pbxuser -*.perspectivev3 -**/*sync/ -.sconsign.dblite -.tags* -**/.vagrant/ -**/DerivedData/ -Icon? -**/Pods/ -**/.symlinks/ -profile -xcuserdata -**/.generated/ -Flutter/App.framework -Flutter/Flutter.framework -Flutter/Flutter.podspec -Flutter/Generated.xcconfig -Flutter/app.flx -Flutter/app.zip -Flutter/flutter_assets/ -Flutter/flutter_export_environment.sh -ServiceDefinitions.json -Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!default.mode1v3 -!default.mode2v3 -!default.pbxuser -!default.perspectivev3 diff --git a/help/ios/Flutter/AppFrameworkInfo.plist b/help/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index f2872cf4..00000000 --- a/help/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 9.0 - - diff --git a/help/ios/Flutter/Debug.xcconfig b/help/ios/Flutter/Debug.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/help/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/help/ios/Flutter/Release.xcconfig b/help/ios/Flutter/Release.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/help/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/help/ios/Runner.xcodeproj/project.pbxproj b/help/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 4f158fea..00000000 --- a/help/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,495 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = ""; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1100; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.help; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.help; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.help; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/help/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/help/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index a28140cf..00000000 --- a/help/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/help/ios/Runner.xcworkspace/contents.xcworkspacedata b/help/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/help/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/help/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index f9b0d7c5..00000000 --- a/help/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PreviewsEnabled - - - diff --git a/help/ios/Runner/AppDelegate.swift b/help/ios/Runner/AppDelegate.swift deleted file mode 100644 index 70693e4a..00000000 --- a/help/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d36b1fab..00000000 --- a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/help/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 0bedcf2f..00000000 --- a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b..00000000 --- a/help/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/help/ios/Runner/Base.lproj/LaunchScreen.storyboard b/help/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f2e259c7..00000000 --- a/help/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/help/ios/Runner/Base.lproj/Main.storyboard b/help/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516..00000000 --- a/help/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/help/ios/Runner/Info.plist b/help/ios/Runner/Info.plist deleted file mode 100644 index 71ce57cb..00000000 --- a/help/ios/Runner/Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - help - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - < key >NSCameraUsageDescription< /key > - < string >Camera permission is required for barcode scanning.< /string > - - diff --git a/help/ios/Runner/Runner-Bridging-Header.h b/help/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 308a2a56..00000000 --- a/help/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" diff --git a/help/lib/main.dart b/help/lib/main.dart deleted file mode 100644 index 11655b66..00000000 --- a/help/lib/main.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; - -void main() { - runApp(MyApp()); -} - -class MyApp extends StatelessWidget { - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, - // This makes the visual density adapt to the platform that you run - // the app on. For desktop platforms, the controls will be smaller and - // closer together (more dense) than on mobile platforms. - visualDensity: VisualDensity.adaptivePlatformDensity, - ), - home: MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - final String title; - - @override - _MyHomePageState createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); - } -} diff --git a/help/pubspec.yaml b/help/pubspec.yaml deleted file mode 100644 index 66af3d9e..00000000 --- a/help/pubspec.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: help -description: A new Flutter project. - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 - -environment: - sdk: ">=2.7.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 - -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. - uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/help/test/widget_test.dart b/help/test/widget_test.dart deleted file mode 100644 index 9ca1523f..00000000 --- a/help/test/widget_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import '../lib/main.dart'; - - - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index d070415c..53427e0c 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -e52eba3667a38bec777870899c15ae7d \ No newline at end of file +3f8c659591fcdd0e47e3895f74af395c \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 9fbc2933..46c98373 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -42,6 +42,7 @@ target 'Runner' do # Native Pods pod 'NVActivityIndicatorView' + pod 'OpenTok' # Flutter Pod diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2ce396c4..565b2db9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -370,6 +370,10 @@ PODS: - Flutter - flutter_tts (0.0.1): - Flutter + - flutter_webrtc (0.2.2): + - Flutter + - GoogleWebRTC (= 1.1.31999) + - Libyuv (= 1703) - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) @@ -410,6 +414,7 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (6.7.2): - GoogleUtilities/Logger + - GoogleWebRTC (1.1.31999) - "gRPC-C++ (1.28.2)": - "gRPC-C++/Implementation (= 1.28.2)" - "gRPC-C++/Interface (= 1.28.2)" @@ -438,14 +443,21 @@ PODS: - Flutter - "huawei_location (5.0.0+301)": - Flutter + - "huawei_map (5.0.3+303)": + - Flutter - image_cropper (0.0.3): - Flutter - TOCropViewController (~> 2.5.4) - image_picker (0.0.1): - Flutter + - in_app_review (0.2.0): + - Flutter + - in_app_update (0.0.1): + - Flutter - just_audio (0.0.1): - Flutter - leveldb-library (1.22) + - Libyuv (1703) - local_auth (0.0.1): - Flutter - location (0.0.1): @@ -469,6 +481,7 @@ PODS: - NVActivityIndicatorView (5.1.1): - NVActivityIndicatorView/Base (= 5.1.1) - NVActivityIndicatorView/Base (5.1.1) + - OpenTok (2.20.0) - path_provider (0.0.1): - Flutter - path_provider_linux (0.0.1): @@ -562,12 +575,16 @@ DEPENDENCIES: - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) + - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`) - geolocator (from `.symlinks/plugins/geolocator/ios`) - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - huawei_location (from `.symlinks/plugins/huawei_location/ios`) + - huawei_map (from `.symlinks/plugins/huawei_map/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) + - in_app_review (from `.symlinks/plugins/in_app_review/ios`) + - in_app_update (from `.symlinks/plugins/in_app_update/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) - location (from `.symlinks/plugins/location/ios`) @@ -577,6 +594,7 @@ DEPENDENCIES: - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - nfc_in_flutter (from `.symlinks/plugins/nfc_in_flutter/ios`) - NVActivityIndicatorView + - OpenTok - path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) @@ -624,12 +642,15 @@ SPEC REPOS: - GoogleDataTransport - GoogleMaps - GoogleUtilities + - GoogleWebRTC - "gRPC-C++" - gRPC-Core - leveldb-library + - Libyuv - MTBBarcodeScanner - nanopb - NVActivityIndicatorView + - OpenTok - PromisesObjC - Protobuf - Reachability @@ -688,6 +709,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" flutter_tts: :path: ".symlinks/plugins/flutter_tts/ios" + flutter_webrtc: + :path: ".symlinks/plugins/flutter_webrtc/ios" geolocator: :path: ".symlinks/plugins/geolocator/ios" google_maps_flutter: @@ -696,10 +719,16 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/hexcolor/ios" huawei_location: :path: ".symlinks/plugins/huawei_location/ios" + huawei_map: + :path: ".symlinks/plugins/huawei_map/ios" image_cropper: :path: ".symlinks/plugins/image_cropper/ios" image_picker: :path: ".symlinks/plugins/image_picker/ios" + in_app_review: + :path: ".symlinks/plugins/in_app_review/ios" + in_app_update: + :path: ".symlinks/plugins/in_app_update/ios" just_audio: :path: ".symlinks/plugins/just_audio/ios" local_auth: @@ -808,6 +837,7 @@ SPEC CHECKSUMS: flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d + flutter_webrtc: 39898454258b54ba51996850d5da8d5d53bf1524 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a geolocator: f5e3de65e241caba7ce3e8a618803387bda73384 google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 @@ -815,14 +845,19 @@ SPEC CHECKSUMS: GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 + GoogleWebRTC: b39a78c4f5cc6b0323415b9233db03a2faa7b0f0 "gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2 gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5 hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 huawei_location: a1c3d2a029138b3d0b9a72ce910ffae3ff23c1aa + huawei_map: 34fbad9c274ea78a4151487c9ebe27f1887777e7 image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541 + in_app_update: 16e877e205f4360264cb536e3a6481f0d90299e1 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 + Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 @@ -833,6 +868,7 @@ SPEC CHECKSUMS: native_device_orientation: e24d00be281de72996640885d80e706142707660 nfc_in_flutter: c656fbfb1ec5b9d021da87b0c87629d62fd5264d NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 + OpenTok: 414c2c1dc6486f1897015e4d1703558d5eed48c3 path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 @@ -869,6 +905,6 @@ SPEC CHECKSUMS: webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: 900f7dc480de5b961c031ed418407e0e40ed455c +PODFILE CHECKSUM: df22e8ed6009dd48559053927dc365d6dad6c11f COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e4453fa6..6c02c983 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 301C79AE27200D9F0016307B /* OpenTokRemoteVideoFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */; }; + 301C79B027200DED0016307B /* OpenTokLocalVideoFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */; }; + 306FE6C8271D790C002D6EFC /* OpenTokPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */; }; + 306FE6CB271D8B73002D6EFC /* OpenTok.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6CA271D8B73002D6EFC /* OpenTok.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */; }; @@ -50,6 +54,10 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokRemoteVideoFactory.swift; sourceTree = ""; }; + 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokLocalVideoFactory.swift; sourceTree = ""; }; + 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokPlatformBridge.swift; sourceTree = ""; }; + 306FE6CA271D8B73002D6EFC /* OpenTok.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTok.swift; sourceTree = ""; }; 308FEC658188F7D588BE7580 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -99,6 +107,16 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 306FE6C9271D8B54002D6EFC /* OpenTok */ = { + isa = PBXGroup; + children = ( + 306FE6CA271D8B73002D6EFC /* OpenTok.swift */, + 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */, + 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */, + ); + path = OpenTok; + sourceTree = ""; + }; 555EAAA626EFB641859EF0BE /* Frameworks */ = { isa = PBXGroup; children = ( @@ -153,6 +171,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 306FE6C9271D8B54002D6EFC /* OpenTok */, E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */, E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */, E91B5390256AAA6500E96549 /* Controllers */, @@ -182,6 +201,7 @@ E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */, E923EFD3258645C100E3E751 /* HMG_Geofence.swift */, E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */, + 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */, E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */, ); path = Helper; @@ -375,16 +395,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 306FE6C8271D790C002D6EFC /* OpenTokPlatformBridge.swift in Sources */, E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */, E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */, E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */, E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, + 301C79AE27200D9F0016307B /* OpenTokRemoteVideoFactory.swift in Sources */, E9F7623B25922BCE00FB5CCF /* FlutterConstants.swift in Sources */, + 306FE6CB271D8B73002D6EFC /* OpenTok.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 301C79B027200DED0016307B /* OpenTokLocalVideoFactory.swift in Sources */, E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */, E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, E91B5397256AAA6500E96549 /* Extensions.swift in Sources */, diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index c4a74c80..35a3c022 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -14,7 +14,7 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil GMSServices.provideAPIKey("AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw") GeneratedPluginRegistrant.register(with: self) - initializePlatformChannel() + initializePlatformChannels() if let _ = launchOptions?[.location] { HMG_Geofence.initGeofencing() @@ -25,14 +25,16 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil } - func initializePlatformChannel(){ + func initializePlatformChannels(){ if let mainViewController = window.rootViewController as? MainFlutterVC{ // platform initialization suppose to be in foreground flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) }else if let mainViewController = initialViewController(){ // platform initialization suppose to be in background flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) } } diff --git a/ios/Runner/Helper/HMGPlatformBridge.swift b/ios/Runner/Helper/HMGPlatformBridge.swift index f94f9b34..fd9fb401 100644 --- a/ios/Runner/Helper/HMGPlatformBridge.swift +++ b/ios/Runner/Helper/HMGPlatformBridge.swift @@ -10,7 +10,7 @@ import NetworkExtension import SystemConfiguration.CaptiveNetwork var flutterMethodChannel:FlutterMethodChannel? = nil -var mainViewController:MainFlutterVC! +fileprivate var mainViewController:MainFlutterVC! class HMGPlatformBridge{ private let channelName = "HMG-Platform-Bridge" diff --git a/ios/Runner/Helper/OpenTokPlatformBridge.swift b/ios/Runner/Helper/OpenTokPlatformBridge.swift new file mode 100644 index 00000000..38e826e1 --- /dev/null +++ b/ios/Runner/Helper/OpenTokPlatformBridge.swift @@ -0,0 +1,59 @@ +// +// HMGPlatformBridge.swift +// Runner +// +// Created by ZiKambrani on 14/12/2020. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.CaptiveNetwork +import OpenTok + + +fileprivate var openTok:OpenTok? + +class OpenTokPlatformBridge : NSObject{ + private var methodChannel:FlutterMethodChannel? = nil + private var mainViewController:MainFlutterVC! + private static var shared_:OpenTokPlatformBridge? + + class func initialize(flutterViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ + shared_ = OpenTokPlatformBridge() + shared_?.mainViewController = flutterViewController + + shared_?.openChannel() + openTok = OpenTok(mainViewController: flutterViewController, registrar: registrar) + } + + func shared() -> OpenTokPlatformBridge{ + assert((OpenTokPlatformBridge.shared_ != nil), "OpenTokPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.") + return OpenTokPlatformBridge.shared_! + } + + private func openChannel(){ + methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) + methodChannel?.setMethodCallHandler { (call, result) in + print("Called function \(call.method)") + + switch(call.method) { + case "initSession": + openTok?.initSession(call: call, result: result) + + case "swapCamera": + openTok?.swapCamera(call: call, result: result) + + case "toggleAudio": + openTok?.toggleAudio(call: call, result: result) + + case "toggleVideo": + openTok?.toggleVideo(call: call, result: result) + + default: + result(FlutterMethodNotImplemented) + } + + print("") + } + } +} diff --git a/ios/Runner/OpenTok/OpenTok.swift b/ios/Runner/OpenTok/OpenTok.swift new file mode 100644 index 00000000..9cc0b79a --- /dev/null +++ b/ios/Runner/OpenTok/OpenTok.swift @@ -0,0 +1,179 @@ +// +// OpenTok.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 18/10/2021. +// + +import Foundation +import OpenTok +import UIKit + +enum SdkState: String { + case loggedOut = "LOGGED_OUT" + case loggedIn = "LOGGED_IN" + case wait = "WAIT" + case error = "ERROR" +} + +class OpenTok : NSObject{ + private var mainViewController:MainFlutterVC! + private var registrar:FlutterPluginRegistrar? + var methodChannel: FlutterMethodChannel? + + init(mainViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ + self.mainViewController = mainViewController + self.methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) + self.registrar = registrar + + let remoteVDOFactory = OpenTokRemoteVideoFactory(messenger: registrar!.messenger()) + registrar?.register(remoteVDOFactory, withId: "remote-video-container") + + let localVDOFactory = OpenTokLocalVideoFactory(messenger: registrar!.messenger()) + registrar?.register(localVDOFactory, withId: "local-video-container") + } + + var otSession: OTSession? + + var subscriber: OTSubscriber? + lazy var publisher: OTPublisher = { + let settings = OTPublisherSettings() + settings.name = UIDevice.current.name + return OTPublisher(delegate: self, settings: settings)! + }() + + func initSession(call:FlutterMethodCall, result: @escaping FlutterResult){ + if let arguments = call.arguments as? [String: String], + let apiKey = arguments["apiKey"], + let sessionId = arguments["sessionId"], + let token = arguments["token"]{ + + var error: OTError? + defer { + // todo + } + + notifyFlutter(state: SdkState.wait) + otSession = OTSession(apiKey: apiKey, sessionId: sessionId, delegate: self)! + otSession?.connect(withToken: token, error: &error) + + result("") + }else{ + + } + + } + + + func swapCamera(call:FlutterMethodCall, result: @escaping FlutterResult) { + if publisher.cameraPosition == .front { + publisher.cameraPosition = .back + } else { + publisher.cameraPosition = .front + } + result("") + } + + func toggleAudio(call:FlutterMethodCall, result: @escaping FlutterResult) { + if let arguments = call.arguments as? [String: Bool], + let publishAudio = arguments["publishAudio"] { + publisher.publishAudio = !publisher.publishAudio + } + result("") + } + + func toggleVideo(call:FlutterMethodCall, result: @escaping FlutterResult) { + if let arguments = call.arguments as? [String: Bool], + let publishVideo = arguments["publishVideo"] { + publisher.publishVideo = !publisher.publishVideo + } + result("") + } + + + func notifyFlutter(state: SdkState) { + methodChannel?.invokeMethod("updateState", arguments: state.rawValue) + } + +} + +extension OpenTok: OTSessionDelegate { + func sessionDidConnect(_ sessionDelegate: OTSession) { + print("The client connected to the session.") + notifyFlutter(state: SdkState.loggedIn) + + var error: OTError? + defer { + // todo + } + + self.otSession?.publish(self.publisher, error: &error) + + if let pubView = self.publisher.view { + pubView.frame = CGRect(x: 0, y: 0, width: 200, height: 300) + + if OpenTokLocalVideoFactory.view == nil { + OpenTokLocalVideoFactory.viewToAddPub = pubView + } else { + OpenTokLocalVideoFactory.view?.addPublisherView(pubView) + } + } + } + + func sessionDidDisconnect(_ session: OTSession) { + print("The client disconnected from the session.") + notifyFlutter(state: SdkState.loggedOut) + } + + func session(_ session: OTSession, didFailWithError error: OTError) { + print("The client failed to connect to the session: \(error).") + } + + func session(_ session: OTSession, streamCreated stream: OTStream) { + print("A stream was created in the session.") + var error: OTError? + defer { + // todo + } + subscriber = OTSubscriber(stream: stream, delegate: self) + + session.subscribe(subscriber!, error: &error) + } + + func session(_ session: OTSession, streamDestroyed stream: OTStream) { + print("A stream was destroyed in the session.") + } +} + +extension OpenTok: OTPublisherDelegate { + func publisher(_ publisher: OTPublisherKit, streamCreated stream: OTStream) { + } + + func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) { + } + + func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) { + print("Publisher failed: \(error.localizedDescription)") + } +} + +extension OpenTok: OTSubscriberDelegate { + func subscriberDidConnect(toStream subscriberKit: OTSubscriberKit) { + print("Subscriber connected") + + if let subView = self.subscriber?.view { + subView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) + + if OpenTokRemoteVideoFactory.view == nil { + OpenTokRemoteVideoFactory.viewToAddSub = subView + } else { + OpenTokRemoteVideoFactory.view?.addSubscriberView(subView) + } + } + } + + func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) { + print("Subscriber failed: \(error.localizedDescription)") + } + +} diff --git a/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift b/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift new file mode 100644 index 00000000..361b482d --- /dev/null +++ b/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift @@ -0,0 +1,91 @@ +// +// OpenTokLocalVideoFactory.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 20/10/2021. +// + +import Foundation + +class OpenTokLocalVideoFactory: NSObject, FlutterPlatformViewFactory { + static var view: LocalVideoPlatformView? + + static var viewToAddPub: UIView? + + static func getViewInstance( + frame: CGRect, + viewId: Int64, + args: Any?, + messenger: FlutterBinaryMessenger? + ) -> LocalVideoPlatformView{ + if(view == nil) { + view = LocalVideoPlatformView() + if viewToAddPub != nil { + view?.addPublisherView(viewToAddPub!) + } + } + + return view! + } + + private var messenger: FlutterBinaryMessenger + + init(messenger: FlutterBinaryMessenger) { + self.messenger = messenger + super.init() + } + + func create( + withFrame frame: CGRect, + viewIdentifier viewId: Int64, + arguments args: Any? + ) -> FlutterPlatformView { + return OpenTokLocalVideoFactory.getViewInstance( + frame: frame, + viewId: viewId, + args: args, + messenger: messenger) + } +} + +class LocalVideoPlatformView: NSObject, FlutterPlatformView { + private let videoContainer: LocalVideoContainer + + override init() { + videoContainer = LocalVideoContainer() + super.init() + } + + public func addPublisherView(_ view: UIView) { + videoContainer.addPublisherView(view) + } + + func view() -> UIView { + return videoContainer + } +} + +final class LocalVideoContainer: UIView { + private let publisherContainer = UIView() + + init() { + super.init(frame: .zero) + addSubview(publisherContainer) + } + + public func addPublisherView(_ view: UIView) { + publisherContainer.addSubview(view) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + let width = frame.width + let height = frame.height + + publisherContainer.frame = CGRect(x: 0, y: 0, width: width, height: height) + } +} diff --git a/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift b/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift new file mode 100644 index 00000000..50dcf695 --- /dev/null +++ b/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift @@ -0,0 +1,91 @@ +// +// OpenTokRemoteVideoFactory.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 20/10/2021. +// + +import Foundation + +class OpenTokRemoteVideoFactory: NSObject, FlutterPlatformViewFactory { + static var view: RemoteVideoPlatformView? + + static var viewToAddSub: UIView? + + static func getViewInstance( + frame: CGRect, + viewId: Int64, + args: Any?, + messenger: FlutterBinaryMessenger? + ) -> RemoteVideoPlatformView{ + if(view == nil) { + view = RemoteVideoPlatformView() + if viewToAddSub != nil { + view?.addSubscriberView(viewToAddSub!) + } + } + + return view! + } + + private var messenger: FlutterBinaryMessenger + + init(messenger: FlutterBinaryMessenger) { + self.messenger = messenger + super.init() + } + + func create( + withFrame frame: CGRect, + viewIdentifier viewId: Int64, + arguments args: Any? + ) -> FlutterPlatformView { + return OpenTokRemoteVideoFactory.getViewInstance( + frame: frame, + viewId: viewId, + args: args, + messenger: messenger) + } +} + +class RemoteVideoPlatformView: NSObject, FlutterPlatformView { + private let videoContainer: RemoteVideoContainer + + override init() { + videoContainer = RemoteVideoContainer() + super.init() + } + + public func addSubscriberView(_ view: UIView) { + videoContainer.addSubscriberView(view) + } + + func view() -> UIView { + return videoContainer + } +} + +final class RemoteVideoContainer: UIView { + private let subscriberContainer = UIView() + + init() { + super.init(frame: .zero) + addSubview(subscriberContainer) + } + + + public func addSubscriberView(_ view: UIView) { + subscriberContainer.addSubview(view) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + let width = frame.width + let height = frame.height + subscriberContainer.frame = CGRect(x: 0, y: 0, width: width, height: height) + } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index 660559d3..c4fabca6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,24 +6,33 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; const MAX_SMALL_SCREEN = 660; // PACKAGES and OFFERS -const EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000'; +const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/offersdiscounts'; +// const EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000'; const PACKAGES_CATEGORIES = '/api/categories'; +const PACKAGES_TOKEN = '/api/token'; const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; - +const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs -// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -// Pharmacy Production URLs +// // Pharmacy Production URLs const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +// // Pharmacy Pre-Production URLs +// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapitest/api/'; +// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapitest/api/'; + +// RC API URL +const RC_BASE_URL = 'https://livecare.hmg.com/'; + const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; @@ -100,8 +109,11 @@ const SEND_RAD_REPORT_EMAIL = ///Feedback const SEND_FEEDBACK = 'Services/COCWS.svc/REST/InsertCOCItemInSPList'; const GET_STATUS_FOR_COCO = 'Services/COCWS.svc/REST/GetStatusforCOC'; +// const GET_PATIENT_AppointmentHistory = 'Services' +// '/Doctors.svc/REST/PateintHasAppoimentHistory'; + const GET_PATIENT_AppointmentHistory = 'Services' - '/Doctors.svc/REST/PateintHasAppoimentHistory'; + '/Doctors.svc/REST/PateintHasAppoimentHistory_Async'; ///VITAL SIGN const GET_PATIENT_VITAL_SIGN = @@ -134,16 +146,15 @@ const INSERT_ER_INERT_PRES_ORDER = /// ER RRT const GET_ALL_RC_TRANSPORTATION = 'rc/api/Transportation/getalltransportation'; const GET_ALL_TRANSPORTATIONS_RC = 'rc/api/Transportation/getalltransportation'; - -const GET_ALL_TRANSPORTATIONS_ORDERS = 'rc/api/Transportation/get'; - -const CANCEL_AMBULANCE_REQUEST = "rc/api/Transportation/update"; - const GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; const GET_RRT_SERVICE_PRICE = 'Services/Patients.svc/REST/PatientE_RealRRT_GetServicePrice'; +const GET_ALL_TRANSPORTATIONS_ORDERS = 'rc/api/Transportation/get'; + +const CANCEL_AMBULANCE_REQUEST = "rc/api/Transportation/update"; + const INSERT_TRANSPORTATION_ORDER_RC = "rc/api/Transportation/add"; ///FindUs @@ -202,17 +213,18 @@ const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; ///Rate +// const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; const IS_LAST_APPOITMENT_RATED = - 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; + 'Services/Doctors.svc/REST/IsLastAppoitmentRated_Async'; const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; +const NEW_RATE_APPOINTMENT_URL = + "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate"; +const NEW_RATE_DOCTOR_URL = + "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate"; const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; -//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment -//const BASE_URL = 'https://hmgwebservices.com/Services'; // Production Environment -//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment - //URL to get clinic list const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; @@ -255,8 +267,9 @@ const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; //URL to get patient appointment curfew history +// const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = - "Services/Doctors.svc/REST/AppoimentHistoryForCurfew"; + "Services/Doctors.svc/REST/AppoimentHistoryForCurfew_Async"; //URL to confirm appointment const CONFIRM_APPOINTMENT = @@ -333,6 +346,9 @@ const CANCEL_LIVECARE_REQUEST = const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoiceForLiveCare'; +const APPLE_PAY_INSERT_REQUEST = + 'Services/PayFort_Serv.svc/REST/PayFort_ApplePayRequestData_Insert'; + const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; const UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; @@ -346,6 +362,8 @@ const SEND_CHECK_IN_NFC_REQUEST = const HAS_DENTAL_PLAN = 'Services/Doctors.svc/REST/Dental_IsPatientHasOnGoingEstimation'; +const LASER_BODY_PARTS = 'Services/Patients.svc/REST/Laser_GetBodyPartsByCategory'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; @@ -379,7 +397,8 @@ const UPLOAD_INSURANCE_CARD = const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; const GET_PAtIENTS_INSURANCE_APPROVALS = - "Services/Patients.svc/REST/GetApprovalStatus_DWH"; + "Services/Patients.svc/REST/GetApprovalStatus_Async"; +// const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; const GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS"; @@ -415,6 +434,8 @@ const GET_COVID_DRIVETHRU_PROCEDURES_LIST = ///Smartwatch Integration Services const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; +const INSERT_PATIENT_HEALTH_DATA = + 'Services/Patients.svc/REST/Med_InsertTransactions'; ///My Trackers const GET_DIABETIC_RESULT_AVERAGE = @@ -514,7 +535,7 @@ const PHARMACY_AUTORZIE_CUSTOMER = "AutorizeCustomer"; const PHARMACY_VERIFY_CUSTOMER = "VerifyCustomer"; const PHARMACY_GET_COUNTRY = "countries"; // const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/CreateCustomer"; -const PHARMACY_CREATE_CUSTOMER = "epharmacy/api/getorcreateCustomer"; +const PHARMACY_CREATE_CUSTOMER = "getorcreateCustomer"; const GET_PHARMACY_BANNER = "promotionbanners"; const GET_PHARMACY_TOP_MANUFACTURER = "topmanufacturer"; const GET_PHARMACY_BEST_SELLER_PRODUCT = "bestsellerproducts"; @@ -524,7 +545,7 @@ const GET_CUSTOMERS_ADDRESSES = "Customers/"; const SUBSCRIBE_PRODUCT = "subscribe?"; const GET_ORDER = "orders?"; const GET_ORDER_DETAILS = "orders/"; -const ADD_CUSTOMER_ADDRESS = "epharmacy/api/addcustomeraddress"; +const ADD_CUSTOMER_ADDRESS = "addcustomeraddress"; const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; const GET_ADDRESS = "Customers/"; @@ -580,6 +601,29 @@ const BLOOD_DONATION_REGISTER_BLOOD_TYPE = const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; +// HHC RC SERVICES +const HHC_GET_ALL_SERVICES_RC = "rc/api/HHC/getallhhc"; +const ADD_HHC_ORDER_RC = "rc/api/HHC/add"; +const GET_ALL_HHC_ORDERS_RC = 'rc/api/hhc/list'; +const UPDATE_HHC_ORDER_RC = 'rc/api/hhc/update'; + +// CMC RC SERVICES +const GET_ALL_CMC_SERVICES_RC = 'rc/api/cmc/getallcmc'; +const ADD_CMC_ORDER_RC = 'rc/api/cmc/add'; +const GET_ALL_CMC_ORDERS_RC = 'rc/api/cmc/list'; +const UPDATE_CMC_ORDER_RC = 'rc/api/cmc/update'; + +// RRT RC SERVICES +const ADD_RRT_ORDER_RC = "rc/api/rrt/add"; +const GET_ALL_RRT_ORDERS_RC = "rc/api/rrt/list"; +const UPDATE_RRT_ORDER_RC = 'rc/api/rrt/update'; + +// PRESCRIPTION RC SERVICES +const ADD_PRESCRIPTION_ORDER_RC = "rc/api/prescription/add"; +const GET_ALL_PRESCRIPTION_ORDERS_RC = "rc/api/prescription/list"; +const GET_ALL_PRESCRIPTION_INFO_RC = "rc/api/Prescription/info"; +const UPDATE_PRESCRIPTION_ORDER_RC = 'rc/api/prescription/update'; + //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id="; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 25f236cd..56113044 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -2,45 +2,23 @@ // Used for Native through Platform Method Channel // --------- - -- - - - - - - - - ---------------- const Map platformLocalizedValues = { - "errorConnectingHmgNetwork": { - "en": "Sorry you are not connecting to HMG network", - "ar": "نعتذر لست متصل في شكبة مستشفى د.سليمان الحبيب" - }, - "successConnectingHmgNetwork": { - "en": "You connected to HMG network successfully, you can access the app", - "ar": - "تم التصال بشبكة د.سليمان الحبيب بنجاح, تستطيع الان استخدام تطبيق الحبيب" - }, + "errorConnectingHmgNetwork": {"en": "Sorry you are not connecting to HMG network", "ar": "نعتذر لست متصل في شكبة مستشفى د.سليمان الحبيب"}, + "successConnectingHmgNetwork": {"en": "You connected to HMG network successfully, you can access the app", "ar": "تم التصال بشبكة د.سليمان الحبيب بنجاح, تستطيع الان استخدام تطبيق الحبيب"}, "failedConnectingHmgNetwork": { - "en": - "Sorry the connection to HMG network had been failed, make sure you are in range of HMG network", - "ar": - "نعتذر لقد فشل الاتصال بشبكة د.سليمان الحبيب, تاكد من وجودك داخل نطاق الشبكة" - }, - "alreadyConnectedHmgNetwork": { - "en": " You already connected to HMG network to access Alhabib app", - "ar": "انت متصل مسبقاً بالشبكة تستطيع استخدام تطبيق الحبيب" - }, - "somethingWentWrong": { - "en": "Sorry something went wrong please try again later", - "ar": "نعتذر لخدمتكم يرجى المحاولة لاحقا" + "en": "Sorry the connection to HMG network had been failed, make sure you are in range of HMG network", + "ar": "نعتذر لقد فشل الاتصال بشبكة د.سليمان الحبيب, تاكد من وجودك داخل نطاق الشبكة" }, + "alreadyConnectedHmgNetwork": {"en": " You already connected to HMG network to access Alhabib app", "ar": "انت متصل مسبقاً بالشبكة تستطيع استخدام تطبيق الحبيب"}, + "somethingWentWrong": {"en": "Sorry something went wrong please try again later", "ar": "نعتذر لخدمتكم يرجى المحاولة لاحقا"}, "enablingWifi": {"en": "Enabling wifi...", "ar": "Enabling wifi..."}, - "connectedHmgNetworkWithInternet": { - "en": "Successfully connected to the HMG network to access internet", - "ar": "Successfully connected to the HMG network to access internet" - }, + "connectedHmgNetworkWithInternet": {"en": "Successfully connected to the HMG network to access internet", "ar": "Successfully connected to the HMG network to access internet"}, "connectedToHmgNetworkWithNoInternet": { - "en": - "Successfully connected to the HMG network but it have no internet access", - "ar": - "Successfully connected to the HMG network but it have no internet access" + "en": "Successfully connected to the HMG network but it have no internet access", + "ar": "Successfully connected to the HMG network but it have no internet access" }, "notConnectedToHmgNetworkSecurityIssue": { - "en": - "We are not able to connect you to HMG network due to security reasons", - "ar": - "We are not able to connect you to HMG network due to security reasons" + "en": "We are not able to connect you to HMG network due to security reasons", + "ar": "We are not able to connect you to HMG network due to security reasons" } }; @@ -61,47 +39,44 @@ const Map localizedValues = { 'bookAppo': {'en': 'Book Appointment', 'ar': 'حجز موعد'}, 'searchBy': {'en': 'Search By:', 'ar': 'البحث عن طريق:'}, 'clinic': {'en': 'Clinic', 'ar': 'العيادة'}, + 'by-clinic': {'en': 'By Clinic', 'ar': 'العيادة'}, 'hospital': {'en': 'Hospital', 'ar': 'المستشفى'}, + 'by-hospital': {'en': 'By Hospital', 'ar': 'المستشفى'}, 'name': {'en': 'Name', 'ar': 'الإسم'}, 'doctor': {'en': 'Doctor', 'ar': 'الطبيب'}, 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, 'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'}, - 'nearestAppo': {'en': 'Nearest appointment', 'ar': 'أقرب موعد'}, - 'searchByDocText': { - 'en': 'Type the name of the doctor to help you find him', - 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه' - }, + 'nearestAppo': {'en': 'Nearest Appointment', 'ar': 'أقرب موعد'}, + 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, - 'noResultFound': {'en': 'No Result Found', 'ar': 'المنتج غير موجود'}, - 'pleaseEnterProductName': { - 'en': 'Please Enter Product Name', - 'ar': 'ادخل اسم المنتج' - }, + 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج'}, + 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, 'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'}, 'availableAppo': {'en': 'Available Appointments', 'ar': 'المواعيد المتاحة'}, 'gender': {'en': 'Gender', 'ar': 'الجنس'}, 'nationality': {'en': 'Nationality', 'ar': 'الجنسية'}, + 'neverWait': {'en': 'Never wait in queue', 'ar': 'لا تنتظر في قائمة الانتظار'}, + 'reminderTitle': {'en': 'You have appointment with Dr. ', 'ar': 'لديك موعد مع د'}, + 'appointmentCalendar': {'en': 'Would you like to set a reminder for this appointment in your calendar?', 'ar': 'هل ترغب في إضافة تذكير لهذا الموعد في التقويم الخاص بك؟'}, + 'appointmentSuccess': {'en': 'Appointment is successfully booked', 'ar': 'تم حجز الموعد بنجاح'}, 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, - 'confirmAppoHeading': { - 'en': 'Kindly confirm your Appointment', - 'ar': 'يرجى تأكيد موعدك' - }, + 'pressAgain': {'en': 'Press again to exit the app', 'ar': 'اضغط مرة أخرى للخروج من التطبيق'}, + 'laserMaxLimitReach': {'en': "Maximum limit is 90 minutes", 'ar': "الحد الأقصى هو 90 دقيقة"}, + 'confirmAppoHeading': {'en': 'Kindly review your Appointment', 'ar': 'يرجى تأكيد موعدك'}, 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, + 'doctorFilter': {'en': 'Doctors will be filtered based on your gender and age', 'ar': 'سيتم تصفية الأطباء بناءً على جنسك وعمرك'}, 'bookSuccess': {'en': 'Book Success', 'ar': 'تم حجز الموعد بنجاح'}, - 'patientShare': {'en': 'Patient Share', 'ar': 'المبلغ المستحق'}, - 'patientShareWithTax': { - 'en': 'Patient Share with Tax', - 'ar': 'المبلغ الإجمالي المستحق' - }, + 'patientShare': {'en': 'Patient Share', 'ar': 'نسبة العميل'}, + 'patientShareWithTax': {'en': 'Patient Share with Tax', 'ar': 'المبلغ الإجمالي المستحق مع الضريبة'}, 'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'}, 'confirm': {'en': 'Confirm', 'ar': 'تأكيد'}, 'confirmLiveCare': {'en': 'Confirm LiveCare', 'ar': 'تأكيد لايف كير'}, 'waitingForDoctor': {'en': 'Waiting for doctor', 'ar': 'في انتظار الطبيب'}, 'appointment': {'en': 'Appointment', 'ar': 'الموعد'}, - 'confirmLater': {'en': 'Confirm Later', 'ar': 'تأكيد لاحقا'}, + 'confirmLater': {'en': 'Confirm Later', 'ar': 'التاكيد لاحقا'}, 'todoList': {'en': 'Todo List', 'ar': 'مهامي'}, 'appoActions': {'en': 'Appointment Actions', 'ar': 'إجراءات الموعد'}, 'date': {'en': 'Date', 'ar': 'التاريخ'}, @@ -112,46 +87,18 @@ const Map localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'تعليمات'}, 'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'}, 'livecareAppo': {'en': 'LiveCare Appointment', 'ar': 'الموعد لايف كير'}, - 'cancelAppoMsg': { - 'en': 'Are you sure you want to cancel this appointment?', - 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟' - }, - - 'upcoming-noAction': { - 'en': 'No Action Required', - 'ar': 'لا يوجد إجراء مطلوب' - }, - 'upcoming-confirm': { - 'en': 'Please confirm the appointment to avoid cancellation', - 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء' - }, - "book-success-confirm-more-24-1-2": { - "en": - "The online payment process will be available 24 hours before the appointment.", - "ar": "- عملية الدفع الالكتروني ستكون متاحة قبل الموعد ب 24 ساعة." - }, - 'upcoming-payment-pending': { - 'en': - 'Online Payment will be Activated before 24 Hours of Appointment Time', - 'ar': 'سيتم تفعيل خدمة الدفع الالكتروني قبل 24 ساعة من موعد الحجز' - }, - 'upcoming-payment-now': { - 'en': 'Pay Online now to avoid long waiting queue', - 'ar': 'ادفع الآن لتفادي الانتظار' - }, - 'upcoming-QR': { - 'en': 'Use the QR Code to Check-In in hospital', - 'ar': 'استخدم الرمز لتسجيل الحضور في المستشفى' - }, - 'upcoming-virtual': { - 'en': - 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', - 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.' - }, - 'upcoming-livecare': { - 'en': 'This is a LiveCare appointment', - 'ar': 'هذا موعد لايف كير' - }, + 'agreeTo': {'en': 'I agree 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': 'تغيير آلية الدفع'}, + 'upcoming-noAction': {'en': 'No Action Required', 'ar': 'لا يلزم اتخاذ أي إجراء'}, + 'upcoming-confirm': {'en': 'Please confirm the appointment to avoid cancellation', 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء'}, + "book-success-confirm-more-24-1-2": {"en": "The online payment process will be available 24 hours before the appointment.", "ar": "عملية الدفع الالكتروني ستكون متاحة قبل الموعد ب 24 ساعة."}, + 'upcoming-payment-pending': {'en': 'Online Payment will be Activated before 24 Hours of Appointment Time', 'ar': 'سيتم تفعيل خدمة الدفع الالكتروني قبل 24 ساعة من موعد الحجز'}, + 'upcoming-payment-now': {'en': 'Pay Online now to avoid long waiting queue', 'ar': 'ادفع الآن لتفادي طابور الانتظار'}, + 'upcoming-QR': {'en': 'Use the QR Code to Check-In in hospital', 'ar': 'استخدم الرمز لتسجيل الحضور بشكل آلي في المستشفى'}, + 'upcoming-virtual': {'en': 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.'}, + 'upcoming-livecare': {'en': 'This is a LiveCare appointment', 'ar': 'هذا موعد لايف كير'}, 'upcoming-details': {'en': 'More Details', 'ar': 'المزيد'}, 'reschedule': {'en': 'Reschedule', 'ar': 'إعادة جدولة'}, 'raise': {'en': 'Raise', 'ar': 'رفع'}, @@ -159,95 +106,63 @@ const Map localizedValues = { 'add': {'en': 'Add', 'ar': 'إضافة'}, 'reminder': {'en': 'Reminder', 'ar': 'تذكير'}, 'location': {'en': 'Locations', 'ar': 'مواقعنا'}, - 'online': {'en': 'Online', 'ar': 'الالكترونية'}, + 'online': {'en': 'Online', 'ar': 'الالكتروني'}, 'payment': {'en': 'Payment', 'ar': 'الدفع'}, + 'onlinePayment': {'en': 'Online', 'ar': 'الدفع'}, + 'onlinePaymentSubtitle': {'en': 'Payment', 'ar': 'الالكتروني'}, 'cancel-nocaps': {'en': 'Cancel', 'ar': 'الغاء'}, - 'set-reminder': {'en': 'Set Reminder', 'ar': 'تعيين تذكير'}, - - 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, - 'loginregister': {'en': 'Login / Register', 'ar': 'تسجيل الدخول'}, - 'poweredBy': {'en': 'Powered By', 'ar': 'مشغل بواسطة'}, + 'set-reminder': {'en': 'Set Reminder', 'ar': 'إضافة تذكير'}, + "national-id-number": {"en": "National ID Number", "ar": "رقم الهوية الوطنية / الاقامة"}, + "medical-file-number": {"en": "Medical File Number", "ar": "رقم الملف الطبي"}, + 'login': {'en': 'Login', 'ar': 'دخول'}, + 'loginregister': {'en': 'Login / Register', 'ar': 'دخول/ تسجيل'}, + 'poweredBy': {'en': 'Powered by', 'ar': 'مشغل بواسطة'}, "welcome": {"en": "Welcome", "ar": "مرحبا"}, - "welcome_text": { - "en": "Dr. Sulaiman Al Habib Mobile Application", - "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف المتحرك" - }, - 'welcome_text2': { - 'en': 'Have you visited AlHabib Medical Group before? ', - 'ar': 'هل قمت بزيارة مجموعة الحبيب الطبية من قبل؟' - }, + "welcome-to": {"en": "Welcome to", "ar": "مرحبا بك في"}, + "patient-app": {"en": "Patient App", "ar": "تطبيق المرضى"}, + "welcome_text": {"en": "Dr. Sulaiman Al Habib Mobile Application", "ar": "الدكتور سليمان الحبيب لتطبيقات الهاتف"}, + "dr-sulaiman-text": {"en": "Dr. Sulaiman Al Habib", "ar": "د. سليمان الحبيب"}, + 'welcome_text2': {'en': 'Have you visited AlHabib Medical Group before? ', 'ar': 'هل قمت بزيارة مجموعة الحبيب الطبية من قبل؟'}, 'yes': {'en': 'Yes', 'ar': 'نعم'}, 'no': {'en': 'No', 'ar': 'لا'}, - "logintyperadio": { - "en": "Choose from below options to login to your medical file.", - "ar": "اختر من الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي." - }, - "registernow": {"en": "Register Now", "ar": "تسجيل الان"}, - "nationalID": { - "en": "Enter the Identification Number", - "ar": "أدخل رقم الهوية الوطنية او الاقامة" - }, + "logintyperadio": {"en": " Choose from the below options to login to your medical file.", "ar": " اختر احدى الخيارات أدناه لتسجيل الدخول إلى ملفك الطبي "}, + "registernow": {"en": "Register Now", "ar": "سجل الان"}, + "nationalID": {"en": "Enter the Identification Number", "ar": "أدخل رقم الهوية الوطنية او الاقامة"}, "national-id": {"en": "National ID", "ar": "رقم الهوية"}, "fileNo": {"en": "File Number", "ar": "رقم الملف"}, "fileno": {"en": "File No", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, - "forgotFileNoTitle": {"en": "Forgot medical file", "ar": "نسيت رقم الملف"}, - - "enter-national-id": { - "en": "Please enter mobile number and identification number", - "ar": "الرجاء إدخال رقم الجوال ورقم الهوية" - }, - "profile-info": { - "en": "Please enter profile information", - "ar": "الرجاء إدخال معلومات الملف الشخصي" - }, + "forgotFileNoTitle": {"en": "Forgot medical file", "ar": "نسيت رقم الملف الطبي"}, + "enter-national-id": {"en": "Please enter mobile number and identification number", "ar": "الرجاء إدخال رقم الجوال ورقم الهوية"}, + "profile-info": {"en": "Please enter profile information", "ar": "الرجاء إدخال معلومات الملف الشخصي"}, "submit": {"en": "Submit", "ar": "ارسال"}, - "forgot-desc": { - "en": "Enter the mobile number to receive the Medical file Number via SMS", - "ar": "أدخل رقم الجوال المسجل لاستلام رقم الملف عن طريق الرسائل النصية" - }, + "forgot-desc": {"en": "Enter the mobile number to receive the Medical File Number via SMS", "ar": "أدخل رقم الجوال المسجل لاستلام رقم الملف عن طريق الرسائل النصية"}, "dob": {"en": "Birth Date:", "ar": "تاريخ الميلاد"}, "hijri-date": {"en": "Hijri Date", "ar": "التاريخ الهجري"}, "gregorian-date": {"en": "Gregorian Date", "ar": "التاريخ الميلادي"}, - "verify-login-with": { - "en": "Please choose one of the following options to verify", - "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" - }, + "verify-login-with": {"en": "Please choose one of the following options to verify", "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات"}, "register-user": {"en": "Register", "ar": "تسجيل"}, "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, "verify-with-sms": {"en": "SMS", "ar": "الرسائل القصيرة"}, "verify-with-whatsapp": {"en": "Whatsapp", "ar": " الواتس اب"}, + "verify-through": {"en": "Verify Through", "ar": " تحقق من خلال"}, "last-login": {"en": "LAST LOGIN AT:", "ar": "آخر تسجيل دخول"}, - "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "نوع التحقق:"}, + "last-login-with": {"en": "VERIFICATION TYPE:", "ar": "طريقة التحقق:"}, "verify-fingerprint": { - "en": - "To activate the fingerprint login service, please verify data by using one of the following options.", - "ar": - "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" + "en": "To activate the fingerprint login service, please verify data by using one of the following options.", + "ar": "لتفعيل خدمة الدخول بالبصمة، يرجى اختيار احدى القنوات التالية للتحقق من البيانات" }, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'البحث عن الدواء'}, - 'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدلايات'}, - 'searchMedicineHere': { - 'en': 'Search Medicine Here', - 'ar': 'ابحث عن الدواء هنا' - }, + 'pharmaciesList': {'en': 'Pharmacies List', 'ar': 'قائمة الصيدليات'}, + 'searchMedicineHere': {'en': 'Search Medicine Here', 'ar': 'ابحث عن الدواء هنا'}, 'description': {'en': 'Description', 'ar': 'الوصف'}, 'howToUse': {'en': 'How to Use', 'ar': 'طريقة الأستخدام'}, 'price': {'en': 'Price', 'ar': 'السعر'}, - 'youCanFindItIn': {'en': 'You can find it in', 'ar': 'يمكنكة ان تجده في'}, - 'pleaseEnterMedicineName': { - 'en': 'Please Enter Medicine Name', - 'ar': 'الرجائ ادخال اسم الدواء' - }, - "verification_message": { - "en": "Please enter the Verification Code sent to", - "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى" - }, - "validation_message": { - "en": "The verification code expires in", - "ar": "تنتهي صلاحية رمز التحقق خلال" - }, + 'youCanFindItIn': {'en': 'You can find it in', 'ar': 'يمكنك ان تجده في'}, + 'pleaseEnterMedicineName': {'en': 'Please Enter Medicine Name', 'ar': 'الرجاء ادخال اسم الدواء'}, + "verification_message": {"en": "Please enter the Verification Code sent to", "ar": "الرجاء ادخال رمز التحقق الذي تم إرساله إلى"}, + "validation_message": {"en": "The verification code expires in", "ar": "تنتهي صلاحية رمز التحقق خلال"}, "arabic-change": {"en": "عربي", "ar": "English"}, "notification": {"en": "Notifications", "ar": "إشعارات"}, "app-settings": {"en": "App Settings", "ar": "إعدادات التطبيق"}, @@ -255,86 +170,34 @@ const Map localizedValues = { "before": {"en": "Before", "ar": "قبل"}, "minute": {"en": "Minutes", "ar": "دقيقة"}, "hour": {"en": "Hour", "ar": "ساعة"}, - "reminderSuccess": { - "en": "The reminder has been added successfully", - "ar": "يضاف التذكير بنجاح" - }, - "patientShareToDo": { - "en": "Amount before tax: ", - "ar": "المبلغ قبل الضريبة:" - }, + "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"}, + "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, - "patientShareTotalToDo": { - "en": "Total amount Due: ", - "ar": "المبلغ الإجمالي المستحق:" - }, + "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, 'paymentMethod': {'en': 'Payment Method', 'ar': 'طريقة الدفع او السداد'}, - 'noNeedToWaitInLine': { - 'en': 'No need to stand in line.', - 'ar': 'لا داعي للوقوف في الطابور.' - }, - 'useQRAppoAttend': { - 'en': 'Use the QR code to register the appointment attendance.', - 'ar': 'استخدم الكود لتسجيل الحضور في المستشفى.' - }, - 'passQRAppoAttend': { - 'en': - 'Pass the QR code through the attendance devices available in the Hospital.', - 'ar': 'تمرير الكود من خلال اجهزة تسجيل الحضور المتوفرة في الفرع.' - }, - 'sitWaitingQR': { - 'en': 'Sit in the waiting rooms until called by the nurse.', - 'ar': 'الجلوس في غرف الانتظار لحين منادتك من قبل الممرضة.' - }, - 'attendRegisterCode': { - 'en': 'Attendance registration code', - 'ar': 'رمز تسجيل الحضور' - }, - 'scanQRHospital': { - 'en': 'Scan above QR Code to Check-In on the Machine in Hospital', - 'ar': 'مسح فوق رمز الاستجابة السريعة للتحقق في الجهاز في المستشفى' - }, + 'noNeedToWaitInLine': {'en': 'No need to stand in line.', 'ar': 'لا داعي للوقوف في الطابور.'}, + 'useQRAppoAttend': {'en': 'Use the QR code to register the appointment attendance.', 'ar': 'استخدم الكود لتسجيل الحضور في المستشفى.'}, + 'passQRAppoAttend': {'en': 'Pass the QR code through the attendance devices available in the Hospital.', 'ar': 'تمرير الكود من خلال اجهزة تسجيل الحضور المتوفرة في الفرع.'}, + 'sitWaitingQR': {'en': 'Sit in the waiting rooms until called by the nurse.', 'ar': 'الجلوس في غرف الانتظار لحين منادتك من قبل الممرضة.'}, + 'attendRegisterCode': {'en': 'Attendance registration code', 'ar': 'رمز تسجيل الحضور'}, + 'scanQRHospital': {'en': 'Scan above QR Code to Check-In on the Machine in Hospital', 'ar': 'مسح فوق رمز الاستجابة السريعة للتحقق في الجهاز في المستشفى'}, "sendEmail": {"en": "Send Email", "ar": "ارسال نسخة"}, "success": {"en": "Done successfully", "ar": "تم تنفذ الطلب بنجاح"}, - "EmailSentSuccessfully": { - "en": "Email Sent Successfully", - "ar": "تم إرسال البريد الإلكتروني بنجاح" - }, - "EmailSentError": { - "en": "Error Sending Email", - "ar": "خطأ في إرسال البريد الإلكتروني" - }, + "EmailSentSuccessfully": {"en": "Email Sent Successfully", "ar": "تم إرسال البريد الإلكتروني بنجاح"}, + "EmailSentError": {"en": "Error Sending Email", "ar": "خطأ في إرسال البريد الإلكتروني"}, "close": {"en": "Close", "ar": "مغلق"}, "closeIt": {"en": "Close", "ar": "اغلاق"}, "booked": {"en": "Booked", "ar": "محجوز"}, "confirmed": {"en": "Confirmed", "ar": "مؤكد"}, "arrived": {"en": "Arrived", "ar": "تم الحضور"}, - "payNowBookSuccess": { - "en": "Pay now via Al Habib App", - "ar": "ادفع الآن عبر تطبيق الحبيب" - }, - "payNowBookSuccesstext1": { - "en": "Pay Now using online payment service From secure payment gateways", - "ar": "ادفع الآن باستخدام خدمة الدفع عبر الإنترنت من بوابات الدفع الآمنة" - }, - "payNowBookSuccesstext2": { - "en": "You can also Pay Later via online payment Or in Hospital", - "ar": "يمكنك أيضًا الدفع لاحقًا عبر الدفع عبر الإنترنت أو في المستشفى" - }, + "payNowBookSuccess": {"en": "Pay now via Al Habib App", "ar": "ادفع الآن عبر تطبيق الحبيب"}, + "payNowBookSuccesstext1": {"en": "Pay Now using online payment service from secure payment gateways", "ar": " ادفع الآن من خلال خدمة الدفع الالكتروني الآمنة"}, + "payNowBookSuccesstext2": {"en": "You can also Pay Later via online payment or in Hospital", "ar": "يمكنك أيضًا الدفع لاحقًا عبر الدفع الالكتروني أو في المستشفى"}, 'payLater': {'en': 'Pay Later', 'ar': 'ادفع لاحقا'}, - 'askDocNotAllowed': { - 'en': 'This service will be available for last 15 days doctor Visit only', - 'ar': 'هذه الخدمة متاحة للزيارات خلال اخر 15 يوم فقط' - }, - "more-verify": { - "en": "More Verification Options", - "ar": "المزيد من خيارات التحقق" - }, + 'askDocNotAllowed': {'en': 'This service will be available for last 15 days’ doctor Visit only', 'ar': 'هذه الخدمة متاحة للزيارات خلال اخر 15 يوم فقط'}, + "more-verify": {"en": "More Verification Options", "ar": "المزيد من خيارات التحقق"}, "welcome-back": {"en": "Welcome back!", "ar": "مرحبا بعودتك!"}, - "account-info": { - "en": "Would you like to login with current username?", - "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟" - }, + "account-info": {"en": "Would you like to login with current username?", "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟"}, "another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"}, "next": {"en": "Next", "ar": 'التالى'}, "first-name": {"en": "First Name", "ar": "الاسم الأول"}, @@ -345,10 +208,7 @@ const Map localizedValues = { "preferred-language": {"en": "Preferred Language", "ar": "اللغة المفضلة"}, "english": {"en": "English", "ar": "الإنجليزية"}, "arabic": {"en": "Arabic", "ar": "العربية"}, - "locations-register": { - "en": "Where do you want to create this file?", - "ar": "أين تريد فتح هذا الملف؟" - }, + "locations-register": {"en": "Where do you want to create this file?", "ar": "أين تريد فتح هذا الملف؟"}, "ksa": {"en": "KSA", "ar": "السعودية"}, "dubai": {"en": "Dubai", "ar": "دبي"}, "enter-email": {"en": "Please Enter Email", "ar": "ادخل البريد الالكتروني"}, @@ -371,187 +231,143 @@ const Map localizedValues = { 'heart': {'en': 'Heart Rate', 'ar': 'معدل النبض'}, "heightUnit": {"en": "height unit", "ar": "وحدة الطول"}, "weightUnit": {"en": "Weight Unit", "ar": "وحدة الوزن"}, + "unit": {"en": "Unit", "ar": "وحدة"}, "request": {"en": "Request", "ar": "طلبات الاضافة"}, "member-name": {"en": "Member Name", "ar": "اسم العضو"}, - "switch-login": {"en": "Switch User", "ar": "تغير المستخدم"}, + "switch-login": {"en": "Switch", "ar": "تغير "}, "remove-member": {"en": "Remove", "ar": "حذف"}, "allow-view": {"en": "Allow", "ar": "قبول"}, "reject-view": {"en": "Reject", "ar": "رفض"}, "delete-view": {"en": "Delete", "ar": "حذف"}, - // "my-family": {"en": "MY FAMILY", "ar": "عائلتي"}, + "my-family": {"en": "MY FAMILY", "ar": "عائلتي"}, "approvals": {"en": "Approvals", "ar": "موافقات التأمين"}, - "approvalNo": {"en": "Approval No.: ", "ar": "رقم الموافقة: "}, - "companyName": {"en": "Company Name ", "ar": "اسم الشركة: "}, - "receiptOn": {"en": "Receipt on: ", "ar": "تاريخ الفاتورة: "}, - "expiryDate": {"en": "Expiry Date: ", "ar": "تاريخ الانتهاء: "}, + "approvalNo": {"en": "Approval No:", "ar": "رقم الموافقة: "}, + "companyName": {"en": "Company Name:", "ar": "اسم الشركة: "}, + "receiptOn": {"en": "Receipt on:", "ar": "تاريخ الفاتورة: "}, + "expiryDate": {"en": "Expiry Date:", "ar": "تاريخ الانتهاء: "}, + "expiryOn": {"en": "Expiry on:", "ar": "تاريخ الانتهاء: "}, "procedureName": {"en": "Procedure Name:", "ar": "اسم الاجراء:"}, + "procedure": {"en": "Procedure", "ar": "اسم الاجراء:"}, "procedureStatus": {"en": "Procedure Status: ", "ar": "حالة الاجراء"}, - "usageStatus": {"en": "Usage Status", "ar": "جالة الاستخدام"}, - "unusedCount": {"en": "Unused Count: ", "ar": "غير مستخدم: "}, - "totalApproval": { - "en": "Total approval unused", - "ar": "اجمالي الموافقات الغير مستخدمة" - }, + "usageStatus": {"en": "Usage Status", "ar": "حالة الاستخدام"}, + "unusedCount": {"en": "Unused Count:", "ar": "غير مستخدم:"}, + "totalApproval": {"en": "Total approval unused", "ar": "اجمالي الموافقات الغير مستخدمة"}, "category": {"en": "Category: ", "ar": "الفئة"}, "expirationDate": {"en": "Expiration Date: ", "ar": "تاريخ الانتهاء"}, "patientCard": {"en": "Patient Card ID: ", "ar": "رقم الاشتراك"}, - "policyNumber": {"en": "Policy Number: ", "ar": "رقم بوليصة التاميت:"}, + "policyNumber": {"en": "Policy Number: ", "ar": "رقم بوليصة التامين:"}, "seeDetails": {"en": "SEE DETAILS", "ar": "منافعك التامينية"}, "insuranceCards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, "requestType": {"en": "Request Type", "ar": "نوع الاستفسار"}, - "register-info-family": { - "en": "How would like to add the new member?", - "ar": "كيف ترغب باضافة العضو الجديد؟" - }, - "remove-family-member": { - "en": "Remove this member?", - "ar": "إزالة ملف العضو؟" - }, - "MyMedicalFile": {"en": "My Medical File", 'ar': 'ملفي الطبي الالكتروني'}, - "myMedicalFileSubTitle": { - "en": "All your medical records", - 'ar': 'جميع سجلاتك الطبية' - }, - + "register-info-family": {"en": "How would like to add the new member?", "ar": "كيف ترغب باضافة العضو الجديد؟"}, + "remove-family-member": {"en": "Remove this member?", "ar": "إزالة ملف العضو؟"}, + "MyMedicalFile": {"en": "My Medical File", 'ar': 'الملف الطبي الالكتروني'}, + "myMedicalFileSubTitle": {"en": "All your medical records", 'ar': 'جميع سجلاتك الطبية'}, "viewMore": {"en": "View More", 'ar': 'عرض المزيد'}, - "homeHealthCareService": { - "en": "Home Health Care Service", - 'ar': 'الرعاية الصحية المنزلية' - }, + "homeHealthCareService": {"en": "Home Health Care Service", 'ar': 'الرعاية الصحية المنزلية'}, "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدليات الحبيب'}, "EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'}, - "OnlinePaymentService": { - "en": "Online Payment Service", - 'ar': 'خدمة الدفع الإلكتدوني' - }, - "OffersAndPackages": { - "en": "Online transfer request", - 'ar': 'طلب التحويل الالكتروني' - }, - "ComprehensiveMedicalCheckup": { - "en": "Comprehensive Medical Check up", - 'ar': 'فحص طبي شامل' - }, + "OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع الإلكتروني'}, + "OffersAndPackages": {"en": "Online transfer request", 'ar': 'طلب التحويل الالكتروني'}, + "ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check-up", 'ar': 'فحص طبي شامل'}, "HMGService": {"en": "HMG Service", 'ar': 'جميع خدمات الحبيب'}, - "ViewAllHabibMedicalService": { - "en": "View All Habib Medical Service", - 'ar': 'عرض خدمات الحبيب الطبية' - }, + "ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'}, "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, - "ViewAllWaysReachUs": { - "en": "View All Ways Reach Us", - 'ar': 'جميع طرق الاتصال بنا' - }, + "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, "locationDialogMessage": { - "en": - "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", - "ar": - "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك." - }, - - "user-view-requester": { - "en": "User Wants To View Your Medical File", - "ar": "أشخاص يرغبون الاطلاع على ملفك الطبي" - }, - "user-view": { - "en": "User Can View Your Medical File", - "ar": "أشخاص يمكنهم الاطلاع على ملفك الطبي" + "en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", + "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك." }, - + "user-view-requester": {"en": "User Wants to View Your Medical File", "ar": "أشخاص يرغبون في الاطلاع على ملفك الطبي"}, + "user-view": {"en": "User Can View Your Medical File", "ar": "أشخاص مصرح لهم الاطلاع على ملفك الطبي"}, "parking": {"en": "Parking", "ar": "مواقف"}, "alhabiServices": {"en": "HMG Service", "ar": "خدمات الحبيب"}, "parkingTitle": { "en": "Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.", "ar": - " خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). " + " خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر (قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). " }, "parkingDescription": { "en": "Parking service is for you to scan the car location so you can find it easy on you way out. click on (scan parking) button to save the parking location, then (show my park) button will appear to show you the way for the parking. if you want to rescan parking QR just click on (Clear My Data).", "ar": - "خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف)." + "خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر (قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف)." }, + "appointments": {"en": "Appointments", "ar": "مواعيد"}, + "all2": {"en": "All", "ar": "الكل"}, "checkinOption": {"en": "Check-In Options", "ar": "تحقق في الخيارات"}, "readBarcode": {"en": "Read Barcode", "ar": "قراءة الكود"}, - "showMyPark": {"en": "Show My Park", "ar": "عرض بارك"}, - "clearMyData": {"en": "clear My Data", "ar": "امسح البيانات"}, + "showMyPark": {"en": "Show My Park", "ar": "عرض الموقف"}, + "clearMyData": {"en": "Clear My Data", "ar": "امسح البيانات"}, "floor": {"en": "Floor:", "ar": "الطابق"}, "gate": {"en": "Gate:", "ar": "بوابة"}, "building": {"en": "Building:", "ar": "المبنى"}, "branch": {"en": "Branch:", "ar": "الفرع"}, "emergencyServices": {"en": "Emergency Services", "ar": "خدمات الطوارئ"}, "nearester": {"en": "Nearest ER", "ar": "أقرب طوارى"}, - "locationa": {"en": "location", "ar": "الموقع"}, - "ambulancerequest": {"en": "Ambulance ", "ar": "طلب نقل "}, + "locationa": {"en": "Location", "ar": "الموقع"}, + "call_now": {"en": "Call now", "ar": "اتصل الان"}, + "ambulancerequest": {"en": "Ambulance", "ar": "طلب نقل "}, "requestA": {"en": "Request", "ar": "اسعاف"}, - "MyAppointments": {"en": "Appointments", "ar": "مواعيدي"}, - "NoBookedAppointments": { - "en": "No Booked Appointments", - "ar": "لا توجد مواعيد محجوزة" - }, - "NoConfirmedAppointments": { - "en": "No Confirmed Appointments", - "ar": "لا توجد مواعيد مؤكدة" - }, - "noArrivedAppointments": { - "en": "No Arrived Appointments", - "ar": "لم تصل المواعيد" - }, - "MyAppointmentsList": {"en": "List", "ar": "قائمة بمواعدي"}, + "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, + "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, + "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم يتم حضورها"}, + "MyAppointmentsList": {"en": "Appointments", "ar": "بمواعيدي"}, + "MyAppointments": {"en": "My", "ar": "قائمة"}, "Radiology": {"en": "Radiology", "ar": "الأشعة"}, "RadiologySubtitle": {"en": "Result", "ar": "صور وتقارير"}, - "Lab": {"en": "Lab", "ar": "تحليل المختبر"}, - "LabSubtitle": {"en": "Result", "ar": "نتائج"}, + "Lab": {"en": "Lab", "ar": "نتائج"}, + "LabSubtitle": {"en": "Results", "ar": "تحليل المختبر"}, "Medicines": {"en": "Medicines", "ar": "الوصفات"}, - "MedicinesSubtitle": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, - "VitalSigns": {"en": "Vital Signs", "ar": "المؤشرات الحيوية"}, - "VitalSignsSubTitle": {"en": "Reports", "ar": "قراءات"}, - "MyMedical": {"en": "Active", "ar": "قراءات"}, + "MedicinesSubtitle": {"en": "Prescriptions", "ar": "الطبية"}, + "VitalSigns": {"en": "Vital Signs", "ar": "المؤشرات"}, + "VitalSignsSubTitle": {"en": "Reports", "ar": "الحيوية"}, + "MyMedical": {"en": "Active", "ar": "الأدوية"}, "MyMedicalSubtitle": {"en": "Medications", "ar": "النشطة"}, "MyDoctor": {"en": "My Doctor", "ar": "اطبائي"}, "MyDoctorSubtitle": {"en": "List", "ar": "قمت بزيارتهم"}, "Eye": {"en": "Eye", "ar": "قياسات"}, "EyeSubtitle": {"en": "Measurement", "ar": "النظر"}, - "Insurance": {"en": "Insurance", "ar": "بطاقة"}, + "Insurance": {"en": "Insurance", "ar": "بطاقات"}, "InsuranceSubtitle": {"en": "Card", "ar": "التأمين"}, - "UpdateInsurance": {"en": "Update Insurance", "ar": "تحديث التأمين"}, - "UpdateInsuranceSubtitle": {"en": "Card", "ar": "التأمين"}, - "InsuranceApproval": {"en": "Insurance Approval", "ar": "موافقات"}, - "InsuranceApprovalSubtitle": {"en": "Approvals", "ar": "موافقات التأمين"}, - "Allergies": {"en": "Allergies", "ar": "الحساسية"}, - "AllergiesSubtitle": {"en": "Diagnosed", "ar": "مسجلة"}, - "MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"}, - "MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"}, + "UpdateInsurance": {"en": "Update", "ar": "تحديث"}, + "UpdateInsuranceSubtitle": {"en": "Insurance", "ar": "التأمين"}, + "InsuranceApproval": {"en": "Insurance", "ar": "موافقات"}, + "InsuranceApprovalSubtitle": {"en": "Approvals", "ar": "التأمين"}, + "Allergies": {"en": "Allergies", "ar": "قائمة"}, + "AllergiesSubtitle": {"en": "List", "ar": "الحساسية"}, + "MyVaccines": {"en": "My Vaccines", "ar": "قائمة"}, + "MyVaccinesSubtitle": {"en": "List", "ar": "تطعيماتي"}, "Medical": {"en": "Medical", "ar": "التقارير"}, "MedicalSubtitle": {"en": "Report", "ar": "الطبية"}, - "Monthly": {"en": "Monthly", "ar": "تقارير"}, + "Monthly": {"en": "Monthly", "ar": "التقارير"}, "MonthlySubtitle": {"en": "Report", "ar": "الشهرية"}, "Sick": {"en": "Sick", "ar": "الإجازات"}, "SickSubtitle": {"en": "Leaves", "ar": "المرضية"}, - "MyBalance": {"en": "My Balance", "ar": "ارصدتي"}, - "MyBalanceSubtitle": {"en": "Credit", "ar": "المبالغ"}, + "MyBalance": {"en": "My Balance", "ar": "رصيد"}, + "MyBalanceSubtitle": {"en": "Credit", "ar": "محفظتي"}, "PatientCall": {"en": "Patient Call", "ar": "النداء للموعد"}, "PatientCallSubtitle": {"en": "Service", "ar": "خدمة"}, - "SmartWatches": {"en": "Smart Watches", "ar": "الساعة الذكية"}, - "SmartWatchesSubtitle": {"en": "Pairing", "ar": "ربط البيانات"}, + "SmartWatches": {"en": "Smart Watches", "ar": "الساعات الذكية"}, + "SmartWatchesSubtitle": {"en": "Pairing", "ar": "ربط بيانات"}, "MyTrackers": {"en": "My Trackers", "ar": "تتبع قراءاتي"}, "MyTrackersSubtitle": {"en": "Service", "ar": "الطبية"}, - "AskYour": {"en": "Ask Your", "ar": "إرسل طبيبك"}, + "AskYour": {"en": "Ask Your", "ar": "إسال طبيبك"}, "AskYourSubtitle": {"en": "Doctor", "ar": "خدمة"}, "Internet": {"en": "Internet", "ar": "الاتصال"}, "InternetSubtitle": {"en": "Pairing", "ar": "بالإنترنت"}, - "Chatbot": {"en": "Chatbot", "ar": "تاشت بوت"}, + "Chatbot": {"en": "Chatbot", "ar": "شات بوت"}, "ChatbotSubtitle": {"en": "", "ar": ""}, - "TimeLine": {"en": "Time Line", "ar": "الجدول الزمني"}, + "TimeLine": {"en": "Timeline", "ar": "الجدول الزمني"}, "LabOrders": {"en": "Lab Orders", "ar": "تحاليل المختبر"}, - "BillNo": {"en": "Bill No :", "ar": "رقم الفاتورة"}, + "BillNo": {"en": "Bill No:", "ar": "رقم الفاتورة"}, "Prescriptions": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, "History": {"en": "History", "ar": "السجلات"}, "OrderNo": {"en": "Order No", "ar": "رقم الطلب"}, @@ -563,90 +379,58 @@ const Map localizedValues = { "MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"}, "km": {"en": "KMs:", "ar": "كم"}, "km_": {"en": "KM", "ar": "كم"}, - "PatientHealthSummaryReport": { - "en": "Patient Health Summary Report", - "ar": " ملخص التقارير الشهرية" - }, - "ToViewTheTermsAndConditions": { - "en": "To View The Terms And Conditions Report", - "ar": " عرض الشروط والأحكام " - }, + "PatientHealthSummaryReport": {"en": "Patient Health Summary Report", "ar": " ملخص التقارير الشهرية"}, + "ToViewTheTermsAndConditions": {"en": "To View the Terms and Conditions Report", "ar": " عرض الشروط والأحكام "}, "ClickHere": {"en": "Click here", "ar": "أنقر هنا"}, - "IAgreeToTheTermsAndConditions": { - "en": "I agree to the terms and conditions ", - "ar": "أوافق على الشروط والاحكام " - }, + "IAgreeToTheTermsAndConditions": {"en": "I agree to the terms and conditions ", "ar": "موافق على الشروط والاحكام "}, "IAgreeToTheTermsAndConditionsSubtitle": { "en": "I agree to the terms and conditions ", "ar": - "هذا ملخص التقرير الصحي الشهري و الذي يسرد المؤشرات الصحية و نتائج التحاليل لأخر الزيارات. يرجى ملاحظة أن هذا التقرير هو تقرير يتم ارساله بشكل آلي من النظام و لا يعتبر رسمي و لا تؤخذ عليه أي قرارات طبية" + "هذا ملخص التقرير الصحي الشهري و الذي يسرد المؤشرات الصحية و نتائج التحاليل لأخر الزيارات. يرجى ملاحظة أن هذا التقرير يتم ارساله بشكل آلي من النظام و لا يعتبر رسمي و لا تؤخذ عليه أي قرارات طبية" }, "Save": {"en": "Save", "ar": "حفظ "}, "UserAgreement": {"en": "User Agreement", "ar": "اتفاقية الخصوصية "}, "UpdateSuccessfully": {"en": "Update Successfully", "ar": "تم التحديث بنجاح"}, - "CHECK_VACCINE_AVAILABILITY": { - "en": "CHECK VACCINE AVAILABILITY", - "ar": "تحقق من توافر اللقاح" - }, - "MyVaccinesAvailability": { - "en": "MyVaccinesAvailability", - "ar": "توفر لقاحي" - }, + "CHECK_VACCINE_AVAILABILITY": {"en": "CHECK VACCINE AVAILABILITY", "ar": "التحقق من توفر اللقاح"}, + "MyVaccinesAvailability": {"en": "MyVaccinesAvailability", "ar": "توفر لقاحي"}, "PaymentService": {"en": "Payment Service", "ar": "خدمة المدفوعات"}, "PaymentOnline": {"en": "Service", "ar": "الالكتروني"}, "OnlineCheckIn": {"en": "Online Check-In", "ar": "مدفوعات معلقة"}, "MyBalances": {"en": "My Balances", "ar": "رصيدي"}, + "MyWallet": {"en": "My Wallet", "ar": "محفظتى"}, "BalanceAmount": {"en": "Wallet Amount", "ar": "مبلغ المحفظة"}, - "TotalBalance": {"en": "Total Amount", "ar": "المبلغ الإجمالي"}, - "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "إعادة شحن المحفظة"}, - + "TotalBalance": {"en": "Total Balance", "ar": "إجمالي الرصيد"}, + "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "شحن المحفظة"}, "AdvancePayment": {"en": "Advance Payment", "ar": "الدفع مقدما"}, - "AdvancePaymentLabel": { - "en": - "You can create and add an Advanced Payment for you account or other accounts.", - "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين" - }, + "AdvancePaymentLabel": {"en": "You can create and add an Advanced Payment for your account or other accounts.", "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين"}, "FileNumber": {"en": "File Number", "ar": "رقم الملف"}, "Amount": {"en": "Amount *", "ar": "المبلغ *"}, - "DepositorEmail": { - "en": "Depositor Email *", - "ar": "البريد الإلكتروني للمودع *" - }, + "DepositorEmail": {"en": "Depositor Email *", "ar": "البريد الإلكتروني للمودع *"}, "Notes": {"en": "Notes", "ar": "ملاحظات"}, "SelectPatientName": {"en": "Select Patient Name", "ar": "اختر اسم المريض"}, "SelectFamilyPatientName": {"en": "Family Members", "ar": "أفراد الأسرة"}, "SelectHospital": {"en": "Select Hospital", "ar": "اختر المستشفى"}, "selectCity": {"en": "Select City", "ar": "اختر المدينة"}, + "city": {"en": "City", "ar": "مدينة"}, + "distance": {"en": "Distance", "ar": "مسافه"}, "MyAccount": {"en": "My Account", "ar": "حسابي"}, "OtherAccount": {"en": "Other Account", "ar": "حساب آخر"}, "SelectBeneficiary": {"en": "Select Beneficiary", "ar": "حدد المستفيد"}, "ConfirmThePayment": {"en": "Confirm The Payment", "ar": "تأكيد عملية الدفع"}, "DepositorName": {"en": "Depositor Name", "ar": "اسم المودع *"}, "MobileNumber": {"en": "Mobile Number", "ar": "رقم الجوال"}, - "Ok": {"en": "Ok", "ar": "حسنا"}, - "averageWaitingTime": { - "en": "Average Waiting Time:", - "ar": "متوسط ​​وقت الانتظار:" - }, - "WaterConsumedInWeek": { - "en": "Water consumed in a week", - "ar": "معدل شرب الماء خلال الاسبوع" - }, - "WaterConsumedInMonth": { - "en": "Water consumed in a month", - "ar": "معدل شرب الماء خلال الشهر" - }, - "TheVerificationCodeExpiresIn": { - "en": "The Verification Code Expires In", - "ar": "تنتهي صلاحية رمز التحقق في" - }, - "PleaseEnterTheVerificationCode": { - "en": "Please enter the verification code send to", - "ar": "الرجاء إدخال رمز التحقق المرسل إلى" - }, + "phone-number": {"en": "Phone Number", "ar": "رقم الجوال"}, + "country": {"en": "Country", "ar": "دولة"}, + "Ok": {"en": "Ok", "ar": "موافق"}, + "averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"}, + "waitingTime": {"en": "Expected waiting time:", "ar": "وقت الانتظار المتوقع:"}, + "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, + "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, + "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires in", "ar": "تنتهي صلاحية رمز التحقق في"}, + "PleaseEnterTheVerificationCode": {"en": "Please enter the verification code send to", "ar": "الرجاء إدخال رمز التحقق المرسل إلى"}, "EyeMeasurements": {"en": "Eye Measurements", "ar": "قياسات النظر"}, "Measurements": {"en": "Measurements", "ar": "قياسات"}, - "Classes": {"en": "Classes", "ar": "نظارات"}, + "Classes": {"en": "Glasses", "ar": "نظارات"}, "ContactLens": {"en": "Contact Lens", "ar": "العدسات اللاصقة"}, "RightEye": {"en": "Right Eye", "ar": "العين اليمين"}, "Sphere": {"en": "Sphere", "ar": "القوة"}, @@ -658,7 +442,7 @@ const Map localizedValues = { "Brand": {"en": "Brand", "ar": "النوع"}, "Power": {"en": "Power", "ar": "القوة"}, "Diameter": {"en": "Diameter", "ar": "القطر"}, - "Remarks": {"en": "Remarks", "ar": "ملاحضات"}, + "Remarks": {"en": "Remarks", "ar": "ملاحظات"}, "ActiveMedications": {"en": "Active Medications", "ar": "ادويتي النشطة"}, "ExpDate": {"en": "Active Exp Date :", "VA": "تاريخ الإنتهاء"}, "Route": {"en": "Route", "ar": "الطريقة"}, @@ -666,72 +450,55 @@ const Map localizedValues = { "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, "reminderDes": { - "en": - "Please select treatment start day and time to be notified when it\'s time to take the medicine", - "ar": - " يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" - }, - "pleaseSelectAllQuestionToContinue": { - "en": "Please answer all questions to continue...", - "ar": "يرجى الإجابة على جميع الأسئلة للمتابعة..." + "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", + "ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" }, + "pleaseSelectAllQuestionToContinue": {"en": "Please answer all questions to continue...", "ar": "يرجى الإجابة على جميع الأسئلة للمتابعة..."}, "StartDay": {"en": "Start Day", "ar": "يوم البداية"}, "EndDay": {"en": "End Day", "ar": "يوم الانتهاء"}, "Days": {"en": "Days ", "ar": "أيام"}, + "please-verify": {"en": "Please Verify ", "ar": "ارجوك تحقق"}, "ScheduleTime": {"en": "Schedule time", "ar": "الجدول الزمني"}, "AskDoctor": {"en": "Ask Doctor", "ar": "اسأل طبيبك"}, "DoctorResponses": {"en": "Doctor Responses", "ar": "ردود الأطباء"}, "New": {"en": "New", "ar": "جديد"}, "All": {"en": "All", "ar": "الكل"}, - "QuestionHere": { - "en": "Enter the question here...", - "ar": "اضف الاستفسار هنا" - }, - "ViewDoctorResponses": { - "en": "View Doctor Responses", - "ar": "الاطلاع على ردود الأطباء" - }, + "dailyWater": {"en": "Daily Water Check", "ar": "فحص المياه اليومي"}, + "QuestionHere": {"en": "Enter the question here...", "ar": "اضف الاستفسار هنا"}, + "ViewDoctorResponses": {"en": "View Doctor Responses", "ar": "الاطلاع على ردود الأطباء"}, "ServiceInformationButton": {"en": "LOGIN / REGISTER", "ar": "دخول / تسجيل"}, - "ServiceInformationTitle": { - "en": "Service Information", - "ar": "معلومات الخدمة" - }, + "ServiceInformationTitle": {"en": "Service Information", "ar": "معلومات الخدمة"}, "ServiceInformation": {"en": "Service Information", "ar": "معلومات الخدمة"}, - "HomeHealthCare": { - "en": "Home Health Care", - "ar": " الرعاية الصحية المنزلية " - }, + "HomeHealthCare": {"en": "Home Health Care", "ar": " الرعاية الصحية المنزلية "}, + "noAppointmentAvailable": {"en": "No Available Appointments", "ar": "لا توجد مواعيد متاحة"}, "HomeHealthCareText": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", "ar": - "توفر هذه الخدمة مجموعه من خدمات الرعايه الصحيه المنزلية و متابعه مستمره وشامله للذين لا يستطيعون الوصول للمنشات الصحيه في اماكن اقامتهم (التحاليل المخبرية – الاشعة – التطعيمات – العلاج الطبيعي)... " + "توفر هذه الخدمة مجموعه من خدمات الرعايه الصحيه المنزلية و متابعه مستمره وشامله للذين لا يستطيعون الوصول للمنشات الصحيه في اماكن اقامتهم (التحاليل المخبرية – الاشعة – التطعيمات – العلاج الطبيعي) ... " }, "LoginRegister": {"en": "Login/Register", "ar": "دخول / تسجيل"}, "OrderLog": {"en": "Order Log", "ar": " سجل الطلبات"}, "info-lab": { - "en": - "This service allows you to view the results of all laboratory tests performed in Al Habib Medical Group as well as sending the report via e-mail.", - "ar": - "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." + "en": "This service allows you to view the results of all laboratory tests performed in Al Habib Medical Group as well as sending the report via e-mail.", + "ar": "خدمة نتائج المختبر: هذه الخدمة تمكنك من الاطلاع على نتائج جميع الفحوصات المخبرية التي تمت في مجموعة الحبيب الطبية." }, "info-radiology": { - "en": - "This service allows you to view the reports and photos of radiology in Al Habib Medical Group as well as send the report by e-mail.", - "ar": - "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." + "en": "This service allows you to view the reports and photos of radiology in Al Habib Medical Group as well as send the report by e-mail.", + "ar": "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." }, - "noReviewsAvailable": {"en": "No Reviews Available", "ar": "لا يوجد تقييمات"}, "noLocationAvailable": {"en": "No Location Available", "ar": "لا يوجد موقع"}, "orders": {"en": "Orders", "ar": "الطلبات"}, - "lakum": {"en": "Lakum", "ar": "لكم"}, + "lakum": {"en": "Lakum", "ar": "برنامج لكم"}, + "lakumMsg": {"en": "No Details of Points Are There", "ar": " لاتوجد تفاصيل عن النقاط"}, + "lakumPoint": {"en": "Point", "ar": "نقطه"}, "wishlist": {"en": "Wishlist", "ar": "المفضلة"}, "products": {"en": "Products", "ar": "المنتجات"}, - "reviews": {"en": "Reviews", "ar": "التقيمات"}, + "reviews": {"en": "Reviews", "ar": "التقييمات"}, "brands": {"en": "Brands", "ar": "العلامات التجارية"}, "productDetails": {"en": "Product Details", "ar": "تفاصيل المنتج"}, - // "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, + "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, "pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"}, "shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"}, "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, @@ -743,41 +510,49 @@ const Map localizedValues = { "order": {"en": "My Order", "ar": " طلباتي"}, "delivered": {"en": "Delivered", "ar": " تم التوصيل"}, "pending": {"en": "Pending", "ar": " معلقة "}, - "enterNameHere": {"en": "Enter the name here", "ar": " أدخل الاسم هنا "}, + "enterNameHere": {"en": "Enter Your Name", "ar": "أدخل أسمك"}, "processing": {"en": "Processing", "ar": " تحت المعالجة"}, "cancelled": {"en": "Cancelled", "ar": " ملغي"}, "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, "shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"}, - "review": {"en": " reviews", "ar": " تقييمات"}, + "review": {"en": " reviews", "ar": "تقييمات"}, + "viewMedicalFile": {"en": "View Details", "ar": "عرض الملف الطبي"}, + "viewAllServices": {"en": "View All Services", "ar": "عرض جميع الخدمات"}, + "medicalFile": {"en": "Medical File", "ar": "ملفي الطبي"}, + "verified": {"en": "Verified", "ar": "تم التحقق"}, + "checkup": {"en": "Checkup", "ar": "فحص"}, + "hhcHome": {"en": "Home", "ar": "الرعاية"}, + "refferal": {"en": "E-Refferal", "ar": "الإحالة الإلكترونية"}, + "healthCare": {"en": "Health Care", "ar": "الصحية المزلية"}, + "emergency": {"en": "Emergency", "ar": "الطوارئ"}, + "cantSeeProfile": {"en": "Can’t see your medical File?", "ar": "لا تستطيع رؤية ملفك الطبي؟"}, + "loginRegisterNow": {"en": "Login or Register Now", "ar": "تسجيل الدخول أو التسجيل الآن"}, + "HMGPharmacy": {"en": "HMG Pharmacy", "ar": "صيدلية HMG"}, + "ecommerceSolution": {"en": "Ecommerce Solution", "ar": "حل التجارة الإلكترونية"}, + "services2": {"en": "Services", "ar": "خدمات"}, + "comprehensive": {"en": "Comprehensive", "ar": "شامل"}, + "onlineConsulting": {"en": "Online Consulting", "ar": "استشارات فورية"}, "pendingOrder": {"en": " PENDING", "ar": " معلقة"}, - "deliveredOrder": {"en": " DELIVERED", "ar": " تم التوصيل"}, + "deliveredOrder": {"en": " DELIVERED", "ar": "تم التوصيل"}, "processingOrder": {"en": " PROCESSING", "ar": "قيد التنفيذ"}, "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"}, "compare": {"en": " Compare", "ar": "مقارنه"}, "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"}, - "recommended": {"en": " Recommended For You", "ar": "موصى لك"}, + "recommended": {"en": " Recommended for You", "ar": "موصى لك"}, "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, "quantity": {"en": " QTY ", "ar": "الكمية"}, - "backMyAccount": { - "en": "BACK TO MY ACCOUNT ", - "ar": " الرجوع لحسابي الشخصي" - }, + "reviewAppointment": {"en": " Review Appointment ", "ar": "مراجعة الموعد"}, + "backMyAccount": {"en": "BACK TO MY ACCOUNT ", "ar": "الرجوع لحسابي الشخصي"}, "reviewSuccessful": {"en": "Review Successful", "ar": " تقييم ناجح"}, - "reviewShared": { - "en": "Your review has been shared on product review section", - "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج" - }, - "reviewComment": { - "en": "Your reviews help other to choose better product", - "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل" - }, + "reviewShared": {"en": "Your review has been shared on product review section", "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج"}, + "reviewComment": {"en": "Your reviews help other to choose better product", "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل"}, "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"}, "orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"}, "subtotal": {"en": "Subtotal", "ar": " المجموع الفرعي"}, "shipping": {"en": "Shipping", "ar": " الشحن"}, "shipBy": {"en": "SHIP BY:", "ar": "الشحن عن طريق:"}, - "lakumPoints": {"en": "Lakum Points", "ar": "نقاط لكم"}, + "lakumPoints": {"en": "Lakum Points", "ar": "نقاط برنامج لكم"}, "use": {"en": "USE", "ar": "استخدم"}, "proceedPay": {"en": "PROCEED TO PAY", "ar": "المتابعة للدفع"}, "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, @@ -790,112 +565,83 @@ const Map localizedValues = { "confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "}, "confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "}, "conditionsHMG": {"en": "Terms & Conditions ", "ar": "الشروط و الأحكام "}, - "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط و احكام لكم"}, - "confirmDeleteMsg": { - "en": "Are you sure! want to delete ", - "ar": "هل انت متأكد تريد الحذف " - }, + "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط واحكام برنامج لكم"}, + "confirmDeleteMsg": {"en": "Are you sure! want to delete ", "ar": "هل انت متأكد من الحذف "}, "confirmDelete": {"en": "DELETE", "ar": "حذف"}, - "confirmCancellation": { - "en": "Are you sure! want to cancel this order ", - "ar": "هل انت متأكد تريد حذف هذا المنتج " - }, + "confirmCancellation": {"en": "Are you sure! want to cancel this order ", "ar": "هل انت متأكد من حذف هذا المنتج "}, "orderNumber": {"en": "Order#: ", "ar": "الطلب: "}, "orderDate": {"en": "Date", "ar": "التاريخ:"}, "itemsNo": {"en": "items(s)", "ar": "عناصر"}, "noOrder": {"en": "You Don't have any orders.", "ar": "ليس لديك طلبات"}, - "noResult": {"en": "No Result.", "ar": "لايوجد نتئج"}, + "noResult": {"en": "No Result.", "ar": "لا يوجد نتائج"}, "nonRecommended": {"en": "No Recommended Products.", "ar": "لا يوجد منتجات"}, - "TermsService": {"en": "Terms of Service", "ar": "شروط الخدمه"}, - "Beforeusing": { - "en": "Before using the checkup, please read Terms of Service.", - "ar": "قبل استخدام الفحص ، يرجى قراءة شروط الخدمة" - }, - "accept": { - "en": "I read and accept Terms of Service and Privacy Policy", - "ar": "قرأت ووافقت على شروط الخدمة وسياسة الخصوصية" - }, - "data-safe-info": { - "en": - "Information that you provide is anonymous and not shared with anyone.", - "ar": "المعلومات التي تقدمها لا تتم مشاركتها مع أي شخص" - }, + "Beforeusing": {"en": "Before using the checkup, please read Terms of Service.", "ar": "قبل استخدام الفحص ، يرجى قراءة شروط الخدمة"}, + "accept": {"en": "I read and accept Terms of Service and Privacy Policy", "ar": "قرأت ووافقت على شروط الخدمة وسياسة الخصوصية"}, + "data-safe-info": {"en": "Information that you provide is anonymous and not shared with anyone.", "ar": "المعلومات التي تقدمها لا تتم مشاركتها مع أي شخص"}, "data-safe": {"en": " Your data is safe.", "ar": "بياناتك آمنة"}, - "informational": { - "en": - "Checkup is for informational purposes and is not a qualified medical opinion", - "ar": "الفحص هو لأغراض معلوماتية وليس رأي طبي مؤهل" - }, - "not-use-in-emerbency": { - "en": "Do not use in emergencies.", - "ar": "لا تستخدم في حالات الطوارئ" - }, - "not-use-in-emerbency-details": { - "en": "In case of health emergency, ", - "ar": "في حالة الطوارئ اتصل بأقرب رقم للطوارئ على الفور" - }, - "not-use-in-emerbency-details-call": { - "en": "call the nearest emergency number immediately", - "ar": " اتصل بأقرب رقم للطوارئ على الفور" - }, - "check-diagnosis": { - "en": "Checkup is not a diagnosis.", - "ar": "الفحص ليس تشخيص." - }, + "informational": {"en": "Checkup is for informational purposes and is not a qualified medical opinion", "ar": "الفحص هو لأغراض معلوماتية وليس رأي طبي مؤهل"}, + "not-use-in-emerbency": {"en": "Do not use in emergencies.", "ar": "لا تستخدم في حالات الطوارئ"}, + "not-use-in-emerbency-details": {"en": "In case of health emergency, ", "ar": "في حالة الطوارئ اتصل بأقرب رقم للطوارئ على الفور"}, + "not-use-in-emerbency-details-call": {"en": "call the nearest emergency number immediately", "ar": " اتصل بأقرب رقم للطوارئ على الفور"}, + "check-diagnosis": {"en": "Checkup is not a diagnosis.", "ar": "الفحص ليس تشخيص."}, "remeberthat": {"en": "Remember that", "ar": "تذكر ذلك:"}, - "loginToUseService": { - "en": "You need to login to use this service", - "ar": "هذة الخدمة تتطلب تسجيل الدخول" - }, - - // pharmacy module - "medicationRefill": {"en": "MEDICATION REFILL", "ar": "إعادة تعبئة الدواء"}, - "offersAndPromotions": { - "en": "OFFERS & SPECIAL PROMOTIONS", - "ar": "العروض والترقيات الخاصة" - }, + "loginToUseService": {"en": "You need to login to use this service", "ar": "هذة الخدمة تتطلب تسجيل الدخول"}, + "offersAndPromotions": {"en": "OFFERS & SPECIAL PROMOTIONS", "ar": "العروض والترقيات الخاصة"}, + "offers": {"en": "OFFERS", "ar": "العروض"}, "myPrescriptions": {"en": "MY PRESCRIPTIONS", "ar": "وصفاتي"}, - "searchAndScanMedication": { - "en": "SEARCH & SCAN FOR MEDICATION", - "ar": "البحث والمسح للأدوية" - }, - "shopByBrands": {"en": "Shop By Brands", "ar": "تسوق حسب الماركات"}, + "searchAndScanMedication": {"en": "SEARCH & SCAN FOR MEDICATION", "ar": "البحث والمسح للأدوية"}, + "shopByBrands": {"en": "Shop by Brands", "ar": "تسوق حسب الماركات"}, "recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"}, "bestSellers": {"en": "Best Seller", "ar": "الأكثر مبيعأ"}, "deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"}, "total": {"en": "Total", "ar": "المجموع"}, - "totalWithColonRight": {"en": "Total:", "ar": ":المجموع"}, + "totalWithColonRight": {"en": "Total:", "ar": "المجموع"}, "selectAddress": {"en": "Select Address", "ar": "حدد العنوان"}, "shippingAddress": {"en": "SHIPPING ADDRESS", "ar": "عنوان الشحن"}, "changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"}, - "selectPaymentOption": { - "en": "Select Payment Option", - "ar": "حدد خيار الدفع" - }, - "changeMethod": {"en": "Change Method", "ar": "تغيير خيار الدفع"}, + "selectPaymentOption": {"en": "Select Payment Option", "ar": "حدد طريقة الدفع"}, + "changeMethod": {"en": "Change Method", "ar": "تغيير طريقة الدفع"}, "reviewOrder": {"en": "Review Order", "ar": "مراجعة الطلب"}, "active": {"en": "ACTIVE", "ar": "فعال"}, "inactive": {"en": "INACTIVE", "ar": "غير فعال"}, "balance": {"en": "BALANCE", "ar": "الحالي"}, "gained": {"en": "GAINED", "ar": "المكتسب"}, - "consumed": {"en": "CONSUMED", "ar": "المستهلك"}, + "consumed": {"en": "Consumed", "ar": "المستهلك"}, "transferred": {"en": "TRANSFERRED", "ar": "المحول"}, + "RIYAL": {"en": "RIYAL", "ar": "ريال"}, + "MEMBERSINCE": {"en": "MEMBER SINCE", "ar": "تاريخ العضوية"}, + "IDENTIFICATION": {"en": "IDENTIFICATION", "ar": "رقم الهوية"}, + "lakumMobile": {"en": "lakum Mobile", "ar": "رقم الجوال"}, + "Waitinggained": {"en": "Waiting gained", "ar": " بأنتظار التفعيل"}, + "Expired": {"en": "Expired", "ar": "منتهية الصلاحيه"}, + "WillBeExpired": {"en": "Will Be Expired", "ar": "ستنتهي صلاحيتها"}, + "LakumPoint": {"en": "Lakum Points", "ar": "نقاط لكم"}, + "ActivateLAKUMAccount": {"en": "Activate LAKUM Account", "ar": "تفعيل لكم"}, "checkBeneficiary": {"en": "CHECK BENEFICIARY", "ar": "تحقق من المستفيد"}, "beneficiaryName": {"en": "Beneficiary Name", "ar": "اسم المستفيد"}, "accountActivation": {"en": "Account Activation", "ar": "تفعيل الحساب"}, - "lakumTransfer": {"en": "Lakum Transfer", "ar": "تفعيل الحساب"}, + "lakumTransfer": {"en": "Lakum Transfer", "ar": "تحويل نقاط لكم"}, "acceptLbl": {"en": "Accept", "ar": "موافقة"}, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, "select-age": {"en": "Select Your Age", "ar": "حدد العمر"}, + "select": {"en": "Select", "ar": "اختر"}, "i-am": {"en": "I am", "ar": "أنا"}, "years-old": {"en": "years old", "ar": "سنة"}, - "drag-point": { - "en": "Drag point to change your age", - "ar": "اسحب لتغيير عمرك" - }, - "refine": {"en": "Refine", "ar": "refine"}, + "drag-point": {"en": "Drag point to change your age", "ar": "اسحب لتغيير عمرك"}, + "refine": {"en": "Refine", "ar": "تصفية"}, + "max": {"en": "Max", "ar": "اعلى"}, + "compeleteOrderMsg": {"en": "Order has been placed successfully!!", "ar": "تم اتمام الطلب بنجاح"}, + "addToCompareMsg": {"en": "You have added a product to the Compare list", "ar": "تمت الاضافه لقائمة المقارنه"}, + "itInListMsg": {"en": "Item is already in the list", "ar": "المنتج موجود في القائمه"}, + "compareListFull": {"en": "Your compare list is full", "ar": "قائمة المقارنة ممتلئه"}, + "addQuantity": {"en": "You should add quantity", "ar": "اختر الكمية"}, + "addToCartMsg": {"en": "You have added a product to the cart", "ar": "تمت اضافة المنتج بنجاح"}, + "addToWishlistMsg": {"en": "You have added a product to the Wishlist", "ar": "تمت الاضافة لقائمة المفضله"}, + "notifyMeMsg": {"en": "You will be notified when product available", "ar": "سيتم اخبارك في حال توفر المنتج"}, + "removeFromWishlistMsg": {"en": "You have removed a product from the Wishlist", "ar": "تمت ازالة المنتج بنجاح"}, + "min": {"en": "Min", "ar": "اقل"}, "reset": {"en": "Reset", "ar": "اعادة تعيين"}, "apply": {"en": "Apply", "ar": "تطبيق"}, "viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"}, @@ -903,16 +649,16 @@ const Map localizedValues = { "wishList": {"en": "WishList", "ar": "المفضلة"}, "myAccount": {"en": "My Account", "ar": "حسابي"}, "cart": {"en": "Cart", "ar": "التسوق"}, - "Alhabibapp": {"en": "Al habib app", "ar": "تطبيق الحبيب"}, + "Alhabibapp": {"en": "Al Habib app", "ar": "تطبيق الحبيب"}, "searchProductHere": {"en": "Search Product here", "ar": "البحث عن منتج"}, "HHCNotAuthMsg": { "en": "This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.", "ar": - "توفر هذه الخدمة مجموعه من خدمات الرعايه الصحيه المنزلية و متابعه مستمره وشامله للذين لا يستطيعون الوصول للمنشات الصحيه في اماكن اقامتهم (التحاليل المخبرية – الاشعة – التطعيمات – العلاج الطبيعي)..." + "توفر هذه الخدمة مجموعه من خدمات الرعايه الصحيه المنزلية و متابعه مستمره وشامله للذين لا يستطيعون الوصول للمنشات الصحيه في اماكن اقامتهم (التحاليل المخبرية – الاشعة – التطعيمات – العلاج الطبيعي) ..." }, "email": {"en": "Email", "ar": "البريد الالكتروني"}, - "Book": {"en": "Book", "ar": "احجز"}, + "Book": {"en": "Book", "ar": "حجز"}, "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"}, @@ -920,11 +666,7 @@ const Map localizedValues = { "profile": {"en": "Profile", "ar": "ملفي"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, - "notificationDetailsa": { - "en": "Notification Details", - "ar": "تفاصيل الاشعار" - }, - + "notificationDetailsa": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, "info-my-doctor-points": { "en": [ "View the doctor's profile and qualifications.", @@ -932,24 +674,15 @@ const Map localizedValues = { "View details of your appointments with the selected doctor.", "Book appointment with the doctor. ", ], - "ar": [ - "الاطلاع على معلومات الطبيب ومؤهلاته.", - "الاطلاع على جدول الطبيب.", - "الاطلاع على تفاصيل المواعيد التي تمت مع الطبيب.", - "حجز موعد مع الطبيب." - ] + "ar": ["الاطلاع على معلومات الطبيب ومؤهلاته.", "الاطلاع على جدول الطبيب.", "الاطلاع على تفاصيل المواعيد التي تمت مع الطبيب.", "حجز موعد مع الطبيب."] }, "info-my-doctor": { - "en": - "This service allows you to see all the doctors you have visited in Al Habib Medical Group, and through this service:", - "ar": - "خدمة اطبائي: هذه الخدمة تمكنك من الاطلاع على جميع الاطباء الذين قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to see all the doctors you have visited in Al Habib Medical Group, and through this service:", + "ar": "خدمة اطبائي: هذه الخدمة تمكنك من الاطلاع على جميع الاطباء الذين قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" }, "info-prescriptions": { - "en": - "This service allows you to view all the medical prescriptions issued by Al Habib Medical Group, and through this service, you can:", - "ar": - "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to view all the medical prescriptions issued by Al Habib Medical Group, and through this service, you can:", + "ar": "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" }, "info-my-prescription-points": { "en": [ @@ -971,14 +704,10 @@ const Map localizedValues = { "الاطلاع على اسعار الادوية المصروفة." ] }, - "info-insurance-cards": { - "en": - "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", - "ar": - "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" + "en": "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", + "ar": "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" }, - "info-insurance-cards-points": { "en": [ "Name of the insurance company.", @@ -997,21 +726,14 @@ const Map localizedValues = { "تفاصيل التامين، مثلاً: مستوى الغرفة التي يغطيها التامين وكذلك الحالات التي يغطيها التامين.", ] }, - "info-allergies": { - "en": - "This service allows you to view all types of allergies recorded during your visits to Al Habib Medical Group.", - "ar": - "خدمة الحساسية: هذه الخدمة تمكنك من الاطلاع على جميع انواع الحساسية التي تم تسجيلها خلال زياراتك في مجموعة الحبيب الطبية." + "en": "This service allows you to view all types of allergies recorded during your visits to Al Habib Medical Group.", + "ar": "خدمة الحساسية: هذه الخدمة تمكنك من الاطلاع على جميع انواع الحساسية التي تم تسجيلها خلال زياراتك في مجموعة الحبيب الطبية." }, - "sick-leaves": {"en": "Sick Leaves", "ar": "الاجازات المرضية"}, - "info-sick-leaves": { - "en": - "This service allows you to view all sick leaves that were taken in Al Habib Medical Group in addition to:", - "ar": - "الاجازات المرضية: هذه الخدمة تمكنك من الاطلاع على جميع الاجازات المرضية والتي تم اصدارها في مجموعة الحبيب الطبية بالاضافة الى:" + "en": "This service allows you to view all sick leaves that were taken in Al Habib Medical Group in addition to:", + "ar": "الاجازات المرضية: هذه الخدمة تمكنك من الاطلاع على جميع الاجازات المرضية والتي تم اصدارها في مجموعة الحبيب الطبية بالاضافة الى:" }, "info-sick-leave-points": { "en": [ @@ -1021,22 +743,12 @@ const Map localizedValues = { "Branch that patient take the vaccination form.", "Sending a report of vaccinations to the email. ", ], - "ar": [ - "اسم الطبيب", - "تاريخ الاجازة.", - "عدد ايام الاجازة.", - "الفرع الذي تم اصدار الاجازة منه.", - "ارسال نسخة مختومة من الاجازة الى البريد الالكتروني." - ] + "ar": ["اسم الطبيب", "تاريخ الاجازة.", "عدد ايام الاجازة.", "الفرع الذي تم اصدار الاجازة منه.", "ارسال نسخة مختومة من الاجازة الى البريد الالكتروني."] }, - "info-approvals": { - "en": - "This service allows you to view all approvals requests that have been sent to the insurance companies in addition to:", - "ar": - "خدمة الموافقات: هذه الخدمة تمكنك من الاطلاع على جميع طلبات الموافقات والتي تم ارسالها الى شركات التامين بالاضافة الى:" + "en": "This service allows you to view all approvals requests that have been sent to the insurance companies in addition to:", + "ar": "خدمة الموافقات: هذه الخدمة تمكنك من الاطلاع على جميع طلبات الموافقات والتي تم ارسالها الى شركات التامين بالاضافة الى:" }, - "info-approval-points": { "en": [ "View the total unused approvals.", @@ -1047,42 +759,22 @@ const Map localizedValues = { "تتبع حالة الموافقة.", ] }, - "month-report": {"en": "Monthly Reports", "ar": "تقاريري الشهرية"}, "info-month-report": { "en": "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", - "ar": - "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." - }, - "language-setting": { - "en": "SMS and Confirmation Calls Language", - "ar": "لغة الرسائل القصيرة و الاتصال الآلي" + "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, + "language-setting": {"en": "SMS and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة و الاتصال الآلي"}, "alert": {"en": "Alerts", "ar": "التنبيهات"}, - "email-alert": { - "en": "Alert By Email", - "ar": "استلام التنبيهات بالبريد الالكتروني" - }, - "sms-alert": { - "en": "Alert By SMS", - "ar": "استلام التنبيهات بالرسائل القصيرة" - }, + "email-alert": {"en": "Alert by Email", "ar": "استلام التنبيهات بالبريد الالكتروني"}, + "sms-alert": {"en": "Alert by SMS", "ar": "استلام التنبيهات بالرسائل القصيرة"}, "contact-info": {"en": "Contact Information", "ar": "معلومات التواصل"}, - "emrg-name": { - "en": "Emergency Contact Name", - "ar": "اسم للتواصل في حالة الطوارئ" - }, - "emrg-no": { - "en": "Emergency Contact Number", - "ar": "رقم للتواصل في حالة الطوارئ" - }, + "emrg-name": {"en": "Emergency Contact Name", "ar": "اسم للتواصل في حالة الطوارئ"}, + "emrg-no": {"en": "Emergency Contact Number", "ar": "رقم للتواصل في حالة الطوارئ"}, "modes": {"en": "Modes", "ar": "الاوضاع"}, "vibration": {"en": "Vibration Touch Feedback", "ar": "الاهتزاز عند اللمس"}, - "blind-modes": { - "en": "Modes for Partially Blind", - "ar": "تأثيرات لدعم ضعاف البصر" - }, + "blind-modes": {"en": "Modes for Partially Blind", "ar": "تأثيرات لدعم ضعاف البصر"}, "invert-theme": {"en": "Invert", "ar": "ألوان سلبية"}, "off-theme": {"en": "Off", "ar": "إيقاف"}, "dim-theme": {"en": "Dim", "ar": "ضوء خافت"}, @@ -1090,9 +782,10 @@ const Map localizedValues = { "permissions": {"en": "Permission", "ar": "الصلاحيات"}, "camera-permission": {"en": "Camera", "ar": "الكاميرا"}, "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, - "needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"}, "outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"}, + "noArabicLetters": {"en": "It Is Not Allow to Use Arabic Letters", "ar": "غير مسموح باستخدام الحروف العربيه"}, + "noOffersAvailable": {"en": "No Offers Available!", "ar": "لايوجد عروض حاليا"}, "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, @@ -1101,20 +794,14 @@ const Map localizedValues = { "LiveChat": {"en": "Live Chat", "ar": "محادثة مباشرة"}, "Service": {"en": "Service", "ar": "خدمة"}, "HMGServiceLabel": {"en": "HMG Service", 'ar': 'خدمات الحبيب'}, - "HealthWeatherIndicators": { - "en": "Health Weather Indicators", - 'ar': ' مؤشرات الطقس الصحية ' - }, - "HealthTipsBasedOnCurrentWeather": { - "en": "Health Tips Based On Current Weather", - 'ar': ' نصائح صحية على أساس الطقس الحالي ' - }, + "HealthWeatherIndicators": {"en": "Health Weather Indicators", 'ar': ' مؤشرات الطقس الصحية '}, + "HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية بناءاً على الطقس الحالي '}, "MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "}, "SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"}, "ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"}, "Ports": {"en": "Ports", "ar": "المنافذ"}, - "Way": {"en": "Way", "ar": "الطزيقة"}, - "Average": {"en": "Average", "ar": "المعدل"}, + "Way": {"en": "Way", "ar": "الطريقة"}, + "Average": {"en": "Average", "ar": "متوسط"}, "DailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"}, "Period": {"en": "Period", "ar": "الفترة"}, "duration": {"en": "Duration", "ar": "المدة"}, @@ -1123,89 +810,68 @@ const Map localizedValues = { "kg": {"en": "kg", "ar": "كجم"}, "lb": {"en": "lb", "ar": "رطل"}, "birth_date": {"en": "Birth Date", "ar": "تاريخ الميلاد"}, + "date_of_birth": {"en": "Date of Birth", "ar": "تاريخ الولادة"}, "mass": {"en": "Mass", "ar": "كتلة"}, "temp-c": {"en": "°C", "ar": "°س"}, "bpm": {"en": "bpm", "ar": "نبضة"}, "respiration-signs": {"en": "Respiration", "ar": "تنفس"}, "sys-dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, - "body": {"en": "Body \n Mass", "ar": "كتلة\nالجسم"}, + "body": {"en": "Body Mass", "ar": "كتلة\nالجسم"}, + "body_string": {"en": "Body", "ar": "الجسم"}, + "face": {"en": "Face", "ar": "وجه"}, + "retouch": {"en": "Retouch", "ar": "تنميق"}, + "bikini": {"en": "Bikini", "ar": "بيكيني"}, + "totalMinutes": {"en": "Total Minutes", "ar": "إجمالي الدقائق"}, "feedback": {"en": "Feedback", "ar": "رأيك يهمنا"}, "send": {"en": "Send", "ar": "أرسل"}, "status": {"en": "Status", "ar": "الحالة"}, "like-to-hear": { - "en": - "We would love to hear the feedback, concerns on healthcare services and eServices experience. Please use the below form", - "ar": - "يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة" + "en": "We would love to hear the feedback, concerns on healthcare services and eServices experience. Please use the below form", + "ar": "يسعدنا سماع ملاحظاتك حول خدمات الرعاية الصحية والخدمات الإلكترونية. يرجى تعبئة الحقول المطلوبة" }, "subject": {"en": "Subject", "ar": "الموضوع"}, "message": {"en": "Message", "ar": "رسالة"}, - "empty-subject": { - "en": "Please enter the subject", - "ar": "يرجى ادخال الموضوع" - }, + "empty-subject": {"en": "Please enter the subject", "ar": "يرجى ادخال الموضوع"}, "empty-message": {"en": "Please enter message", "ar": "يرجى ادخال الرسالة"}, "select-attachment": {"en": "Select Attachment", "ar": "إختر المرفق"}, "complain-appo": {"en": "Complaint for appointment", "ar": "شكوى على موعد"}, - "complain-without-appo": { - "en": "Complaint without appointment", - "ar": "شكوى بدون موعد" - }, + "complain-without-appo": {"en": "Complaint without appointment", "ar": "شكوى بدون موعد"}, "question": {"en": "Question", "ar": "سؤال"}, "message-type": {"en": "Message Type", "ar": "نوع الرسالة"}, "feedback-type": {"en": "Feedback Type", "ar": "نوع الرسالة"}, - "compliment": {"en": "compliment", "ar": "ثناء"}, + "compliment": {"en": "compliment", "ar": "شكوى"}, "suggestion": {"en": "Suggestion", "ar": "إقتراح"}, - "your-feedback": { - "en": "Your feedback was sent", - "ar": "لقد تم ارسال اقراحك شكرا لك" - }, - "select-part": { - "en": "Please select the part that complain about", - "ar": "يرجى تحديد الجزء الذي تشكو منه" - }, + "your-feedback": {"en": "Your feedback was sent", "ar": "لقد تم ارسال اقتراحك شكرا لك"}, + "select-part": {"en": "Please select the part that complain about", "ar": "يرجى تحديد الجزء الذي تشكو منه"}, "number": {"en": "Number", "ar": "الرقم"}, "not-classified": {"en": "Not classified", "ar": "غير محدد"}, "selectClinic": {"en": "Select Clinic", "ar": " بحث بالعيادة"}, - "searchItemError": { - "en": "Item name should be more than 3 character ", - "ar": "يجب أن يكون اسم العنصر أكثر من 3 أحرف" - }, + "searchItemError": {"en": "Item name should be more than 3 character ", "ar": "يجب أن يكون الاسم المدخل أكثر من 3 أحرف"}, "YouCanFind": {"en": "You Can Find ", "ar": "باستطاعتك العثور على "}, - "ItemInSearch": {"en": " Item In Search", "ar": " عنصر في البحث "}, + "ItemInSearch": {"en": " Item in Search", "ar": " عنصر في البحث "}, "blood-donation": {"en": "Blood Donation", "ar": "التبرع بالدم"}, "blood-donation-info": { - "en": - "Through this service, you can register your name as a blood donor where the blood bank in the Habib Medical Group will communicate you in case of need for blood type.", - "ar": - "عن طريق هذه الخدمة تستطيع تسجيل اسمك كمتبرع بالدم حيث سيتم التواصل معك عن طريق بنك الدم في مجموعة الحبيب الطبية في حال الحاجة الى فصيلة الدم ." - }, - "blood-instruction": { - "en": - "Enter the required information, In order to register for Blood Donation Service", - "ar": "ادخل المعلومات المطلوبة للتسجيل بخدمة التبرع بالدم" - }, - "view-terms": { - "en": "To view the terms and conditions", - "ar": "عرض الشروط والأحكام" + "en": "Through this service, you can register your name as a blood donor where the blood bank in the Habib Medical Group will communicate you in case of need for blood type.", + "ar": "عن طريق هذه الخدمة تستطيع تسجيل اسمك كمتبرع بالدم حيث سيتم التواصل معك عن طريق بنك الدم في مجموعة الحبيب الطبية في حال الحاجة الى فصيلة الدم." }, + "blood-instruction": {"en": "Enter the required information, in order to register for Blood Donation Service", "ar": "ادخل المعلومات المطلوبة للتسجيل بخدمة التبرع بالدم"}, + "view-terms": {"en": "To view the terms and conditions", "ar": "عرض الشروط والأحكام"}, "wantConnectHmgNetwork": { - "en": - "Dear customer there is no internet access, Do you want to connect with HMG network to use our app, make sure you are in range of HMG network", - "ar": - "عزيز العميل لا يوجد اتصال بالإنترنت, هل تريد الاتصال بشبكة مستشفى د. سليمان الحبيب لاستخدام التطبيق. يجب عليك ان تكون في نطاق شبكة المستشفى" + "en": "Dear customer there is no internet access, do you want to connect with HMG network to use our app, make sure you are in range of HMG network", + "ar": "عزيز العميل لا يوجد اتصال بالإنترنت, هل تريد الاتصال بشبكة مستشفى د. سليمان الحبيب لاستخدام التطبيق. يجب عليك ان تكون في نطاق شبكة المستشفى" }, - "failedToAccessHmgServices": { - "en": "Connected with HMG Network,\n\nBut failed to access HMG services", - "ar": "Connected with HMG Network,\n\nBut failed to access HMG services" + "failedToAccessHmgServices": {"en": "Connected with HMG Network,\n\nBut failed to access HMG services", "ar": "Connected with HMG Network,\n\nBut failed to access HMG services"}, + "offerAndPackages": {"en": "Offers and Packages", "ar": "العروض والباقات"}, + "offerAndPackagesDetails": { + "en": "This service allows you to view all HMG Offers:", + "ar": "This service allows you to view all HMG Offers:" }, - "offerAndPackages": {"en": "Offers And Packages", "ar": "العروض والباقات"}, "InvoiceNo": {"en": "Invoice No", "ar": "رقم الفاتورة"}, "InvoiceDate": {"en": "Invoice Date", "ar": "تاريخ الفاتورة"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, "GeneralResult": {"en": "General Result", "ar": "نتيجة عامة"}, "show-more-btn": {"en": "Flow Chart", "ar": "النتائج التراكمية"}, - + "view_flow_chart": {"en": "View Flowchart", "ar": "النتائج التراكمية"}, "value": {"en": "Value", "ar": "القيمة"}, "range": {"en": "Range", "ar": "المدى"}, "out-patient": {"en": "Out Patient", "ar": "عيادات خارجية"}, @@ -1213,9 +879,9 @@ const Map localizedValues = { "report": {"en": "Radiology Report", "ar": "تقرير الاشعة"}, "open-rad": {"en": "Open Image", "ar": "فتح صور الاشعة"}, "send-copy": {"en": "Email the Report", "ar": "أرسل التقرير"}, - "appoSurvey": {"en": "Survey", "ar": "إستبيان"}, - "appoSurveySubtitle": {"en": "Survey", "ar": "إستبيان"}, - "labResults": {"en": "Lab Result", "ar": "نتيجة المختبر"}, + "appoSurvey": {"en": "Survey", "ar": "الاستبيان"}, + "appoSurveySubtitle": {"en": "Survey", "ar": "الاستبيان"}, + "labResults": {"en": "Lab Results", "ar": "نتيجة المختبر"}, "doctorRating": {"en": "Doctor Rating", "ar": "تقييم الطبيب"}, "good": {"en": "Good", "ar": "جيد"}, "v-good": {"en": "Very Good", "ar": "جيد جدا"}, @@ -1223,39 +889,26 @@ const Map localizedValues = { "average": {"en": "Average", "ar": "متوسط"}, "below-average": {"en": "Below Average", "ar": "أقل من المتوسط"}, "info-signs": { - "en": - "This service allows you to view all vital signs were performed in the Habib Medical Group, e.x (height, weight, body mass index, heart rate, etc.) as well shows some statistics charts.", + "en": "This service allows you to view all vital signs were performed in the Habib Medical Group, e.x (height, weight, body mass index, heart rate, etc.) as well shows some statistics charts.", "ar": - "خدمة المؤشرات الحيوية: هذه الخدمة تمكنك من الاطلاع على جميع المؤشرات الحيوية على سبيل المثال (الطول، الوزن، مؤشر كتلة الجسم، معدل نبضات القلب الخ..) التي تمت في مجموعة الحبيب الطبية وكذلك رسوم بيانية على مستوى المؤشر." + "خدمة المؤشرات الحيوية: هذه الخدمة تمكنك من الاطلاع على جميع المؤشرات الحيوية على سبيل المثال (الطول، الوزن، مؤشر كتلة الجسم، معدل نبضات القلب الخ.) التي تمت في مجموعة الحبيب الطبية وكذلك رسوم بيانية على مستوى المؤشر." }, "info-advance-payment": { - "en": - "This service designed so that you can deposit an amount in advance either in your account or in someone else's account with Al Habib Medical Group.", - "ar": - "تم تصميم هذه الخدمة حتى تتمكن من دفع مبلغ مقدما او تحت الحساب سواء في حسابك او في حساب شخص اخر لدى مجموعة الحبيب الطبية." - }, - "info-my-balance": { - "en": "This service allows you to check your balance in all branchs", - "ar": "هذه الخدمه تتيح لك الاطلاع رصيدك في كل الفروع" + "en": "This service designed so that you can deposit an amount in advance either in your account or in someone else's account with Al Habib Medical Group.", + "ar": "تم تصميم هذه الخدمة حتى تتمكن من دفع مبلغ مقدما او تحت الحساب سواء في حسابك او في حساب شخص اخر لدى مجموعة الحبيب الطبية." }, + "info-my-balance": {"en": "This service allows you to check your balance in all branchs", "ar": "هذه الخدمه تتيح لك الاطلاع رصيدك في كل الفروع"}, "er-contant": { - "en": - "This service displays nearest branch among all the branches of Al Habib Medical Group based on your current location.", - "ar": - "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." + "en": "This service displays nearest branch among all the branches of Al Habib Medical Group based on your current location.", + "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, "er": {"en": "ER", "ar": "الطوارىء"}, "transportation-Service": {"en": "Ambulance Request", "ar": "طلب نقل اسعاف"}, "info-ambulance": { - "en": - "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", - "ar": - "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" - }, - "RRT-transport-heading": { - "en": "Select Transportation Method", - "ar": "حدد طريقة النقل" + "en": "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", + "ar": "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" }, + "RRT-transport-heading": {"en": "Select Transportation Method", "ar": "حدد طريقة النقل"}, "RRT-direction-heading": {"en": "Select Direction", "ar": "حدد الاتجاه"}, "RRT-way-heading": {"en": "Select Way", "ar": "حدد الطريق"}, "to-hospital": {"en": "To Hospital", "ar": "الى المستشفى"}, @@ -1265,118 +918,58 @@ const Map localizedValues = { "pickup-location": {"en": "Pickup Location", "ar": "نقطة الانطلاق"}, "pickup-spot": {"en": "Pickup Spot", "ar": "نقطة اللقاء"}, "inside-home": {"en": "Inside Home", "ar": "داخل المنزل"}, - "have-appo": {"en": "Do you have an appointment ?", "ar": "هل لديك موعد ؟"}, + "have-appo": {"en": "Do you have an appointment?", "ar": "هل لديك موعد ؟"}, "dropoff-location": {"en": "Dropoff Location", "ar": "نقطة الوصول"}, - "select-all": { - "en": "Please select all fields", - "ar": "يرجى تحديد جميع الحقول" - }, - "select-map": {"en": "Select From Map", "ar": "حدد من الخريطة"}, - "no-appointment": { - "en": "You don't have any appointments yet", - "ar": "ليس لديك أي مواعيد حتى الآن" - }, + "select-all": {"en": "Please select all fields", "ar": "يرجى تحديد جميع الحقول"}, + "select-map": {"en": "Select from Map", "ar": "حدد من الخريطة"}, + "no-appointment": {"en": "You don't have any appointments yet", "ar": "ليس لديك أي مواعيد حتى الآن"}, "patient-share": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patient-share-tax": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, - "patient-share-total": { - "en": "Total amount payable: ", - "ar": "المبلغ الإجمالي المستحق:" - }, + "patient-share-total": {"en": "Total amount payable: ", "ar": "المبلغ الإجمالي المستحق:"}, "select-ambulate": {"en": "Select Ambulate", "ar": "بحاجة للتنقل بواسطة"}, "wheelchair": {"en": "Wheelchair", "ar": "كرسي متحرك"}, "walker": {"en": "Walker", "ar": "مشاية"}, "stretcher": {"en": "Stretcher", "ar": "نقالة"}, "none": {"en": "None", "ar": "لا شيء"}, "RRT-Summary": {"en": "Summary", "ar": "ملخص الطلب"}, - "Rapid-Response-Team": { - "en": "Rapid Response Team", - "ar": "فريق الاستجابة السريع" - }, - "AmountBeforeTax": {"en": "Amount Before Tax:", "ar": "Amount Before Tax:"}, - "ApproximateServiceFee": { - "en": "Approximate Service Fee", - "ar": "Approximate Service Fee" - }, - "TaxAmount": {"en": "Tax Amount:", "ar": "Tax Amount:"}, - "somethingWentWrongTryLater": { - "en": "Sorry something went wrong please try again later", - "ar": "نعتذر لخدمتكم يرجى المحاولة لاحقا" - }, - "TotalAmountPayable": { - "en": "Total Amount Payable:", - "ar": "Total Amount Payable:" - }, - "iAcceptTermsConditions": { - "en": "I Accept the Terms And Conditions", - "ar": "You can pay by the following options:" - }, - "YouCanPayByTheFollowingOptions": { - "en": "You can pay by the following options:", - "ar": "I Accept the Terms And Conditions" - }, + "Rapid-Response-Team": {"en": "Rapid Response Team", "ar": "فريق الاستجابة السريع"}, + "AmountBeforeTax": {"en": "Amount Before Tax:", "ar": "المبلغ قبل الضريبة:"}, + "ApproximateServiceFee": {"en": "Service fee starting from", "ar": "تبدأ رسوم الخدمة من"}, + "TaxAmount": {"en": "Tax Amount:", "ar": "مبلغ الضريبة:"}, + "somethingWentWrongTryLater": {"en": "Sorry something went wrong please try again later", "ar": "نعتذر عن خدمتك يرجى المحاولة لاحقا"}, + "TotalAmountPayable": {"en": "Total Amount Payable:", "ar": " إجمالي المبلغ المستحق:"}, + "iAcceptTermsConditions": {"en": "I Accept the Terms and Conditions", "ar": "أوافق على الشروط والأحكام"}, + "YouCanPayByTheFollowingOptions": {"en": "You can pay by the following options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "RRTDDetails": { "en": - "The RRT service provides medical services urgent and stable cases, not life-threatening situation or extremities and the service includes providing medical care from a complete medical team at home", - "ar": - "The RRT service provides medical services urgent and stable cases, not life-threatening situation or extremities and the service includes providing medical care from a complete medical team at home" + "The RRT service provides medical service for urgent and stable cases, not life-threatening situations or extremities, and the service includes providing medical care from a complete medical team at home.", + "ar": "توفر خدمة فريق الاستجابة السريع RRT خدمه طبيه للحالات المستعجله والمستقره وليست الحالات المهدده للحياه او الاطراف ، وتشمل الخدمه تقديم رعايه طبيه من فريق طبي متكامل بالمنزل." }, - "rrtService": {"en": "RRT Service", "ar": "خدمة RRT"}, "bill-amount": {"en": "Bill Amount", "ar": "مبلغ الفاتورة"}, "transport-method": {"en": "Transportation Method", "ar": "طريقة النقل"}, "directions": {"en": "Directions", "ar": "الاتجاهات"}, "info-my-appointments": { - "en": - "This service allows you to see all the appointment you have visited in Al Habib Medical Group, and through this service:", - "ar": - "خدمة مواعيدي: هذه الخدمة تمكنك من الاطلاع على جميع المواعيد التي قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" + "en": "This service allows you to see all the appointment you have visited in Al Habib Medical Group, and through this service:", + "ar": "خدمة مواعيدي: هذه الخدمة تمكنك من الاطلاع على جميع المواعيد التي قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" }, "info-todo": { - "en": - "This service is designed to enable you to have a quick link to the list of tasks that need to be done", - "ar": - "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" + "en": "This service is designed to enable you to have a quick link to the list of tasks that need to be done", + "ar": "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" }, "family-info": { - "en": - "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", - "ar": - "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." - }, - "update-succ": { - "en": "Successfully updated profile", - "ar": "تم تحديث البيانات بنجاح" + "en": "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", + "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." }, + "update-succ": {"en": "Successfully updated profile", "ar": "تم تحديث البيانات بنجاح"}, "dental-complains": {"en": "Symptoms", "ar": "الأعراض"}, - "empty-result": { - "en": "There is no search results found", - "ar": "لايوجد نتائج" - }, - - "no-booked-appointment": { - "en": "No booked appointments", - "ar": "لا يوجد مواعيد محجوزة" - }, - "no-confirmed-appointment": { - "en": "No confirmed appointments", - "ar": "لا توجد مواعيد مؤكدة" - }, - "no-arrived-appointment": { - "en": "No arrived appointments", - "ar": "لا يوجد مواعيد" - }, - "upcoming-empty": { - "en": "You do not have any Todo actions yet.", - "ar": "ليس لديك أي إجراءات الآن." - }, - "upcoming-timeLeft": { - "en": "time left for appointment", - "ar": "الوقت المتبقي للموعد" - }, - "covid-test-all-services": { - "en": "Covid-19 Drive-Thru Test", - "ar": "فحص كورونا من داخل السيارة" - }, + "empty-result": {"en": "There is no search results found", "ar": "لايوجد نتائج"}, + "no-booked-appointment": {"en": "No booked appointments", "ar": "لا يوجد مواعيد محجوزة"}, + "no-confirmed-appointment": {"en": "No confirmed appointments", "ar": "لا توجد مواعيد مؤكدة"}, + "no-arrived-appointment": {"en": "No arrived appointments", "ar": "لا يوجد مواعيد"}, + "upcoming-empty": {"en": "You do not have any Todo actions yet.", "ar": "ليس لديك أي إجراءات الآن."}, + "upcoming-timeLeft": {"en": "time left for appointment", "ar": "الوقت المتبقي للموعد"}, + "covid-test-all-services": {"en": "Covid-19 Drive-Thru Test", "ar": "فحص كورونا من داخل السيارة"}, "pharmacy": {"en": "Pharmacy", "ar": "الصيدلية"}, "ereferral": {"en": "E-Referral", "ar": "طلب التحويل"}, "child-vaccine": {"en": "Child Vaccines", "ar": "تطعيمات الأطفال"}, @@ -1389,99 +982,53 @@ const Map localizedValues = { "blood-d": {"en": "Blood Donation", "ar": "تبرع بالدم"}, "symptomCheckerTitle": {"en": "Symptom Checker", "ar": "مدقق الأعراض"}, "latest-news": {"en": "Latest News", "ar": "أحدث الأخبار"}, - "our-location": {"en": "Our Locations", "ar": "موقعنا"}, + "our-location": {"en": "Our Locations", "ar": "مواقعنا"}, "pharmacies": {"en": "Pharmacies", "ar": "الصيدليات"}, "hospitals": {"en": "Hospitals", "ar": "المستشفيات"}, "wallet": {"en": "Wallet", "ar": "محفظة نقود"}, "hmg": {"en": "Al Habib", "ar": "الحبيب"}, - "requested": {"en": "Requested", "ar": "مطلوب"}, "ready": {"en": "Ready", "ar": "جاهز"}, "completed": {"en": "Completed", "ar": "مكتمل"}, - - "request-medical-report": { - "en": "Request medical report", - "ar": "طلب تقرير طبي" - }, + "request-medical-report": {"en": "Request medical report", "ar": "طلب تقرير طبي"}, "insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, 'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, 'details': {'en': 'Details', 'ar': 'التفاصيل'}, + 'graph-details': {'en': 'Graph Details', 'ar': 'التفاصيل الرسم البياني'}, "age": {"en": "Age", "ar": "العمر"}, "active-insurence": {"en": "Active", "ar": "نشطة"}, "not-active": {"en": "Not Active", "ar": "غير نشط"}, "card-detail": {"en": "Insurance Details", "ar": "منافعك التامينية"}, "Dr": {"en": "Dr. ", "ar": "الدكتور."}, "empty": {"en": "You do not have any records.", "ar": "ليس لديك أي سجلات"}, - "last-visit": { - "en": "How was your last visit with doctor?", - "ar": "كيف تقيم زيارتك الأخيرة للطبيب؟" - }, + "last-visit": {"en": "How was your last visit with doctor?", "ar": "كيف تقيم زيارتك الأخيرة للطبيب؟"}, "tap-title": {"en": "Please rate the doctor", "ar": "يرجى تقييم الطبيب"}, "later": {"en": "Later", "ar": "لاحقاً"}, - "sendSuc": { - "en": "A copy has been sent to the email", - "ar": "تم إرسال نسخة إلى البريد الإلكتروني" - }, + "sendSuc": {"en": "A copy has been sent to the email", "ar": "تم إرسال نسخة إلى البريد الإلكتروني"}, "instructions": { - "en": - "You can now talk directly to the appointments department by chat or request a call back", - "ar": - "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" - }, - "instructions-pharmacies": { - "en": - "You can now talk directly to the pharmacist by chat or request a call back", - "ar": - "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" + "en": "You can now talk directly to the appointments department by chat or request a call back", + "ar": "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" }, + "instructions-pharmacies": {"en": "You can now talk directly to the pharmacist by chat or request a call back", "ar": "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال"}, "select-hospital": {"en": "Choose Hospital", "ar": "اختر المستشفى"}, "start": {"en": "Start", "ar": "ابدأ"}, "info-chat": { - "en": - "This service allows you to chat with customer service directly without the need to call.", - "ar": - "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." - }, - "last-appointment": { - "en": "How was your appointment?", - "ar": "كيف كان موعدك الطبي ؟" + "en": "This service allows you to chat with customer service directly without the need to call.", + "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." }, + "last-appointment": {"en": "How was your appointment?", "ar": "كيف كان موعدك الطبي ؟"}, "rate-clinic": {"en": "Please rate the clinic", "ar": "يرجى تقييم العيادة"}, "fetch-data": {"en": "Fetch Data", "ar": "تحديث الان"}, "rate": {"en": "Rate", "ar": "تقييم"}, - "send-email": { - "en": "Send a copy of this report to the email", - "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني" - }, - "update-email-msg": { - "en": "Email updated", - "ar": "تم تحديث البريد الالكتروني" - }, + "send-email": {"en": "Send a copy of this report to the email", "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني"}, + "update-email-msg": {"en": "Email updated", "ar": "تم تحديث البريد الالكتروني"}, "update-email": {"en": "Update Email", "ar": "تحديث البريد الالكتروني"}, - "booked-success": { - "en": "The appointment has been successfully booked.", - "ar": "لقد تم حجز الموعد بنجاح" - }, - "appo-reminder-select-option-30": { - "en": "Before 30 Mins", - "ar": "قبل 30 دقيقة" - }, - "appo-reminder-select-option-60": { - "en": "Before 1 Hour", - "ar": "قبل ساعة واحدة" - }, - "appo-reminder-select-option-90": { - "en": "Before 1 Hour and 30 mins", - "ar": "قبل ساعة و 30 دقيقة" - }, - "appo-reminder-select-option-120": { - "en": "Before 2 Hours", - "ar": "قبل ساعتين" - }, - "noDataAvailable": { - "en": "No data available", - "ar": " لا يوجد بيانات متاحة " - }, + "booked-success": {"en": "The appointment has been successfully booked.", "ar": "لقد تم حجز الموعد بنجاح"}, + "appo-reminder-select-option-30": {"en": "Before 30 Mins", "ar": "قبل 30 دقيقة"}, + "appo-reminder-select-option-60": {"en": "Before 1 Hour", "ar": "قبل ساعة واحدة"}, + "appo-reminder-select-option-90": {"en": "Before 1 Hour and 30 mins", "ar": "قبل ساعة و 30 دقيقة"}, + "appo-reminder-select-option-120": {"en": "Before 2 Hours", "ar": "قبل ساعتين"}, + "noDataAvailable": {"en": "No data available", "ar": " لا يوجد بيانات متاحة "}, "thename": {"en": "The Name", "ar": "الاسم"}, "noSearchResult": {"en": "No Search Result", "ar": "لا توجد نتيجة بحث"}, "selectFileSouse": {"en": "Select file souse", "ar": "حدد الملف"}, @@ -1489,69 +1036,40 @@ const Map localizedValues = { "camera": {"en": "Camera", "ar": "كاميرا"}, "med-report": {"en": "Medical Reports", "ar": "التقارير الطبية"}, "new-med-report": {"en": "Requests", "ar": "الطلبات"}, - "requestReport": {"en": "Request a report", "ar": " طلب تقرير"}, - "confirm-msg-report": { - "en": "Request for medical report?", - "ar": "طلب تقرير طبي؟" - }, - "successSendReport": { - "en": "The request has been submitted successfully", - "ar": "تم تنفيذ طلبك بنجاح" - }, + "requestReport": {"en": "Request a report", "ar": "طلب تقرير"}, + "confirm-msg-report": {"en": "Request for medical report?", "ar": "طلب تقرير طبي؟"}, + "successSendReport": {"en": "The request has been submitted successfully", "ar": "تم تنفيذ طلبك بنجاح"}, "pulseTitle": {"en": "Heart rate", "ar": "معدل النبض بالدقيقة"}, "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, "policy-holder": {"en": "Policy Holder", "ar": "حامل بطاقة التأمين"}, - "policy-no": {"en": "Policy Number", "ar": "رقم سياسات"}, - "agree": { - "en": "I agree, this is the correct information", - "ar": "موافق، هذه المعلومات صحيحة" - }, - "disagree": { - "en": "No, this is not the correct information", - "ar": "غير موافق، هذه المعلومات غير الصحيحة" - }, + "policy-no": {"en": "Policy Number", "ar": "رقم السياسة"}, + "agree": {"en": "I agree, this is the correct information", "ar": "موافق، هذه المعلومات صحيحة"}, + "disagree": {"en": "No, this is not the correct information", "ar": "غير موافق، هذه المعلومات غير الصحيحة"}, "expiry-date": {"en": "Expiry Date", "ar": "تاريخ انتهاء الصلاحية"}, "class": {"en": "Class", "ar": "فئة"}, + "offersdiscount": {"en": "Offers \& Discounts", "ar": "العروض والخصومات"}, + "explore": {"en": "Explore Now", "ar": "استكشف الآن"}, "approval": {"en": "Approval", "ar": "موافقة"}, "no-data": {"en": "No data found", "ar": "لاتوجد بيانات"}, "insurance-details": {"en": "Insurance Details", "ar": "تفاصيل التأمين"}, "nearest-hospital": {"en": "Nearest Hospital", "ar": "أقرب مستشفى"}, - "request-sent": { - "en": "Request sent successfully", - "ar": "تم إرسال الطلب بنجاح" - }, - "message-sent": { - "en": "Message sent successfully", - "ar": "تم إرسال الرسالة بنجاح" - }, + "submitReview": {"en": "Your review has been Submitted successfully", "ar": "تم إرسال التقييم بنجاح"}, + "request-sent": {"en": "Request sent successfully", "ar": "تم إرسال الطلب بنجاح"}, + "message-sent": {"en": "Message sent successfully", "ar": "تم إرسال الرسالة بنجاح"}, "sent-on": {"en": "Sent on", "ar": "أرسلت في"}, - "attach-insurace-image": { - "en": "Attach insurance card image", - "ar": "إرفاق صورة بطاقة التأمين" - }, - "upload-without-image": { - "en": "You can still submit, if you don't have Insurance Image", - "ar": "لا يزال بإمكانك الإرسال ، إذا لم يكن لديك صورة تأمين" - }, + "attach-insurace-image": {"en": "Attach insurance card image", "ar": "إرفاق صورة بطاقة التأمين"}, + "upload-without-image": {"en": "You can still submit, if you don't have Insurance Image", "ar": "لا يزال بإمكانك الإرسال ، إذا لم يكن لديك صورة تأمين"}, "info-insur-cards": { - "en": - "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", - "ar": - "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" - }, - "scan-now": { - "en": "If you have a card/Document Scan now", - "ar": "إذا كانت لديك بطاقة / مستند ارفقها الان" + "en": "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", + "ar": "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" }, + "scan-now": {"en": "If you have a card/Document Scan now", "ar": "إذا كانت لديك بطاقة / مستند ارفقها الان"}, "liveCare": {"en": "Live Care", "ar": "لايف كير"}, "topBrands": {"en": "Top Brands", "ar": "اعلى العلامات التجارية"}, - "notifyMe": {"en": "notify me", "ar": "اعلمني"}, "specification": {"en": "Specification", "ar": "تخصيص"}, - - "availability": {"en": "Availability", "ar": "التوفر"}, - + "availability": {"en": "Availability", "ar": "متوفر في"}, "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, "quantitySize": {"en": "Quantity", "ar": "كميه"}, @@ -1562,124 +1080,64 @@ const Map localizedValues = { "no_data": {"en": "No data", "ar": "لايوجد بيانات"}, "buyNow": {"en": "buy now", "ar": "إشتري الان"}, "quantityShortcut": {"en": "QTY", "ar": "كمية"}, - - "pharmacyServiceTermsCondition": { - "en": - "I agree with the terms of service and I adhere to them unconditionally", - "ar": " أوافق على شروط الخدمة وألتزم بها دون قيد أو شرط" - }, + "pharmacyServiceTermsCondition": {"en": "I agree with the terms of service and I adhere to them unconditionally", "ar": " موافق على شروط الخدمة وألتزم بها دون قيد أو شرط"}, "Year": {"en": "YEAR", "ar": "السنة"}, "Month": {"en": "MONTH", "ar": "الشهر"}, "point": {"en": "POINT", "ar": "النقاط"}, "riyal": {"en": "RIYAL", "ar": "الريال"}, "termOfService": {"en": "Terms of service", "ar": "شروط الخدمة"}, "shoppingCart": {"en": "Shopping Cart", "ar": "عربة التسوق"}, - "add-child": {"en": "Add New Child", "ar": "اضافة طفل"}, "child-name": {"en": "Child Name", "ar": "اسم الطفل"}, "childDob": {"en": "Birth Date", "ar": "تاريخ الولادة"}, - "deleted-child-mes": { - "en": - "The request was successful. The children have removed from the vaccination schedule subscription service.", - "ar": "تم حذف الطفل بنجاح" - }, + "deleted-child-mes": {"en": "The request was successful. The children have removed from the vaccination schedule subscription service.", "ar": "تم حذف الطفل بنجاح"}, "deleted-child": {"en": "Delete child", "ar": "إالغاء الطفل"}, "visit": {"en": "Visit", "ar": "زيارة"}, "referralStatus": {"en": "Referral Status", "ar": "حالة الإحالة"}, "referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"}, "patientName": {"en": "Patient Name", "ar": "اسم المريض"}, "referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"}, - "requestID": {"en": "Request ID", "ar": " رقم الطلب"}, + "requestID": {"en": "Req ID", "ar": " رقم الطلب"}, "OrderStatus": {"en": "Status", "ar": "الحاله"}, "pickupDate": {"en": "Pickup Date", "ar": "التاريخ"}, "serviceName": {"en": "Service Name", "ar": " اسم الخدمة"}, "orderLocation": {"en": "Location", "ar": "الموقع"}, "selectService": {"en": "Select Service", "ar": "حدد الخدمة"}, - "coveredService": {"en": "Covered Service : ", "ar": " الخدمات المغطاة : "}, - "selectedService": { - "en": "Selected Service : ", - "ar": " الخدمات المختارة : " - }, - "cancelOrderMsg": { - "en": "Are you sure!! want to cancel this order", - "ar": "هل أنت واثق!! تريد إلغاء هذا الطلب" - }, - "processDoneSuccessfully": { - "en": "Process Done Successfully", - "ar": "تمت العملية بنجاح" - }, - "selectHomeHealthCareServices": { - "en": "Select Home Health Care Services", - "ar": " حدد خدمات الرعاية الصحية المنزلية" - }, + "coveredService": {"en": "Covered Services: ", "ar": " الخدمات المغطاة: "}, + "selectedService": {"en": "Selected Services: ", "ar": " الخدمات المختارة: "}, + "cancelOrderMsg": {"en": "Are you sure!! want to cancel this order", "ar": "هل ترغب في إلغاء هذا الطلب"}, + "processDoneSuccessfully": {"en": "Process Done Successfully", "ar": "تمت العملية بنجاح"}, + "selectHomeHealthCareServices": {"en": "Select Home Health Care Services", "ar": " حدد خدمات الرعاية الصحية المنزلية"}, "description-vaccination": {"en": "Description", "ar": "وصف"}, "due-date": {"en": "Due date", "ar": "تاريخ الاستحقاق"}, - "valid-email": { - "en": "Please enter valid email", - "ar": "الرجاء إدخال عنوان بريد صحيح" - }, - "confirm-send": { - "en": "Send the child's schedule to the email?", - "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟" - }, - "email-success": { - "en": - " The request was successful. You will receive the Schedule in moments.", - "ar": "تم ارسال جدول التطعيمات " - }, - "add-instructions": { - "en": - "Add the child's information below to recieve the schedule of vaccinations.", - "ar": "أضف معلومات الطفل لاستلام جدول التطعيمات" - }, - "added-child": { - "en": - "The request was successful. You have added a child to the vaccination schedule subscription service.", - "ar": "تمت الاضافة بنجاح." - }, + "valid-email": {"en": "Please enter valid email", "ar": "الرجاء إدخال بريد الكتروني صحيح"}, + "confirm-send": {"en": "Send the child's schedule to the email?", "ar": "ارسال جدول التطعيمات الى بريدك الالكتروني؟"}, + "email-success": {"en": " The request was successful. You will receive the Schedule in moments.", "ar": "تم ارسال جدول التطعيمات "}, + "add-instructions": {"en": "Add the child's information below to recieve the schedule of vaccinations.", "ar": "أضف معلومات الطفل لاستلام جدول التطعيمات"}, + "added-child": {"en": "The request was successful. You have added a child to the vaccination schedule subscription service.", "ar": "تمت الاضافة بنجاح."}, "appUpdate": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"}, "ereferralSaveSuccess": { - "en": - "The referral request has been submitted successfully, you will be contacted ASAP to complete the process. Referral request no is ", - "ar": - " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية. رقم طلب الإحالة" + "en": "The referral request has been submitted successfully, you will be contacted ASAP to complete the process.", + "ar": " تم إرسال طلب الإحالة بنجاح ، وسيتم الاتصال بك في أسرع وقت ممكن لإكمال العملية." }, - "help": {"en": "Help", "ar": "مساعدة"}, - "habibRobotText": { - "en": - "Hi, This is HABIB, your personal assistant. I'm here to assist you by voice commands. How can I help?", + "en": "Hi, this is HABIB, your personal assistant. I'm here to assist you by voice commands. How can I help?", "ar": "مرحباً ، معك حبيب مساعدك الشخصي. أنا هنا لمساعدتك بالأوامر الصوتية." }, - "updated-email": { - "en": "Updated email successfully", - "ar": "تم تحديث البريد الالكتروني" - }, - - "view-list-children": { - "en": "View List of Children", - "ar": "عرض قائمة الأطفال" - }, + "updated-email": {"en": "Updated email successfully", "ar": "تم تحديث البريد الالكتروني"}, + "view-list-children": {"en": "View List of Children", "ar": "عرض قائمة الأطفال"}, "covidTest": {"en": "COVID-19 TEST", "ar": "فحص كورونا"}, - "driveThru": {"en": "Drive-Thru", "ar": "من السيارة"}, - "trackDeliveryDriver": { - "en": "Track Delivery Driver", - "ar": "trackDeliveryDriver" - }, - + "driveThru": {"en": "Drive-Thru", "ar": "من داخل السيارة"}, + "trackDeliveryDriver": {"en": "Track Delivery Driver", "ar": "تتبع السائق"}, "NearestErDesc": { - "en": - "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", - "ar": - "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." + "en": "This service Displays nearest branch among all the branches of All Habib medical Group based on your current Location", + "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, - "NearestEr": {"en": "Nearest ER", "ar": "أقرب ER"}, + "NearestEr": {"en": "Nearest ER", "ar": "اقرب طوارئ"}, "infoCMC": { - "en": - "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", - "ar": - "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" + "en": "Through this service, you can request a set of tests that help you and your doctor to understand the current health condition and then identify potential risks.", + "ar": "من خلال هذه الخدمة يمكنك طلب مجموعة من الفحوصات التي تساعدك وتساعد طبيبك في فهم حالتك الصحية الحالية ومن ثم تحديد المخاطر المحتملة" }, "instructionAgree": { "en": @@ -1690,68 +1148,41 @@ const Map localizedValues = { "reqId": {"en": "Request ID:", "ar": " رقم الطلب"}, "RRT-orders-log": {"en": "Orders Log", "ar": "سجل الطلبات"}, "blood-sugar": {"en": "Blood Sugar", "ar": "سكر الدم"}, - - "covid19_driveThrueTest": { - "en": "'Covid-19- Drive-Thru Test'", - "ar": "Covid-19- الفحص من خلال القيادة" - }, + "covid19_driveThrueTest": {"en": "'Covid-19- Drive-Thru Test'", "ar": " الفحص من داخل السيارة"}, "E-Referral": {"en": "'E-Referral'", "ar": "الإحالة الإلكترونية"}, "childName": {"en": "'CHILD NAME'", "ar": "إسم الطفل"}, "recordDeleted": {"en": "'Record Deleted'", "ar": "تم حذف السجل"}, "msg_email_address_up_to_date": { - "en": - "Please ensure that the email address is up-to-date and process to view the schedule", - "ar": - "يرجى التأكد من أن عنوان البريد الإلكتروني محدث وأن العملية لعرض الجدول الزمني" + "en": "Please ensure that the email address is up-to-date and proceed to view the schedule.", + "ar": " يرجى التأكد من تحديث عنوان البريد الإلكتروني والمتابعة لعرض الجدول" }, "add-new-child": {"en": "ADD NEW CHILD", "ar": "إضافة طفل جديد"}, - - "send-child-email-msg": { - "en": "Send the child's schedule to the email", - "ar": "أرسل جدول الطفل إلى البريد الإلكتروني" - }, - - "vaccination-add-child-msg": { - "en": - "Add the child's information below to receive the schedule of vaccinations.", - "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات." - }, - "child_added_successfully": { - "en": "Child added successfully", - "ar": "تمت إضافة الطفل بنجاح" - }, + "send-child-email-msg": {"en": "Send the child's schedule to the email", "ar": "أرسل جدول التطعيمات إلى البريد الإلكتروني"}, + "vaccination-add-child-msg": {"en": "Add the child's information below to receive the schedule of vaccinations.", "ar": "أضف معلومات الطفل أدناه للحصول على جدول التطعيمات."}, + "child_added_successfully": {"en": "Child added successfully", "ar": "تمت إضافة الطفل بنجاح"}, "bloodSugar": {"en": "Blood", "ar": "السكر في الدم"}, - "sugar": {"en": "Sugar", "ar": ""}, + "sugar": {"en": "Sugar", "ar": "السكر"}, "bloodCholesterol": {"en": "Blood", "ar": " الكولسترول في الدم"}, - - "cholesterol": {"en": "Cholesterol", "ar": ""}, + "cholesterol": {"en": "Cholesterol", "ar": " الكولسترول"}, "triglycerides": {"en": "Triglycerides", "ar": "الدهون الثلاثية"}, - - "fatInBlood": {"en": "Fat In Blood", "ar": ""}, - "convertFrom": {"en": "Convert From", "ar": "تحويل من"}, - "calculate": {"en": "calculate", "ar": "حساب"}, + "fatInBlood": {"en": "Fat in Blood", "ar": ""}, + "convertFrom": {"en": "Convert from", "ar": "تحويل من"}, + "calculate": {"en": "Calculate", "ar": "احسب"}, "enterReadingValue": {"en": "Enter the reading value", "ar": "ادخل القيمة"}, "result": {"en": "Result", "ar": "النتيجة"}, "sort": {"en": "Sort", "ar": "فرز"}, - "bloodSugarConversion": { - "en": "Blood Sugar Conversion", - "ar": "السكر في الدم" - }, + "bloodSugarConversion": {"en": "Blood Sugar Conversion", "ar": "السكر في الدم"}, "convertBloodSugarStatement": { - "en": - "Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.", - "ar": - "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + "en": "Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.", + "ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "convertCholesterolStatement": { - "en": "Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.", - "ar": - "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + "en": "Convert blood cholesterol from mmol/l to mg/dlt and vice versa.", + "ar": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "triglyceridesConvertStatement": { "en": "Convert Triglycerides from mmol/l to mg/dlt and vice versa.", - "ar": - "تحويل مستوى الدهون الثلاثية في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" + "ar": "تحويل مستوى الدهون الثلاثية في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "my-tracker": {"en": "My Tracker", "ar": "قراءاتي"}, "weekly": {"en": "Weekly", "ar": "أسبوعي"}, @@ -1762,26 +1193,15 @@ const Map localizedValues = { "other": {"en": "Other", "ar": "آخر"}, "measure-unit": {"en": "Measure unit", "ar": "وحدة القياس"}, "measure-time": {"en": "Measure time", "ar": "وقت القياس"}, - "update": {"en": "Update", "ar": "تعديل"}, - "bloodD-enter-desc": { - "en": - "Enter the required information, In order to register for Blood Donation Service", - "ar": "أدخل المعلومات المطلوبة ، للتسجيل في خدمة التبرع بالدم" - }, - "viewTermsConditions": { - "en": "To view the terms and conditions", - "ar": "لعرض الشروط والأحكام" - }, - "WalkinAppo": { - "en": "Hospital Visit Appointment", - "ar": "موعد زيارة للمستشفى" - }, - + "update": {"en": "Update", "ar": "تحديث"}, + "bloodD-enter-desc": {"en": "Enter the required information, in order to register for Blood Donation Service", "ar": "أدخل المعلومات المطلوبة ، للتسجيل في خدمة التبرع بالدم"}, + "viewTermsConditions": {"en": "To view the terms and conditions", "ar": "لعرض الشروط والأحكام"}, + "WalkinAppo": {"en": "Hospital Visit Appointment", "ar": "موعد زيارة للمستشفى"}, "videoAppo": {"en": "Video Call Appointment", "ar": "موعد اتصال فيديو"}, - "generalHealth": {"en": "General Health", "ar": "صحة عامة"}, "womanHealth": {"en": "Women's Health", "ar": "صحة المرأة"}, "bmi": {"en": "BMI", "ar": "الكتلة"}, + "bloodType": {"en": "Blood Type:", "ar": "فصيلة الدم"}, "calc-health": {"en": "Calculators", "ar": "الصحية"}, "calories": {"en": "Calories", "ar": "سعرات"}, "bmr": {"en": "BMR", "ar": "معدل الأيض القاعدي"}, @@ -1793,19 +1213,17 @@ const Map localizedValues = { "ovulation": {"en": "Ovulation", "ar": "الإباضة"}, "delivery": {"en": "Delivery", "ar": "الولادة"}, "bmiCalcDesc": { - "en": - "'Calculate the BMI value and weight\n status to identify the healthy weight .\n Not appropriate for children and women\n who are pregnant or breastfeeding'", - "ar": - "حساب قيمة مؤشر كتلة الجسم وحالة الوزن لتحديد الوزن الصحي. \n وغير مناسب للأطفال والنساء الحوامل أو المرضعات" + "en": "Calculate the BMI value and weight status to identify the healthy weight. Not appropriate for children and women who are pregnant or breastfeeding", + "ar": "احسب قيمة مؤشر كتلة الجسم وحالة الوزن لتحديد الوزن الصحي. غير مناسب للأطفال والنساء الحوامل أو المرضعات" }, "selectUnit": {"en": "Select Unit", "ar": "اختر الوحدة"}, "feet": {"en": "Feet", "ar": "قدم"}, "pound": {"en": "Pound", "ar": "رطل"}, - "seeListOfDoctor": {"en": "See List Of Doctors", "ar": "انظر قائمة الأطباء"}, + "seeListOfDoctor": {"en": "See List of Doctors", "ar": "انظر قائمة الأطباء"}, "obese": {"en": "Obese", "ar": "سمين"}, "overWeight": {"en": "OverWeight", "ar": "وزن زائد"}, "healthy": {"en": "Healthy", "ar": "صحي"}, - "underWeight": {"en": "UnderWeight", "ar": "نقص الوزن"}, + "underWeight": {"en": "UnderWeight", "ar": "وزن ناقص"}, "bmiCalcMsgObese": { "en": "A BMI of over 30 indicates that are heavily overweight. Health may be at risk if not lose weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.", @@ -1821,8 +1239,7 @@ const Map localizedValues = { "bmiCalcMsgHealthy": { "en": "A BMI of 18.5 - 25 indicates that are at a healthy weight for the height. By maintaining a healthy weight, lower the risk of developing severe health problems. To book an appointment, click below to get started.", - "ar": - "يشير مؤشر كتلة الجسم من 18.5 - 25 إلى وزن صحي بالنسبة للطول. بالحفاظ على وزن صحي ، قلل من خطر الإصابة بمشاكل صحية خطيرة. لحجز موعد ، انقر أدناه للبدء." + "ar": "يشير مؤشر كتلة الجسم من 18.5 - 25 إلى وزن صحي بالنسبة للطول. بالحفاظ على وزن صحي ، قلل من خطر الإصابة بمشاكل صحية خطيرة. لحجز موعد ، انقر أدناه للبدء." }, "bmiCalcMsgUnderWeight": { "en": @@ -1830,25 +1247,18 @@ const Map localizedValues = { "ar": "يشير مؤشر كتلة الجسم الذي يقل عن 18.5 إلى أنك تعاني من نقص الوزن ، لذلك قد تحتاج إلى زيادة الوزن. يوصى بالتحدث إلى الطبيب أو أخصائي التغذية للحصول على المشورة. لحجز موعد ، انقر أدناه للبدء." }, - "bariatrics": {"en": "Bariatrics", "ar": "طب السمنة"}, + "bariatrics": {"en": "Bariatrics", "ar": " أمراض السمنة"}, "bariatricsHeaderMsg": { - "en": - "Choose one of the following symptoms to show the right doctors or choose a consultation to show all", - "ar": - "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل" + "en": "Choose one of the following symptoms to show the right doctors or choose a consultation to show all", + "ar": "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل" }, - "continue": {"en": "CONTINUE", "ar": "إستمرار"}, + "continue": {"en": "Continue", "ar": "إستمرار"}, "skip": {"en": "SKIP", "ar": "تخطى"}, "calorieCalcDesc": { - "en": - "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ", - "ar": - "يحسب السعرات الحرارية اليومية بناءً على عدة عوامل ، مثل الطول والوزن والعمر والجنس والنشاط البدني اليومي" - }, - "age11_120_years": { - "en": "The Age ( 11 - 120 ) yrs", - "ar": "العمر (11 - 120) سنة" + "en": "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ", + "ar": "يحسب السعرات الحرارية اليومية بناءً على عدة عوامل ، مثل الطول والوزن والعمر والجنس والنشاط البدني اليومي" }, + "age11_120_years": {"en": "The Age (11 - 120) yrs", "ar": "العمر (11 - 120) سنة"}, "weight-add": {"en": "Enter Weight Value", "ar": "أدخل الوزن "}, "systolic-add": {"en": "Enter Systolic Value", "ar": "أدخل قيمة الإنقباض "}, "diastolic-add": {"en": "Enter Diastolic Value", "ar": "أدخل قيمة الإنبساط "}, @@ -1856,429 +1266,214 @@ const Map localizedValues = { "today": {"en": "Today", "ar": "اليوم"}, "week": {"en": "Week", "ar": "أسبوع"}, "month": {"en": "Month", "ar": "شهر"}, - "h2o-amount-of-water": { - "en": "Enter the amount of water:", - "ar": "ادخل كمية الماء:" - }, + "enter_detail_below": {"en": "Enter the details below", "ar": "أدخل التفاصيل أدناه"}, + "h2o-amount-of-water": {"en": "Enter the amount of water:", "ar": "ادخل كمية الماء:"}, "update-user": {"en": "Update Information", "ar": "تحديث بيانات"}, "editname": {"en": "Enter the name here", "ar": "أدخل الاسم هنا"}, "activity-level": {"en": "Activity Level", "ar": "مستوى النشاط"}, "light-active": {"en": "Lightly Active", "ar": " قليل النشاط"}, "mod-active": {"en": "Moderately Active", "ar": "متوسط النشاط"}, - "reminder-label": { - "en": "Activate the reminder of drink water?", - "ar": "تفعيل خاصية تذكير شرب الماء؟" - }, - "reminder-times-label": { - "en": "How many times do you want to be reminded?", - "ar": "عدد مرات التذكير" - }, + "reminder-label": {"en": "Activate the reminder of drink water?", "ar": "تفعيل خاصية تذكير شرب الماء؟"}, + "reminder-times-label": {"en": "How many times do you want to be reminded?", "ar": "عدد مرات التذكير"}, "times": {"en": "Times", "ar": "مرات"}, "WaterCalculate": {"en": "Save", "ar": "حفظ"}, "notif-title": {"en": "Water Reminder", "ar": "تذكير"}, - "notif-text": { - "en": " Don't forget to drink water.", - "ar": "لا تنسى شرب الماء" - }, - "custom": {"en": "Custom", "ar": "خاص"}, + "notif-text": {"en": " Don't forget to drink water.", "ar": "لا تنسى شرب الماء"}, + "custom": {"en": "Custom", "ar": "مخصص"}, "undo": {"en": "Undo", "ar": "تراجع"}, "drinking": {"en": "Drinkning", "ar": "الشرب"}, "remaining": {"en": "Remaining", "ar": "المتبقي"}, + "addCustomAmount": {"en": "Add Custom Amount", "ar": "إضافة كمية محددة"}, + "left": {"en": "Left", "ar": "المتبقي"}, "taken": {"en": "Taken", "ar": " مأخوذ"}, "ml": {"en": "ML", "ar": "مل"}, + "mililitre": {"en": "Mililitre (ml)", "ar": "مليلتر (مل)"}, "l": {"en": "L", "ar": "لتر"}, + "litre": {"en": "Litre (l)", "ar": "لتر (لتر)"}, "custom-label": {"en": "Enter amount", "ar": "أدخل كمية الماء"}, - "custom-label-in-litres": { - "en": "Enter amount in liters", - "ar": "أدخل الكمية باللتر" - }, - "custom-label-in-mililitres": { - "en": "Enter amount in millilitres", - "ar": "أدخل الكمية بالملليتر" - }, + "custom-label-in-litres": {"en": "Enter amount in liters", "ar": "أدخل الكمية باللتر"}, + "custom-label-in-mililitres": {"en": "Enter amount in millilitres", "ar": "أدخل الكمية بالملليتر"}, "amount": {"en": "Amount", "ar": "الكمية"}, - "target-reach": { - "en": "You have reached the target for the day!", - "ar": "لقد حققت هدفك اليومي! مبروك" - }, - "week-header": { - "en": "Water consumed in a week", - "ar": "معدل شرب الماء خلال الاسبوع" - }, - "month-header": { - "en": "Water consumed in a month", - "ar": "معدل شرب الماء خلال الشهر" - }, - "notif-permission-title": { - "en": "Could not set the water reminders", - "ar": "لا يمكن ضبط اشعار شرب الماء" - }, - "notif-permission-msg": { - "en": - "To recieve water reminders, please turn on notifications in the system settings", - "ar": "الرجاء تفعيل الاشعارات في الاعدادات" - }, - "verification_message_code": { - "en": "Please enter verification code", - "ar": "الرجاء إدخال رمز التحقق" - }, - "select-location": {"en": "Select Location", "ar": "اختر موقعا"}, - "result-header": { - "en": "Get the result in Few Hours", - "ar": "احصل على النتيجة خلال عدة ساعات" - }, + "target-reach": {"en": "You have reached the target for the day!", "ar": "لقد حققت هدفك اليومي! مبروك"}, + "week-header": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, + "month-header": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, + "notif-permission-title": {"en": "Could not set the water reminders", "ar": "لا يمكن ضبط اشعار شرب الماء"}, + "notif-permission-msg": {"en": "To recieve water reminders, please turn on notifications in the system settings", "ar": "الرجاء تفعيل الاشعارات في الاعدادات"}, + "verification_message_code": {"en": "Please enter verification code", "ar": "الرجاء إدخال رمز التحقق"}, + "select-location": {"en": "Select Location", "ar": "اختر الموقع"}, + "result-header": {"en": "Get the result in Few Hours", "ar": "احصل على النتيجة خلال عدة ساعات"}, + "please_select_gender": {"en": "Please select gender", "ar": "يرجى تحديد الجنس"}, "covid-info": { "en": "Dr. Sulaiman Al Habib hospitals are conducting a test for the emerging corona virus and issuing travel certificates 24/7 in a short time and with high accuracy. Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches to conduct a corona test within few minutes, and obtain the result within several hours. Corona Virus Covid 19 testing service with PCR technology to detect the virus according to the highest international standards and with the latest high-precision RT-PCR devices (American GeneXpert and others), That is approved by the Food and Drug Authority as well as by the Saudi Center for Infectious Diseases Prevention.", "ar": "تجري مستشفيات د. سليمان الحبيب فحص فيروس كورونا المستجد وتصدر شهادات السفر على مدار الساعة، طوال أيام الأسبوع، وبسرعة ودقة عالية. يمكن للراغبين في الاستفادة من هذه الخدمة زيارة أحد فروع مستشفيات د. سليمان الحبيب وإجراء فحص كورونا خلال بضع دقائق والحصول على النتائج خلال عدة ساعات خدمة فحص فيروس كورونا Covid 19 بتقنية PCR للكشف عن الفيروس وفقاً لأعلى المعايير العالمية وبأحدث أجهزة RT-PCR عالية الدقة (GeneXpert الأمريكي وغيره)، وهي طرق معتمدة من قبل هيئة الغذاء والدواء وكذلك من قبل المركز السعودي للوقاية من الأمراض المُعدية" }, - "select-appo": { - "en": "Kindly select one of the available appointments from below:", - "ar": "يرجى اختيار أحد المواعيد المتاحة من أدناه:" - }, - "covid-alert-header": { - "en": "Pay With-in 15 mins to confirm the appointment", - "ar": "الرجاء اتمام عملية الدفع خلال 15 دقيقه لتاكيد الموعد" - }, + "select-appo": {"en": "Kindly select one of the available appointments from below:", "ar": " يرجى اختيار أحد المواعيد المتاحة مما يلي:"}, + "covid-alert-header": {"en": "Pay With-in 15 mins to confirm the appointment", "ar": "الرجاء اتمام عملية الدفع خلال 15 دقيقه لتاكيد الموعد"}, "covid-alert-info": { - "en": - "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​", - "ar": - "سيتم الغاء الموعد عن طريق النظام بشكل الي في حال عدم اتمام عمليه الدفع خلال 15 دقيقة​" + "en": "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​", + "ar": "سيتم الغاء الموعد عن طريق النظام بشكل الي في حال عدم اتمام عمليه الدفع خلال 15 دقيقة​" }, "covid-alert-mins": {"en": "Pay With-in 15 mins", "ar": "ادفع خلال 15 دقيقة"}, "back": {"en": "Back", "ar": "رجوع"}, "get-directions": {"en": "Get Directions", "ar": "احصل على الاتجاهات"}, "selected-location": {"en": "Selected Location:", "ar": "الموقع المحدد:"}, - "test-fee": {"en": "Test Fee", "ar": "رسوم الاختبار"}, - "pay-options": { - "en": "You can pay by the following Options:", - "ar": "يمكنك الدفع عن طريق الخيارات التالية:" - }, + "test-fee": {"en": "Test Fee", "ar": "الرسوم"}, + "pay-options": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "livecare-service": {"en": "LiveCare Service", "ar": "خدمة لايف كير"}, - "livecare-service-desc": { - "en": - "is to obtain medical advice with a specialist doctor Via a video call", - "ar": "هي الحصول على استشارة طبية مع طبيب مختص عن طريق اتصال فيديو" - }, - "why-livecare": {"en": "WHY LIVECARE", "ar": "لماذا خدمة اللايف كير"}, - "livecare-point-1": { - "en": - "No need to wait you will get Medical consultation immediately via Video call", - "ar": - "لا داعي للانتظار سوف تحصل على الاستشارة الطبية فورا عن طريق مكالمة الفيديو" - }, - "doc-virtual-appo-ins4": { - "en": "The doctor will see your medical file", - "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كامل" - }, - "doc-virtual-appo-ins5": { - "en": "Free prescription delivery service", - "ar": "خدمة توصيل الادوية مجانا" - }, + "livecare-service-desc": {"en": "is to obtain medical advice with a specialist doctor Via a video call", "ar": "هي الحصول على استشارة طبية مع طبيب مختص عن طريق اتصال فيديو"}, + "why-livecare": {"en": "Why LiveCare?", "ar": "?لماذا خدمة اللايف كير"}, + "livecare-point-1": {"en": "No need to wait you will get Medical consultation immediately via Video call", "ar": "لا داعي للانتظار سوف تحصل على الاستشارة الطبية فورا عن طريق مكالمة الفيديو"}, + "doc-virtual-appo-ins4": {"en": "The doctor will see your medical file", "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كامل"}, + "doc-virtual-appo-ins5": {"en": "Free prescription delivery service", "ar": "خدمة توصيل الادوية مجانا"}, "livecare-summary": { - "en": - "** The service is included with some insurance companies according to the terms and conditions With our best wishes for health and wellness", - "ar": - "** الخدمة مشمولة لدى بعض شركات التامين على حسب الشروط والاحكام مع تمنياتنا لكم بدوام الصحة والعافية" - }, - "livecare-option-1": { - "en": "Get Medical consultation immediately", - "ar": "الحصول على الاستشارة فورا" + "en": "** The service is included with some insurance companies according to the terms and conditions with our best wishes for health and wellness", + "ar": "** الخدمة مشمولة لدى بعض شركات التامين على حسب الشروط والاحكام مع تمنياتنا لكم بدوام الصحة والعافية" }, + "livecare-option-1": {"en": "Get consultation immediately", "ar": "الحصول على الاستشارة فورا"}, "livecare-option-2": {"en": "Instant video call", "ar": "اتصال فيديو فوري"}, "livecare-option-3": {"en": "Book Appointment", "ar": "حجز موعد"}, "livecare-option-4": {"en": "Schedule video call", "ar": "اتصال فيديو مجدول"}, "sms_code": {"en": "Enter SMS Code here", "ar": "أدخل رمز التحقق هنا"}, - "code_failure": { - "en": "Didn’t received the code", - "ar": "لم أستلم رمز التحقق" - }, + "code_failure": {"en": "Didn’t received the code", "ar": "لم أستلم رمز التحقق"}, "resend": {"en": "Resend", "ar": "إعادة إرسال"}, "submitncontinue": {"en": "Submit and continue", "ar": "إرسال ومتابعة"}, - "areyousure": { - "en": "Are you sure you want to Add", - "ar": "هل أنت متأكد أنك تريد إضافة" - }, - "preferredunit": { - "en": "Select the preferred unit", - "ar": "اختر الوحدة المفضلة" - }, + "areyousure": {"en": "Are you sure you want to Add", "ar": "هل أنت متأكد أنك تريد إضافة"}, + "preferredunit": {"en": "Select the preferred unit", "ar": "اختر الوحدة المفضلة"}, "select-unit": {"en": "Select unit", "ar": "اختر وحدة القياس"}, "try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'}, - "app-update": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"}, "covid-alert": {"en": "Alert", "ar": "تنبيه"}, - "enterIdentificationNumber": { - "en": "Enter Identification Number", - "ar": "أدخل رقم التعريف" - }, + "enterIdentificationNumber": {"en": "Enter Identification Number", "ar": "أدخل رقم الهوية"}, + "identificationNumber": {"en": "Identification Number", "ar": "رقم الهوية"}, + "complaintNumber": {"en": "Complaint Number", "ar": "رقم الشكوى"}, "accountActivationDesc": { - "en": - "This service allows you to activate your LAKUM account after registering through the Vida system.", - "ar": - "تتيح لك هذه الخدمة تفعيل حساب LAKUM الخاص بك بعد التسجيل من خلال نظام Vida." - }, - "pointsToTransfer": { - "en": "Point's to Transfer :", - "ar": "النقاط المراد تحويلها:" - }, - "enterBeneficiaryAccountNo": { - "en": "Enter Beneficiary Account No.", - "ar": "أدخل رقم حساب المستفيد" - }, - "confirm-prescription": { - "en": "Are you sure !! you want to send this request", - "ar": "تاكيد ارسال الطلب؟" - }, - "you-already-have-order": { - "en": "You already have this order! do you want to view it?", - "ar": "لديك هذا الطلب بالفعل! هل تريد مشاهدته؟" + "en": " This service allows you to activate your LAKUM account after registering completed.", + "ar": " تتيح لك هذه الخدمة تفعيل حساب برنامج الولاء لكم بعد اكتمال التسجيل. " }, + "pointsToTransfer": {"en": "Point's to Transfer:", "ar": "النقاط المراد تحويلها:"}, + "enterBeneficiaryAccountNo": {"en": "Enter Beneficiary Account No.", "ar": "أدخل رقم حساب المستفيد"}, + "confirm-prescription": {"en": "Are you sure !! you want to send this request", "ar": "تاكيد ارسال الطلب؟"}, + "you-already-have-order": {"en": "You already have this order! do you want to view it?", "ar": "لديك هذا الطلب بالفعل! هل تريد مشاهدته؟"}, "order-overview": {"en": "Order Overview", "ar": "ملخص الطلب"}, "shipping-address": {"en": "Delivery Address", "ar": "عنوان التوصيل"}, - "pharmacy-relogin": { - "en": "Your session has timed out, Please try again", - "ar": "انتهت مهلة جلسة الخاص بها. يرجى المحاولة مرة أخرى" - }, + "pharmacy-relogin": {"en": "Your session has timed out, please try again", "ar": "انتهت مهلة جلسة الخاص بها. يرجى المحاولة مرة أخرى"}, "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 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​", "ar": - "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات  التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة" + "تسجيل الذهاب الى الطوارئ عبر الإنترنت هو فقط للحالات التي لا تهدد الحياة يجب الاتصل بالهلال الأحمر (رقم) أو الذهاب إلى أقرب قسم طوارئ إذا كان هناك علامات السكتة الدماغية أو النوبة القلبية او هناك نوبة تشنج او حالة فقدان الوعي او وجود إصابة تهدد أحد الأطراف او تهدد الحياة او وجود إصابات خطيرة" }, - "MRN": {"en": "MRN", "ar": "ایم آر این"}, - "appointment-date": {"en": "Appointment Date", "ar": "تقرری کی تاریخ"}, - "appointment-no": {"en": "Appointment No", "ar": "تقرری نمبر"}, - "insurance-id": {"en": "Insurance ID", "ar": "انشورنس ID"}, + "MRN": {"en": "MRN", "ar": "رقم الملف الطبي"}, + "appointment-date": {"en": "Appointment Date", "ar": "تاريخ الموعد"}, + "appointment-no": {"en": "Appointment No", "ar": "رقم الموعد"}, + "insurance-id": {"en": "Insurance ID", "ar": "رقم العضويه"}, "chiefComplaints": {"en": "Chief Complaints", "ar": "الشكوى الرئيسة"}, - "errorChiefComplaints": { - "en": "Please Chief Complaints", - "ar": "يرجى ادخال الشكوى الرئيسة" - }, - "errorExpectedArrivalTimes": { - "en": "Please Expected arrival time", - "ar": "يرجى ادخال الوقت المتوقع للوصول" - }, - "expectedArrivalTime": { - "en": "Expected arrival time", - "ar": "الوقت المتوقع للوصول" - }, + "errorChiefComplaints": {"en": "Please Chief Complaints", "ar": "يرجى ادخال الشكوى الرئيسة"}, + "errorExpectedArrivalTimes": {"en": "Please Expected arrival time", "ar": "يرجى ادخال الوقت المتوقع للوصول"}, + "expectedArrivalTime": {"en": "Expected arrival time", "ar": "الوقت المتوقع للوصول"}, "add-address": {"en": "Add new address", "ar": "اضف عنوان جديد"}, - "enter-file": { - "en": "Please enter the mobile number and the medical file number", - "ar": "الرجاء إدخال رقم الجوال ورقم الملف الطبي" - }, + "enter-file": {"en": "Please Enter Mobile Number and Medical File Number", "ar": "الرجاء إدخال رقم الجوال ورقم الملف الطبي"}, "allow": {"en": "Allow", "ar": "السماح"}, "reject": {"en": "Reject", "ar": "رفض"}, - "referralRequesterInformation": { - "en": "Referral requester information", - "ar": "معلومات طالب الإحالة" - }, - "enterReferralRequesterName": { - "en": "Enter Referral Requester Name*", - "ar": "أدخل اسم مقدم طلب الإحالة *" - }, + "referralRequesterInformation": {"en": "Referral requester information", "ar": "معلومات طالب الإحالة"}, + "enterReferralRequesterName": {"en": "Enter Referral Requester Name*", "ar": "أدخل اسم مقدم طلب الإحالة *"}, "selectRelationship": {"en": "Select Relationship", "ar": "حدد العلاقة"}, - "requesterRelationship": { - "en": "Requester Relationship", - "ar": "علاقة الطالب" - }, + "requesterRelationship": {"en": "Requester Relationship", "ar": "علاقة الطالب"}, "newReferral": {"en": "New Referral", "ar": "إحالة جديدة"}, - "searchForReferrals": { - "en": "Search For Referrals", - "ar": "ابحث عن الإحالات" - }, - "covid-select-procedure": { - "en": "Please select the procedure:", - "ar": "الرجاء تحديد الإجراء:" - }, + "searchForReferrals": {"en": "Search for Referrals", "ar": "ابحث عن الإحالات"}, + "covid-select-procedure": {"en": "Please select the procedure:", "ar": "الرجاء تحديد الإجراء:"}, "online-consultation": {"en": "Online Consultation", "ar": "استشارة مباشرة"}, - "expected-weiting": { - "en": "Waiting time to start LiveCare consultation ", - "ar": "وقت الانتظار المتوقع لبدء استشارة لايف كير" - }, + "expected-weiting": {"en": "Waiting time to start LiveCare consultation ", "ar": "وقت الانتظار المتوقع لبدء استشارة لايف كير"}, "er-consult-fee": {"en": "Consultation Fee", "ar": "رسوم الاستشارة"}, - "insured-patient": { - "en": - "If you're Insurance patient, you have only have to pay the co-payment", - "ar": "إذا كنت مريضًا في مجال التأمين ، فليس عليك سوى دفع المبلغ المشترك" - }, - "i-accept-terms": { - "en": "I Accept the Terms And Conditions", - "ar": "أوافق على الشروط والأحكام" - }, - "upcoming-pay-options": { - "en": "You can pay by the following Options:", - "ar": "يمكنك الدفع عن طريق الخيارات التالية:" - }, - - "please-accept-terms": { - "en": "Please accept terms & conditions to continue", - "ar": "يرجى قبول الشروط والأحكام للمتابعة" - }, + "insured-patient": {"en": "If you're Insurance patient, you have only have to pay the co-payment", "ar": "إذا كنت مريضًا في مجال التأمين ، فليس عليك سوى دفع المبلغ المشترك"}, + "i-accept-terms": {"en": "I Accept the Terms and Conditions", "ar": "موافق على الشروط والأحكام"}, + "upcoming-pay-options": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, + "please-accept-terms": {"en": "Please accept terms & conditions to continue", "ar": "يرجى قبول الشروط والأحكام للمتابعة"}, "type": {"en": "Type", "ar": "اكتب"}, "info-ereferral": { "en": - "This service allows you to submit a Referral request from any health care providers either inside or outside the kingdom of Saudi Arabia to any of HMG Hospitals, By filling some of the patient's data and attaching the medical reports, moreover you can track the request status (Under process, Accepted or Rejected)", + "This service allows you to submit a Referral request from any health care providers either inside or outside the kingdom of Saudi Arabia to any of HMG Hospitals, by filling some of the patient's data and attaching the medical reports, moreover you can track the request status (Under process, Accepted or Rejected)", "ar": - "تتيح لك هذه الخدمة إرسال طلب إحالة من أي من مقدمي الرعاية الصحية سواء داخل المملكة العربية السعودية أو خارجها إلى أي من مستشفيات HMG ، عن طريق ملء بعض بيانات المريض وإرفاق التقارير الطبية ، علاوة على ذلك يمكنك تتبع حالة الطلب ( قيد المعالجة ، مقبول أو مرفوض)" + "تتيح لك هذه الخدمة إرسال طلب إحالة من أي من مقدمي الرعاية الصحية سواء داخل المملكة العربية السعودية أو خارجها إلى أي من مستشفيات HMG ، عن طريق ملء بعض بيانات المريض وإرفاق التقارير الطبية ، علاوة على ذلك يمكنك تتبع حالة الطلب (قيد المعالجة ، مقبول أو مرفوض)" }, "er-consultation": { - "en": - "This service allows you to make an online virtual consultation via video call directly with the doctor from anywhere at any time.", - "ar": - "تتيح لك هذه الخدمة إجراء استشارة عبر مكالمة فيديو مباشرة مع الطبيب من أي مكان وفي أي وقت" - }, - "my-invoice": {"en": "My Invoice", "ar": "فواتيري"}, - "invoice-list": {"en": "Invoices List", "ar": "فائمة الفواتير"}, - "thisItemIsNotAvailable": { - "en": "This item is not available", - "ar": "هذا العنصر غير متوفر" + "en": "This service allows you to make an online virtual consultation via video call directly with the doctor from anywhere at any time.", + "ar": "تتيح لك هذه الخدمة إجراء استشارة عبر مكالمة فيديو مباشرة مع الطبيب من أي مكان وفي أي وقت" }, - "beforeAfterImages": {"en": "Before After Images", "ar": "قبل بعد الصور"}, + "my-invoice": {"en": "List", "ar": "فواتيري"}, + "invoice-list": {"en": "My Invoice", "ar": "قائمة"}, + "thisItemIsNotAvailable": {"en": "This item is not available", "ar": "هذا العنصر غير متوفر"}, + "beforeAfterImages": {"en": "Before & After Images", "ar": "الصور قبل وبعد"}, "clinic-accept-livecare": { - "en": - "No need to wait or visit You can now get medical consultation via Video call (LiveCare service) in The name of the clinic clinic and the doctor will contact you immediately", - "ar": - "لا داعي للانتظار او الحضور يمكنك الان الحصول على الاستشارة عن طريق مكالمة الفيديو ( خدمة لايف كير) في العيادة وسوف يقوم الطبيب بالتواصل معك فورا" - }, - "livecareModal-top": { - "en": "This Clinic is accepting LiveCare services", - "ar": "هذه العيادة تقدم خدمة لايف كير" + "en": "No need to wait or visit You can now get medical consultation via Video call (LiveCare service) in The name of the clinic clinic and the doctor will contact you immediately", + "ar": "لا داعي للانتظار او الحضور يمكنك الان الحصول على الاستشارة عن طريق مكالمة الفيديو (خدمة لايف كير) في العيادة وسوف يقوم الطبيب بالتواصل معك فورا" }, + "livecareModal-top": {"en": "This Clinic is Accepting livecare services", "ar": "هذه العيادة تقدم خدمة لايف كير"}, "schedule": {"en": "Schedule", "ar": "جدول الحضور"}, - "livecare-point-2": { - "en": "A Specialized doctor will contact you", - "ar": "سوف يقوم بخدمتك طبيب متخصص" - }, - "livecare-point-3": { - "en": "A Doctor will be able to see your full medical file history", - "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كاملا" - }, - "livecare-point-4": { - "en": "Free Medicine delivery Available", - "ar": "خدمة توصيل الادوية مجانا" - }, - "livecare-point-5": { - "en": "No need to visit the service is in your place", - "ar": "لا داعي للحضور سوف تحصل على الخدمة في مكانك" - }, - "book-immediate-livecare": { - "en": "I accept to get the service immediately", - "ar": "موافق اريد الحصول على الخدمة فورا" - }, - "book-video-livecare-2": { - "en": "I don't need to visit the clinic", - "ar": "اتصال فيديو لا احتاج الحضور الى العيادة" - }, + "livecare-point-2": {"en": "A Specialized doctor will contact you", "ar": "سوف يقوم بخدمتك طبيب متخصص"}, + "livecare-point-3": {"en": "A Doctor will be able to see your full medical file history", "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كاملا"}, + "livecare-point-4": {"en": "Free Medicine Delivery Available", "ar": "خدمة توصيل الادوية مجانية"}, + "livecare-point-5": {"en": "No need to visit the service is in your place", "ar": "لا داعي للحضور سوف تحصل على الخدمة في مكانك"}, + "book-immediate-livecare": {"en": "I accept to get the service immediately", "ar": "موافق اريد الحصول على الخدمة فورا"}, + "book-video-livecare-2": {"en": "I don't need to visit the clinic", "ar": "اتصال فيديو لا احتاج الحضور الى العيادة"}, "no-thankyou": {"en": "No Thanks", "ar": "لا شكرا"}, - "visit-clinic": { - "en": "Schedule appointment with the doctor", - "ar": "ارغب في حجز موعد مجدول مع الطبيب" - }, - "generate-covid-certificate": { - "en": "Generate Covid-19 Certificate", - "ar": "إنشاء شهادة كورونا" - }, - "is-report-outside-ksa": { - "en": "Is the certificate needed for outside KSA?", - "ar": "هل الشهادة مطلوبة من خارج المملكة؟" - }, + "visit-clinic": {"en": "Schedule appointment with the doctor", "ar": "ارغب في حجز موعد مجدول مع الطبيب"}, + "generate-covid-certificate": {"en": "Generate Covid-19 Certificate", "ar": "إنشاء شهادة كورونا"}, + "is-report-outside-ksa": {"en": "Is the certificate needed for outside KSA?", "ar": "هل الشهادة مطلوبة من خارج المملكة؟"}, "passport-number": {"en": "Passport Number", "ar": "رقم جواز السفر"}, - "enter-passport-number": { - "en": "Please confirm or update your passport number:", - "ar": "الرجاء تأكيد أو تحديث رقم جواز السفر الخاص بك:" - }, - "valid-passport-number": { - "en": "Please enter valid passport number", - "ar": "الرجاء إدخال رقم جواز سفر صالح" - }, + "enter-passport-number": {"en": "Please confirm or update your passport number:", "ar": "الرجاء تأكيد أو تحديث رقم جواز السفر الخاص بك:"}, + "valid-passport-number": {"en": "Please enter valid passport number", "ar": "الرجاء إدخال رقم جواز سفر صحيح"}, + "continue-plan": {"en": "Continue with the treatment plan?", "ar": "إكمال الخطة العلاجية؟"}, "about-app": {"en": "About the app", "ar": "عن التطبيق"}, "about-points": { "length": {"en": "16", "ar": "16"}, - "1": { - "en": "Online Appointment Booking & rescheduling", - "ar": "حجز المواعيد إلكترونياً و إعادة جدولتها" - }, - "2": { - "en": "Insurance approval status", - "ar": "موافقات شركات التأمين الطبية" - }, + "1": {"en": "Online Appointment Booking & rescheduling", "ar": "حجز المواعيد إلكترونياً و إعادة جدولتها"}, + "2": {"en": "Insurance approval status", "ar": "موافقات شركات التأمين الطبية"}, "3": {"en": "Find A doctor", "ar": "معلومات الأطباء والبحث عنهم وسؤالهم"}, "4": {"en": "Ask your doctor", "ar": "اسأل طبيبك"}, "5": {"en": "Medical prescriptions", "ar": "الوصفات الطبية"}, "6": {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, - "7": { - "en": "Hospitals contact numbers", - "ar": "أرقام هواتف جميع المستشفيات" - }, + "7": {"en": "Hospitals contact numbers", "ar": "أرقام هواتف جميع المستشفيات"}, "8": {"en": "Doctor profiles", "ar": "ملف الطبيب"}, "9": {"en": "Hospitals locations", "ar": "مواقع المستشفيات على الخريطة"}, "10": {"en": "Pharmacies Locations", "ar": "مواقع الصيدليات على الخريطة"}, - "11": { - "en": "Hospital's Virtual Tour", - "ar": "جولة افتراضية داخل المستشفيات" - }, - "12": { - "en": "Official Social Media", - "ar": "مواقع التواصل الاجتماعي الخاصة بالمجموعة" - }, + "11": {"en": "Hospital's Virtual Tour", "ar": "جولة افتراضية داخل المستشفيات"}, + "12": {"en": "Official Social Media", "ar": "مواقع التواصل الاجتماعي الخاصة بالمجموعة"}, "13": {"en": "Vaccines Schedule", "ar": "جدول التطعيمات"}, "14": {"en": "Health Calculators", "ar": "حاسبات صحية"}, "15": {"en": "Other Services", "ar": "خدمات أخرى"} }, - "continue-plan": { - "en": "Continue with the treatment plan?", - "ar": "إكمال الخطة العلاجية؟" - }, - "dental-procedure-list": { - "en": "Dental Procedures for this Appointment: ", - "ar": "إجراءات الأسنان لهذا الموعد:" - }, + "dental-procedure-list": {"en": "Dental Procedures for this Appointment: ", "ar": "إجراءات الأسنان لهذا الموعد:"}, "time-needed": {"en": "Time Needed:", "ar": "الوقت اللازم:"}, - "total-time-needed": { - "en": "Total Appointment Time:", - "ar": "وقت المواعيد الكلي:" - }, + "total-time-needed": {"en": "Total Appointment Time:", "ar": "وقت المواعيد الكلي:"}, "info-eye": { - "en": - "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.", - "ar": - " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية." + "en": "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.", + "ar": " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية." }, "info-vaccines": { - "en": - "This service allows you to view all the vaccinations that were taken in Al Habib Medical Group.", - "ar": - "خدمة تطعيماتي: هذه الخدمة تمكنك من الاطلاع على جميع التطعيمات التي تمت في مجموعة الحبيب الطبية." + "en": "This service allows you to view all the vaccinations that were taken in Al Habib Medical Group.", + "ar": "خدمة تطعيماتي: هذه الخدمة تمكنك من الاطلاع على جميع التطعيمات التي تمت في مجموعة الحبيب الطبية." }, "info-trackers": { - "en": - "This service allows you to record the readings of the measurement of sugar, pressure, and weight and then refer to them as a reference in addition to view the statistics charts.", - "ar": - "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة." + "en": "This service allows you to record the readings of the measurement of sugar, pressure, and weight and then refer to them as a reference in addition to view the statistics charts.", + "ar": "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة." }, "info-health-data": { "en": "This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.", - "ar": - "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك." + "ar": "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك." }, "info-ask-doc": { "en": "This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.", - "ar": - "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب." + "ar": "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب." }, "info-auto-wifi": { - "en": - "This service allows you to connect to the Internet directly without the need for entering a user name or password.", - "ar": - "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور." + "en": "This service allows you to connect to the Internet directly without the need for entering a user name or password.", + "ar": "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور." }, "auto-wifi": {"en": "Connect To Internet", "ar": "الإتصال بالإنترنت"}, "child-vaccine-info": { @@ -2293,7 +1488,243 @@ const Map localizedValues = { "ar": "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر." }, - + "sys/dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, + "arm": {"en": "Arm", "ar": "الذراع"}, + "remove-measure": {"en": "Remove this measure", "ar": "إزالة هذا القياس؟"}, + "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"}, + "ask-doc-empty": {"en": "This service is available to doctors visited during the past 15 days", "ar": "هذه الخدمة متاحة للاطباء الذين تمت زيارتهم خلال ال 15 يوم الماضية"}, + "online-clinics": {"en": "Online Clinics: ", "ar": "​العيادات المفتوحة: "}, + "offline-clinics": {"en": "Offline Clinics: ", "ar": "العيادات المغلقة: "}, + "clinic-schedule": {"en": "Clinic Schedule", "ar": "جدول العيادة"}, + "discount": {"en": "Discount:", "ar": "الخصم:"}, + "total-VAT": {"en": "VAT", "ar": "القيمة المضافة"}, + "paid": {"en": "Paid", "ar": "المدفوع"}, + "dental-insurance": {"en": "Insurance", "ar": "التأمين"}, + "drivethru-appo": {"en": "Drive Thru Appointment", "ar": "موعد من داخل السيارة"}, + "upcoming-QR-NFC": {"en": "Use the NFC or QR Code to Check-In", "ar": "استخدم NFC أو رمزQR لتسجيل الوصول"}, + "ovulation-desc": {"en": "Calculates Ovulation Period", "ar": "حساب افضل فترة للحمل بناءاً على تاريخ اخر دورة شهرية"}, + "cycle-label": {"en": "Average Cycle Length (usually 28 days):", "ar": "متوسط الدورة الشهرية 28 يوم: "}, + "luteal-label": {"en": "Average Luteal Phase Length (usually 14 days):", "ar": "متوسط الأيام ما بعد الاباضة عادة 14 يوما: "}, + "pregnancy-title": {"en": "Delivery Due Date", "ar": "تاريخ الولادة"}, + "pregnancy-desc": { + "en": "Congratulations, you are pregnant! Now when will the new baby arrive? To estimate the due date, enter the date when the last menstrual period began (the first day), then click calculate.", + "ar": "مبروك, أنت حامل! الآن متى سيصل الطفل؟ لتقدير موعد الولادة, ادخل تاريخ بداية آخر دورة شهرية (اليوم الأول), ثم اضغط على الحساب" + }, + "pregnancy-date-label": {"en": "What was the date of the first day of the last period?", "ar": "ما هو تاريخ أول يوم من أخر دورة شهرية ؟"}, + "ovulation-period": {"en": "The next ovulation period is estimated to be: ", "ar": "تقدر فترة الاباضة القادمة "}, + "from": {"en": "From: ", "ar": "من:"}, + "to": {"en": "To: ", "ar": "الى:"}, + "conceive": {"en": "You have conceived on: ", "ar": " تاريخ بداية الحمل"}, + "firstTri": {"en": "First Trimester Ends (12 weeks):", "ar": "تاريخ انتهاء الثلث الأول 12 اسبوع: "}, + "secondTri": {"en": "Second Trimester Ends (27 weeks):", "ar": "تاريخ انتهاء الثلث الثاني 27 اسبوع: "}, + "thirdTri": {"en": "Third Trimester, Estimated Due Date (40 weeks):", "ar": "تاريخ احتمال الولادة 40 اسبوع:"}, + "seeDoctorsList": {"en": "See List of Doctors", "ar": "اعرض قائمة الأطباء"}, + "covidQuestionnaire": {"en": "Please answer below questionnaire:", "ar": "الرجاء الإجابة على الاستبيان أدناه:"}, + "covidBookAppo": {"en": "Booking Appointment for: ", "ar": "موعد الحجز لـ: "}, + "emptySchedule": {"en": "Doctor has no schedule.", "ar": "لا يوجد جدول حضور مسجل للطبيب"}, + "serviceNotAvailable": {"en": "Dear, this service is not available now, please try again later", "ar": "عزيزي المراجع, هذه الخدمة غير متوفرة الان يرجى المحاوله لاحقا"}, + "doctorScheduleNot": {"en": "Doctor schedule not available", "ar": "جدول الطبيب غير متوفر"}, + "RRTRequestSuccess": {"en": "Request has been sent successfully, you will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن"}, + "rateDoctorAppo": {"en": "Rate DR & Appointment", "ar": "تقييم الطبيب والموعد"}, + "invoice": {"en": "Invoice", "ar": "الفاتورة"}, + "requestedDate": {"en": "Req Date", "ar": "التاريخ "}, + "callDuration": {"en": "Call Duration", "ar": "مدة الاتصال"}, + "alreadyRated": {"en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً"}, + "insuranceCompany": {"en": "Insurance Company", "ar": "شركة تأمين"}, + "preferredBranch": {"en": "Preferred Branch", "ar": "الفرع المفضل"}, + "selectPreferredBranch": {"en": "Select Preferred Branch", "ar": "اختر الفرع المفضل"}, + "patientLocated": {"en": "Where the patient located", "ar": "اين موقع المريض"}, + "otherInfo": {"en": "Other details", "ar": "تفاصيل أخرى"}, + "medicalReport": {"en": "Medical Report", "ar": "تقرير طبي"}, + "insuredPatient": {"en": "Insured Patient", "ar": "هل لدى المريض تامين؟"}, + "rateDoctor": {"en": "Rate Doctor", "ar": "تقييم الطبيب"}, + "rateAppointment": {"en": "Rate Appointment", "ar": "تقييم الموعد"}, + "noInsuranceCardAttached": {"en": "Please attach your insurance card image to continue", "ar": "يرجى إرفاق صورة بطاقة التأمين الخاصة بك للمتابعة"}, + "bodyMassIndex": {"en": "Body Mass Index is: ", "ar": "مؤشر كتلة الجسم هو:"}, + "noSlotsError": {"en": "No appointments available for selected date", "ar": "لا توجد مواعيد متاحة للتاريخ المحدد"}, + "selectSlot": {"en": "Please select Time Slot to continue", "ar": "الرجاء تحديد فترة زمنية للمتابعة"}, + "years": {"en": "Years", "ar": "سنوات"}, + "respirationBPM": {"en": "bpm", "ar": "نفس"}, + "extremeObese": {"en": "Extreme Obese", "ar": "سمنة مفرطة"}, + "invoiceDetails": {"en": "Invoice Details", "ar": "تفاصيل الفاتورة"}, + "appoDetails": {"en": "Appointment Details", "ar": "تفاصيل الموعد"}, + "appoPaymentConfirm": {"en": "Are you sure you Want to make payment for this appointment?", "ar": "هل أنت متأكد من أنك تريد سداد هذا الموعد؟"}, + "selectSearchCriteria": {"en": "Select the search criteria", "ar": "حدد معايير البحث"}, + "enterComplainNumber": {"en": "Enter the Complain Number", "ar": "أدخل رقم الشكوى"}, + "enterfileNumber": {"en": "Enter File Number", "ar": "أدخل رقم الملف"}, + "please_select_from_below_options": {"en": "Please select from below options:", "ar": "الرجاء التحديد من الخيارات أدناه:"}, + "selectLanguage": {"en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة"}, + "recAlert": {"en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟"}, + "modesBelow": {"en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه"}, + "prefferedMode": {"en": "Please select the preferred mode below:", "ar": ":الرجاء تحديد الوضع المفضل أدناه"}, + "permissionsBellow": {"en": "Please allow the permissions below:", "ar": ":الرجاء السماح الأذونات أدناه"}, + "appointmentReminder": {"en": "Would you like to set a reminder for this appointment in your calendar?", "ar": "هل ترغب في اضافة تذكير لهذا الموعد في التقويم؟"}, + "cancelAppointment": {"en": "Cancel Appt.", "ar": "الغاء الموعد"}, + "updateInsurCards": {"en": "Update Insurance Cards", "ar": "تحديث بطاقات التأمين"}, + "patientAge": {"en": "y", "ar": "سنة"}, + "searchCriteria": {"en": "Select Search Criteria", "ar": "حدد معايير البحث"}, + "RequesterInfo": {"en": "Requester Info", "ar": "معلومات مقدم الطلب"}, + "PatientInfo": {"en": "Patient Info", "ar": "معلومات المريض"}, + "OtherInfo": {"en": "Other Info", "ar": "معلومات اخرى"}, + "inPrgress": {"en": "In Progress", "ar": "في تقدم"}, + "locked": {"en": "Locked", "ar": "مقفل"}, + "personalInfo": {"en": "Personal Information", "ar": "معلومات شخصية"}, + "cmcTitle": {"en": "Comprehensive", "ar": "خدمة"}, + "cmcSubtitle": {"en": "Medical Checkup", "ar": "الفحص الشامل"}, + "emergencyTitle": {"en": "Emergency", "ar": "خدمات"}, + "emergencySubtitle": {"en": "Services", "ar": "الطوارئ"}, + "ereferralTitle": {"en": "E-Referral", "ar": "خدمة"}, + "ereferralSubtitle": {"en": "Service", "ar": "الإحالة الإلكترونية"}, + "medicalFileTitle": {"en": "Medical File", 'ar': 'الملف الطبي'}, + "My_File_Details": {"en": "My File Details", "ar": "تفاصيل ملفي"}, + "Ecommerce": {"en": "Ecommerce", "ar": "التجارة الإلكترونية"}, + "Family_Files": {"en": "Family Files", "ar": "ملفات العائلة"}, + "My_Child": {"en": "My Child", "ar": "تطعيمات"}, + "Vaccines": {"en": "Vaccines", "ar": "الأطفال"}, + "Todo": {"en": "Todo", "ar": "قائمة"}, + "List": {"en": "List", "ar": "المهام"}, + "Blood": {"en": "Blood", "ar": "التبرع"}, + "Donation": {"en": "Donation", "ar": "بالدم"}, + "Health": {"en": "Health", "ar": "الصحة"}, + "Calculator": {"en": "Calculator", "ar": "آلة حاسبة"}, + "Converter": {"en": "Converter", "ar": "محول"}, + "Smart": {"en": "Smart", "ar": "ذكي"}, + "Watches": {"en": "Watches", "ar": "ساعات"}, + "parkingTitle2": {"en": "Car parking", "ar": "خدمة"}, + "ParkingSubtitle": {"en": "service", "ar": "مواقف السيارات"}, + "Details": {"en": "Details", "ar": "تفاصيل"}, + "News": {"en": "News", "ar": "أحدث"}, + "Latest": {"en": "Latest", "ar": "ألاخبار"}, + "Virtual": {"en": "Virtual", "ar": "جولة"}, + "Tour": {"en": "Tour", "ar": "افتراضية"}, "mostViewed": {"en": "Most Viewed", "ar": "الأكثر مشاهدة"}, - "newProducts": {"en": "New Products", "ar": "منتجات جديدة"} + "newProducts": {"en": "New Products", "ar": "منتجات جديدة"}, + "paymentSelected": {"en": "Selected", "ar": "المحدد"}, + "moreNotifications": {"en": "More notifications", "ar": "الإشعارات المزيد"}, + "familyTitle": {"en": "My Family", "ar": "ملفات"}, + "familySubtitle": {"en": "Files", "ar": "العائلة"}, + "liveCareTitle": {"en": "LiveCare", "ar": "خدمة"}, + "liveCareSubtitle": {"en": "Service", "ar": "لايف كير"}, + "pharmacyTitle": {"en": "Al Habib", "ar": "الصيدليات"}, + "pharmacySubtitle": {"en": "Pharmacy", "ar": "الحبيب"}, + "healthCalculatorTitle": {"en": "Health", "ar": "الحاسبات"}, + "healthCalculatorSubtitle": {"en": "Calculators", "ar": "الصحية"}, + "waterTitle": {"en": "Water", "ar": "استهلاك"}, + "waterSubtitle": {"en": "Consumption", "ar": "الماء"}, + "medicalFileTitle2": {"en": "My Medical File", "ar": "تفاصيل"}, + "medicalFileSubtitle": {"en": "Details", "ar": "ملفي الطبي"}, + "healthConvertersTitle": {"en": "Health", "ar": "تحويل"}, + "healthConvertersSubtitle": {"en": "Converters", "ar": "القياسات"}, + "syncHealthData": { "en": "Sync Health Data", "ar": "مزامنة البيانات الصحية" }, + "steps": { "en": "Steps", "ar": "الخطوات" }, + "avgSteps": { "en": "Average Steps", "ar": "متوسط الخطوات" }, + "avgDistance": { "en": "Average Distance", "ar": "متوسط المسافة" }, + "enterDetails": {"en": "Enter Details", "ar": "أدخل التفاصيل"}, + "avgHeartRate": { "en": "Average Heart Rate", "ar": "متوسط معدل ضربات القلب" }, + "alreadySynced": { "en": "Already Synced", "ar": "متزامنة" }, + "sync-instructions-intro1": { "en": "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", "ar": "يبدو أنك لم تقم بمزامنة بياناتك الصحية مع تطبيق Dr. Alhabib App من قبل. للمتابعة ، تحتاج إلى مزامنة بياناتك الصحية مع تطبيق Dr. Alhabib" }, + "sync-instructions-intro2": { "en": "Before syncing data, please make sure that you have followed the instructions properly", "ar": "قبل مزامنة البيانات ، يرجى التأكد من اتباع التعليمات بشكل صحيح." }, + "sync-instructions-intro3": { "en": "Before syncing data, please make sure that following instructions are met:", "ar": "قبل مزامنة البيانات ، يرجى التأكد من تلبية الإرشادات التالية:" }, + "ios-instructions-1": { "en": "Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.", "ar": "تأكد من أنك قمت بتثبيت تطبيق 'Health' App & 'Watch' من متجر Apple." }, + "ios-instructions-2": { "en": "Make sure that your Apple Watch is connected with the Watch & Health Apps.", "ar": "تأكد من اتصال Apple Watch بتطبيقات Watch & Health." }, + "ios-instructions-3": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق صحتك." }, + "supportedWatches": { "en": "Supported SmartWatches", "ar": "الساعات الذكية المدعومة" }, + "watchInstructions": { "en": "View watch instructions", "ar": "عرض تعليمات الساعة" }, + "monthlyTab": {"en": "Monthly", "ar": "شهري"}, + "moreSupportedWatches": {"en": "More Supported Smartwatches...", "ar": "المزيد من الساعات الذكية المدعومة..."}, + "android-instructions-1": { "en": "Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", "ar": "تأكد من تثبيت تطبيقات 'WearOS' و 'Google Fit' من متجر Google PlayStore." }, + "android-instructions-2": { "en": "Make sure that you have installed your watch related apps from Google PlayStore.", "ar": "تأكد من أنك قمت بتثبيت التطبيقات المتعلقة بالساعات من Google PlayStore." }, + "android-instructions-3": { "en": "Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", "ar": "تأكد من أن ساعتك الذكية متصلة بتطبيق WearOS وتطبيقات ساعتك." }, + "android-instructions-4": { "en": "Make sure that your smart watch apps are linked/associated with Google Fit App.", "ar": "تأكد من أن تطبيقات ساعتك الذكية مرتبطة / مرتبطة بتطبيق Google Fit." }, "android-instructions-5": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your watch app & on Google Fit app & both are in sync.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق الساعة وعلى تطبيق Google Fit وكلاهما في حالة مزامنة." }, + "tamaraInstPlan" : { "en": "Select the tamara installment plan", "ar": "حدد خطة تقسيط تمارة" }, + "onlineTag": {"en": "Online", "ar": "متصل"}, + "offlineTag": {"en": "Offline", "ar": "غير متصل"}, + "viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"}, + "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, + "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, + "laserClinic": {"en": "Laser Clinic", "ar": "عيادة الليزر"}, + "noImage": {"en": "No Image", "ar": "لا توجد صورة"}, + "signoutMessage": {"en": "Are you sure you want to logout?", "ar": "هل أنت متأكد أنك تريد تسجيل الخروج؟"}, + "RRTTitle": {"en": "RRT", "ar": "خدمة فريق"}, + "RRTSubTitle": {"en": "Service", "ar": "الاستجابة السريع"}, + "transportation": {"en": "Transportation", "ar": "النقل"}, + + "neck": {"en": "Neck", "ar": "رقبه"}, + "waist": {"en": "Waist", "ar": "وسط"}, + "hip": {"en": "Hip", "ar": "ورك او نتوء"}, + "carbsProtin": {"en": "Carbs, Protein and Fat", "ar": "الكربوهيدرات والبروتينات والدهون"}, + "usefulInfo": {"en": "Useful Information", "ar": "معلومات مفيدة"}, + "babyAge": {"en": "Baby Age", "ar": "عمر الطفل الآن:"}, + "babyAgeAvail": {"en": "baby age is not available", "ar": "عمر الطفل غير متوفر"}, + "deliveryDue": {"en": "The delivery due date is estimated to be on the", "ar": "من المقدر أن يكون تاريخ استحقاق التسليم في"}, + + "almostInactive": {"en": "Almost Inactive(Little or no exercises)", "ar": "شبه غير نشط (تمارين قليلة أو معدومة)"}, + "lightActive1": {"en": "Lighty Active (1-3) days per week", "ar": "Lighty Active (1-3) أيام في الأسبوع"}, + "veryActive": {"en": "very Active(6-7) days per week", "ar": "نشط جدا (6-7) أيام في الأسبوع"}, + "superActive": {"en": "Super Active(very hard exercises)", "ar": "سوبر نشط (تمارين صعبة للغاية)"}, + + "dailyIntake": {"en": "Daily intake is", "ar": "المدخول اليومي"}, + "calculateAmount": {"en": "Calculates the amount of energy that the person’s body expends in a day", "ar": "تحسب كمية الطاقة التي يبذلها جسم الشخص في اليوم"}, + "bodyWillBurn": {"en": "This means the body will burn", "ar": "هذا يعني أن الجسم سوف يحترق"}, + "caloriesEachDay": {"en": "calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is", "ar": "السعرات الحرارية في كل يوم ، إذا لم تمارس أي نشاط طوال اليوم .. ملاحظة: متطلبات السعرات الحرارية اليومية هي"}, + "maintainWeight": {"en": "calories, to maintain the current weight.", "ar": "السعرات الحرارية للحفاظ على الوزن الحالي."}, + + "mediumFinger": {"en": "Medium(fingers touch)", "ar": "متوسطة (لمسة الأصابع)"}, + "smallFinger": {"en": "Small(fingers overlap)", "ar": "صغير (أصابع متداخلة)"}, + "largeFinger": {"en": "Large(fingers don\'n touch)", "ar": "كبير (لا تلمس الأصابع)"}, + "idealBodyWeight": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "يحسب وزن الجسم المثالي بناءً على الطول والوزن وحجم الجسم"}, + "bodyFrameSize": {"en": "Body Frame Size", "ar": "حجم إطار الجسم"}, + + "idealWeightRange": {"en": "Ideal weight range is", "ar": "نطاق الوزن المثالي هو"}, + "currentWeightPerfect": {"en": "Congratulations! The current weight is perfect and considered healthy", "ar": "تهانينا! الوزن الحالي مثالي ويعتبر صحي"}, + "littleBitWeightMore": {"en": "This means that the weight is a little bit more than ideal weight by", "ar": "هذا يعني أن الوزن أكثر قليلاً من الوزن المثالي به"}, + "consultWithDoctor": {"en": "May wish to consult with the doctor for medical help. Click to view our list of Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء لدينا"}, + "excessiveObesity": {"en": "Means that you suffer from excessive obesity by", "ar": "يعني أنك تعاني من السمنة المفرطة بها"}, + "mayWish": {"en": "May wish to consult with the doctor for medical help. Click to view our list of\n Doctors", "ar": "قد ترغب في استشارة الطبيب للحصول على مساعدة طبية. انقر لعرض قائمة الأطباء \ n الخاصة بنا"}, + + "essential": {"en": "The category falls under essential", "ar": "الفئة تندرج تحت الأساسية"}, + "athlete": {"en": "The category falls under athlete", "ar": "فئة تندرج تحت رياضي"}, + "fitness": {"en": "The category falls under fitness", "ar": "الفئة تندرج تحت اللياقة البدنية"}, + "acceptable": {"en": "The category falls under acceptable", "ar": "الفئة تندرج تحت مقبول"}, + "underObese": {"en": "The category falls under obese", "ar": "تندرج الفئة تحت السمنة"}, + "crossedLimits": {"en": "Please check the value you have entered, since the body fat percentage has crosed the limits.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، لأن نسبة الدهون في الجسم تجاوزت الحدود."}, + "lowLimits": {"en": "Please check the value you have entered, since the body fat percentage cannot be this low.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، حيث لا يمكن أن تكون نسبة الدهون في الجسم منخفضة."}, + "estimates": {"en": "Estimates the total body fat based on\nthe size", "ar": "تقدير إجمالي الدهون في الجسم بناءً على \ n الحجم"}, + + + "myCart": {"en": "Cart", "ar": "عربة التسوق"}, + "browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"}, + "inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"}, + "light":{"en":"Lightly active (1-3) days per week","ar":"خفيف النشاط (1-3 أيام في الأسبوع)"}, + "moderate":{"en":"Moderately active (3-5) days per week)","ar":"معتدل النشاط (3-5 أيام في الأسبوع)"}, + "very":{"en":"Very active (6-7) days per week)","ar":"نشط جداُ (6-7 أيام في الأسبوع)"}, + "super":{"en":"Super active (very hard exercise)","ar":"عالي النشاط (ممارسة الرياضة الصعبة)"}, + "resultCalories": {"en": "Daily intake is (#) calories", "ar": "الإحتياج اليومي (#) سعرة حرارية"}, + "bmrDesc": {"en": "Calculates the amount of energy that the person’s body expends in a day", "ar": "معدل الأيض القاعدي: هو حساب كمية الطاقة التي يحتاجها الجسم في اليوم الواحد"}, + "idealWeightDesc": {"en": "Calculates the ideal body weight based on height, Weight, and Body Size", "ar": "حساب الوزن المثالي والوزن الصحي للجسم على أساس الطول، والوزن ،والجسم"}, + "bodyFrame": {"en": "Body Frame Size", "ar": "مقاس هيكل الجسم"}, + "bodyFrameSmall": {"en": "Small (fingers overlap)", "ar": "رفيع (الأصابع تتداخل)"}, + "bodyFrameMedium": {"en": "Medium (fingers touch)", "ar": "متوسط (الأصابع تتلامس)"}, + "bodyFrameLarge": {"en": "Large (fingers don't touch)", "ar": "عريض (الأصابع لا تتلامس)"}, + "bodyFatDesc": {"en": "Estimates the total body fat based on the size", "ar": "حساب الدهون في الجسم بناءاً على الحجم"}, + + "obeseBodyFat":{"en":"The category falls under Obese.","ar":"تندرج تحت فئة دهون جسم سمين"}, + "invalid":{"en":"Invalid input for calculation.","ar":"البيانات المدخلة غير صالحة للحساب"}, + "more":{"en":"Please check the value you have entered, since the body fat percentage has crossed the limits.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم قد تجاوزت الحدود"}, + "less":{"en":"Please check the value you have entered, since the body fat percentage cannot be this low.","ar":"يرجى التحقق من القيمة التي أدخلتها ، نظرًا لأن نسبة الدهون في الجسم لا يمكن أن تكون منخفضة"}, + "carbProteinDesc": {"en": "Calculates carbohydrate protein and fat ratio in calories and grams according to a pre-set ratio", "ar": "حساب نسب الكربوهيدرات و البروتينات و الدهون بالسعرات الحرارية والغرامات وفقا لنسب محددة مسبقا"}, + "calDay": {"en": "Calories Per Day", "ar": "السعرات الحرارية في اليوم الواحد"}, + "notSure": {"en": "Not sure? click here", "ar": "غير متأكد؟ اضغط هنا"}, + "selectDiet": {"en": "Select Diet Type", "ar": "حدد نوع النظام الغذائي"}, + "dietVeryLow":{"en":"Very Low Carb","ar":"حمية منخفضة جدا في الكربوهيدرات"}, + "dietLow":{"en":"Low Carb","ar":"حمية منخفضة الكربوهيدرات"}, + "dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"}, + "dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"}, + "dietZone":{"en":"Zone Diet","ar":"حمية زون"}, + + "Protein": {"en": "Protein", "ar": "بروتين"}, + "Cals": {"en": "Cals", "ar": "كالس"}, + "gramsPerDay": {"en": "Grams Per Day", "ar": "غرام في اليوم"}, + "gr": {"en": "gr", "ar": "غرام"}, + "gramsPerMeal": {"en": "Grams Per Meal", "ar": "عدد الجرامات لكل وجبة"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 50390ae2..c256d0c1 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -21,6 +21,7 @@ const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; const PHARMACY_CUSTOMER_ID = 'costumer-id'; +const PHARMACY_CUSTOMER_OBJECT = 'pharmacy-customer-object'; const IS_ROBOT_VISIBLE = 'robot-visible'; const IS_ROBOT_INIT = 'robot-init'; const HMG_GEOFENCES = 'hmg-geo-fences'; @@ -33,3 +34,5 @@ const H2O_UNIT = 'H2O_UNIT'; const H2O_REMINDER = 'H2O_REMINDER'; const LIVECARE_CLINIC_DATA = 'LIVECARE_CLINIC_DATA'; const DOCTOR_SCHEDULE_DATE_SEL = 'DOCTOR_SCHEDULE_DATE_SEL'; +const APPOINTMENT_HISTORY_MEDICAL = 'APPOINTMENT_HISTORY_MEDICAL'; +const CLINICS_LIST = 'CLINICS_LIST'; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart new file mode 100644 index 00000000..341d9e52 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart @@ -0,0 +1,345 @@ +class GetCMCAllOrdersResponseModel { + int iD; + int patientId; + int patientOutSa; + bool isOutPatient; + int projectId; + int nearestProjectId; + dynamic longitude; + dynamic latitude; + dynamic appointmentNo; + dynamic dischargeId; + int statusId; + int serviceId; + int channel; + Orderpayment orderpayment; + dynamic orderselectedservice; + dynamic wforder; + dynamic orderapprovalobj; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + String statusText; + int paymentStatus; + dynamic clientRequestid; + dynamic paymentStatusText; + String projectName; + String nearestProjectName; + dynamic paymentAmount; + WFOrder wFOrder; + String serviceText; + bool isSentForApproval; + int exaCartOrderId; + bool isTimer; + int timeSeconds; + int totalPendingSeconds; + int timeMinute; + int timeHour; + int timeTotalSeconds; + int timeTotalMinute; + int timeTotalHour; + dynamic approvalStatus; + bool isActive; + int clickButton; + List procedures; + dynamic pickupLocation; + dynamic dropOffLocation; + dynamic clinicName; + dynamic doctorName; + dynamic branch; + dynamic time; + dynamic notes; + + GetCMCAllOrdersResponseModel( + {this.iD, + this.patientId, + this.patientOutSa, + this.isOutPatient, + this.projectId, + this.nearestProjectId, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeId, + this.statusId, + this.serviceId, + this.channel, + this.orderpayment, + this.orderselectedservice, + this.wforder, + this.orderapprovalobj, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted, + this.statusText, + this.paymentStatus, + this.clientRequestid, + this.paymentStatusText, + this.projectName, + this.nearestProjectName, + this.paymentAmount, + this.wFOrder, + this.serviceText, + this.isSentForApproval, + this.exaCartOrderId, + this.isTimer, + this.timeSeconds, + this.totalPendingSeconds, + this.timeMinute, + this.timeHour, + this.timeTotalSeconds, + this.timeTotalMinute, + this.timeTotalHour, + this.approvalStatus, + this.isActive, + this.clickButton, + this.procedures, + this.pickupLocation, + this.dropOffLocation, + this.clinicName, + this.doctorName, + this.branch, + this.time, + this.notes}); + + GetCMCAllOrdersResponseModel.fromJson(Map json) { + iD = json['ID']; + patientId = json['PatientId']; + patientOutSa = json['PatientOutSa']; + isOutPatient = json['IsOutPatient']; + projectId = json['ProjectId']; + nearestProjectId = json['NearestProjectId']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeId = json['DischargeId']; + statusId = json['StatusId']; + serviceId = json['ServiceId']; + channel = json['Channel']; + orderpayment = json['orderpayment'] != null + ? new Orderpayment.fromJson(json['orderpayment']) + : null; + orderselectedservice = json['orderselectedservice']; + wforder = json['wforder']; + orderapprovalobj = json['orderapprovalobj']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + statusText = json['StatusText']; + paymentStatus = json['PaymentStatus']; + clientRequestid = json['ClientRequestid']; + paymentStatusText = json['PaymentStatusText']; + projectName = json['ProjectName']; + nearestProjectName = json['NearestProjectName']; + paymentAmount = json['PaymentAmount']; + wFOrder = json['WF_order'] != null + ? new WFOrder.fromJson(json['WF_order']) + : null; + serviceText = json['ServiceText']; + isSentForApproval = json['isSentForApproval']; + exaCartOrderId = json['ExaCart_OrderId']; + isTimer = json['isTimer']; + timeSeconds = json['TimeSeconds']; + totalPendingSeconds = json['TotalPendingSeconds']; + timeMinute = json['TimeMinute']; + timeHour = json['TimeHour']; + timeTotalSeconds = json['TimeTotalSeconds']; + timeTotalMinute = json['TimeTotalMinute']; + timeTotalHour = json['TimeTotalHour']; + approvalStatus = json['ApprovalStatus']; + isActive = json['isActive']; + clickButton = json['ClickButton']; + pickupLocation = json['PickupLocation']; + dropOffLocation = json['DropOffLocation']; + clinicName = json['clinicName']; + doctorName = json['DoctorName']; + branch = json['Branch']; + time = json['Time']; + notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientId'] = this.patientId; + data['PatientOutSa'] = this.patientOutSa; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectId'] = this.projectId; + data['NearestProjectId'] = this.nearestProjectId; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeId'] = this.dischargeId; + data['StatusId'] = this.statusId; + data['ServiceId'] = this.serviceId; + data['Channel'] = this.channel; + if (this.orderpayment != null) { + data['orderpayment'] = this.orderpayment.toJson(); + } + data['orderselectedservice'] = this.orderselectedservice; + + data['wforder'] = this.wforder; + data['orderapprovalobj'] = this.orderapprovalobj; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + data['StatusText'] = this.statusText; + data['PaymentStatus'] = this.paymentStatus; + data['ClientRequestid'] = this.clientRequestid; + data['PaymentStatusText'] = this.paymentStatusText; + data['ProjectName'] = this.projectName; + data['NearestProjectName'] = this.nearestProjectName; + data['PaymentAmount'] = this.paymentAmount; + if (this.wFOrder != null) { + data['WF_order'] = this.wFOrder.toJson(); + } + data['ServiceText'] = this.serviceText; + data['isSentForApproval'] = this.isSentForApproval; + data['ExaCart_OrderId'] = this.exaCartOrderId; + data['isTimer'] = this.isTimer; + data['TimeSeconds'] = this.timeSeconds; + data['TotalPendingSeconds'] = this.totalPendingSeconds; + data['TimeMinute'] = this.timeMinute; + data['TimeHour'] = this.timeHour; + data['TimeTotalSeconds'] = this.timeTotalSeconds; + data['TimeTotalMinute'] = this.timeTotalMinute; + data['TimeTotalHour'] = this.timeTotalHour; + data['ApprovalStatus'] = this.approvalStatus; + data['isActive'] = this.isActive; + data['ClickButton'] = this.clickButton; + data['PickupLocation'] = this.pickupLocation; + data['DropOffLocation'] = this.dropOffLocation; + data['clinicName'] = this.clinicName; + data['DoctorName'] = this.doctorName; + data['Branch'] = this.branch; + data['Time'] = this.time; + data['Notes'] = this.notes; + return data; + } +} + +class Orderpayment { + int iD; + int orderId; + dynamic clientRequestId; + dynamic totalAmount; + int paymentStatus; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + + Orderpayment( + {this.iD, + this.orderId, + this.clientRequestId, + this.totalAmount, + this.paymentStatus, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); + + Orderpayment.fromJson(Map json) { + iD = json['ID']; + orderId = json['OrderId']; + clientRequestId = json['ClientRequestId']; + totalAmount = json['TotalAmount']; + paymentStatus = json['PaymentStatus']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['ClientRequestId'] = this.clientRequestId; + data['TotalAmount'] = this.totalAmount; + data['PaymentStatus'] = this.paymentStatus; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + return data; + } +} + +class WFOrder { + dynamic wfButtonsDTO; + int iD; + int orderId; + int previousStep; + int nextStep; + int serviceId; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + + WFOrder( + {this.wfButtonsDTO, + this.iD, + this.orderId, + this.previousStep, + this.nextStep, + this.serviceId, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); + + WFOrder.fromJson(Map json) { + wfButtonsDTO = json['wf_ButtonsDTO']; + iD = json['ID']; + orderId = json['OrderId']; + previousStep = json['PreviousStep']; + nextStep = json['NextStep']; + serviceId = json['ServiceId']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + } + + Map toJson() { + final Map data = new Map(); + data['wf_ButtonsDTO'] = this.wfButtonsDTO; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['PreviousStep'] = this.previousStep; + data['NextStep'] = this.nextStep; + data['ServiceId'] = this.serviceId; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + return 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 534988a7..7c621f35 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 @@ -73,20 +73,19 @@ class CMCInsertPresOrderRequestModel { data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; - data['PatientOutSA'] = this.patientOutSA; + data['isOutPatient'] = this.patientOutSA == 0 ? false : true; data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; - data['PatientID'] = this.patientID; data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['Latitude'] = this.latitude; - data['Longitude'] = this.longitude; - data['CreatedBy'] = this.createdBy; + data['latitude'] = this.latitude; + data['longitude'] = this.longitude; + // data['CreatedBy'] = this.createdBy; data['OrderServiceID'] = this.orderServiceID; if (this.patientERCMCInsertServicesList != null) { - data['PatientER_CMC_InsertServicesList'] = + data['procedures'] = this.patientERCMCInsertServicesList.map((v) => v.toJson()).toList(); } return data; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart index 5f356e2b..335366cd 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart @@ -1,44 +1,56 @@ class GetCMCServicesResponseModel { - String description; - String descriptionN; int iD; - bool isActive; + String serviceID; + int orderServiceID; + String text; + String textN; dynamic price; - int serviceID; - dynamic totalPrice; - dynamic vAT; + dynamic priceVAT; + dynamic priceTotal; + bool isEnabled; + int orderId; + int quantity; GetCMCServicesResponseModel( - {this.description, - this.descriptionN, - this.iD, - this.isActive, - this.price, + {this.iD, this.serviceID, - this.totalPrice, - this.vAT}); + this.orderServiceID, + this.text, + this.textN, + this.price, + this.priceVAT, + this.priceTotal, + this.isEnabled, + this.orderId, + this.quantity}); GetCMCServicesResponseModel.fromJson(Map json) { - description = json['Description']; - descriptionN = json['DescriptionN']; iD = json['ID']; - isActive = json['IsActive']; - price = json['Price']; serviceID = json['ServiceID']; - totalPrice = json['TotalPrice']; - vAT = json['VAT']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); - data['Description'] = this.description; - data['DescriptionN'] = this.descriptionN; data['ID'] = this.iD; - data['IsActive'] = this.isActive; - data['Price'] = this.price; data['ServiceID'] = this.serviceID; - data['TotalPrice'] = this.totalPrice; - data['VAT'] = this.vAT; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart index 801d8e13..21399d44 100644 --- a/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart @@ -1,60 +1,131 @@ class SearchEReferralResponseModel { - String patientMobileNumber; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; + dynamic acceptedBrachCode; + dynamic acceptedBranchName; + dynamic acceptedBranchNameAr; + dynamic channel; + dynamic identityCardAttachment; + String identityNumber; + dynamic insuranceCardAttachment; + bool isInsuredPatient; + List medicalReportAttachment; + String otherRelationship; + String patientContactNo; + int patientId; + String patientName; + int preferredBranchCode; + String preferredBranchName; + String referralDate; int referralNumber; - String identificationNo; + RelationshipType relationshipType; + String requesterContactNo; + String requesterName; + String status; + String statusAr; SearchEReferralResponseModel( - {this.patientMobileNumber, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.referralNumber, - this.identificationNo}); + {this.acceptedBrachCode, + this.acceptedBranchName, + this.acceptedBranchNameAr, + this.channel, + this.identityCardAttachment, + this.identityNumber, + this.insuranceCardAttachment, + this.isInsuredPatient, + this.medicalReportAttachment, + this.otherRelationship, + this.patientContactNo, + this.patientId, + this.patientName, + this.preferredBranchCode, + this.preferredBranchName, + this.referralDate, + this.referralNumber, + this.relationshipType, + this.requesterContactNo, + this.requesterName, + this.status, + this.statusAr}); SearchEReferralResponseModel.fromJson(Map json) { - patientMobileNumber = json['PatientMobileNumber']; - versionID = json['VersionID']; + acceptedBrachCode = json['AcceptedBrachCode']; + acceptedBranchName = json['AcceptedBranchName']; + acceptedBranchNameAr = json['AcceptedBranchNameAr']; channel = json['Channel']; - languageID = json['LanguageID']; - iPAdress = json['IPAdress']; - generalid = json['generalid']; - patientOutSA = json['PatientOutSA']; - sessionID = json['SessionID']; - isDentalAllowedBackend = json['isDentalAllowedBackend']; - deviceTypeID = json['DeviceTypeID']; + identityCardAttachment = json['IdentityCardAttachment']; + identityNumber = json['IdentityNumber']; + insuranceCardAttachment = json['InsuranceCardAttachment']; + isInsuredPatient = json['IsInsuredPatient']; + otherRelationship = json['OtherRelationship']; + patientContactNo = json['PatientContactNo']; + patientId = json['PatientId']; + patientName = json['PatientName']; + preferredBranchCode = json['PreferredBranchCode']; + preferredBranchName = json['PreferredBranchName']; + referralDate = json['ReferralDate']; referralNumber = json['ReferralNumber']; - identificationNo = json['IdentificationNo']; + relationshipType = json['RelationshipType'] != null + ? new RelationshipType.fromJson(json['RelationshipType']) + : null; + requesterContactNo = json['RequesterContactNo']; + requesterName = json['RequesterName']; + status = json['Status']; + statusAr = json['StatusAr']; } Map toJson() { final Map data = new Map(); - data['PatientMobileNumber'] = this.patientMobileNumber; - data['VersionID'] = this.versionID; + data['AcceptedBrachCode'] = this.acceptedBrachCode; + data['AcceptedBranchName'] = this.acceptedBranchName; + data['AcceptedBranchNameAr'] = this.acceptedBranchNameAr; data['Channel'] = this.channel; - data['LanguageID'] = this.languageID; - data['IPAdress'] = this.iPAdress; - data['generalid'] = this.generalid; - data['PatientOutSA'] = this.patientOutSA; - data['SessionID'] = this.sessionID; - data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; - data['DeviceTypeID'] = this.deviceTypeID; + data['IdentityCardAttachment'] = this.identityCardAttachment; + data['IdentityNumber'] = this.identityNumber; + data['InsuranceCardAttachment'] = this.insuranceCardAttachment; + data['IsInsuredPatient'] = this.isInsuredPatient; + if (this.medicalReportAttachment != null) { + data['MedicalReportAttachment'] = + this.medicalReportAttachment.map((v) => v.toJson()).toList(); + } + data['OtherRelationship'] = this.otherRelationship; + data['PatientContactNo'] = this.patientContactNo; + data['PatientId'] = this.patientId; + data['PatientName'] = this.patientName; + data['PreferredBranchCode'] = this.preferredBranchCode; + data['PreferredBranchName'] = this.preferredBranchName; + data['ReferralDate'] = this.referralDate; data['ReferralNumber'] = this.referralNumber; - data['IdentificationNo'] = this.identificationNo; + if (this.relationshipType != dynamic) { + data['RelationshipType'] = this.relationshipType.toJson(); + } + data['RequesterContactNo'] = this.requesterContactNo; + data['RequesterName'] = this.requesterName; + data['Status'] = this.status; + data['StatusAr'] = this.statusAr; + return data; + } +} + +class RelationshipType { + int iD; + String text; + String textAr; + String textEn; + + RelationshipType({this.iD, this.text, this.textAr, this.textEn}); + + RelationshipType.fromJson(Map json) { + iD = json['ID']; + text = json['Text']; + textAr = json['Text_Ar']; + textEn = json['Text_En']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['Text'] = this.text; + data['Text_Ar'] = this.textAr; + data['Text_En'] = this.textEn; return data; } } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart index e2f39733..bc5c4b97 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart @@ -1,32 +1,56 @@ class HHCGetAllServicesResponseModel { int iD; - int serviceID; - String description; - String descriptionN; - bool isActive; + String serviceID; + int orderServiceID; + String text; + String textN; + dynamic price; + dynamic priceVAT; + dynamic priceTotal; + bool isEnabled; + int orderId; + int quantity; HHCGetAllServicesResponseModel( {this.iD, this.serviceID, - this.description, - this.descriptionN, - this.isActive}); + this.orderServiceID, + this.text, + this.textN, + this.price, + this.priceVAT, + this.priceTotal, + this.isEnabled, + this.orderId, + this.quantity}); HHCGetAllServicesResponseModel.fromJson(Map json) { iD = json['ID']; serviceID = json['ServiceID']; - description = json['Description']; - descriptionN = json['DescriptionN']; - isActive = json['IsActive']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); data['ID'] = this.iD; data['ServiceID'] = this.serviceID; - data['Description'] = this.description; - data['DescriptionN'] = this.descriptionN; - data['IsActive'] = this.isActive; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart index bc5a4ddf..0fe85c6a 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart @@ -16,7 +16,7 @@ class PatientERHHCInsertServicesList { Map toJson() { final Map data = new Map(); data['RecordID'] = this.recordID; - data['ServiceID'] = this.serviceID; + data['ServiceID'] = this.serviceID.toString(); data['ServiceName'] = this.serviceName; return data; } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart index 6987ee44..bc57a88f 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart @@ -76,7 +76,8 @@ class PatientERInsertPresOrderRequestModel { data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; - data['PatientOutSA'] = this.patientOutSA; + data['isOutPatient'] = this.patientOutSA == 0 ? false : true; + // data['PatientOutSA'] = this.patientOutSA; data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; @@ -84,12 +85,12 @@ class PatientERInsertPresOrderRequestModel { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['Latitude'] = this.latitude; - data['Longitude'] = this.longitude; - data['CreatedBy'] = this.createdBy; + data['latitude'] = this.latitude; + data['longitude'] = this.longitude; + // data['CreatedBy'] = this.createdBy; data['OrderServiceID'] = this.orderServiceID; if (this.patientERHHCInsertServicesList != null) { - data['PatientER_HHC_InsertServicesList'] = + data['procedures'] = this.patientERHHCInsertServicesList.map((v) => v.toJson()).toList(); } return data; diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart index 3b0ef151..68be644d 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart @@ -71,7 +71,8 @@ class UpdatePresOrderRequestModel { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['PresOrderID'] = this.presOrderID; + data['Id'] = this.presOrderID; + data['ClickButton'] = 14; data['PresOrderStatus'] = this.presOrderStatus; data['EditedBy'] = this.editedBy; data['RejectionReason'] = this.rejectionReason; diff --git a/lib/core/model/active_medications/ActivePrescriptionReport.dart b/lib/core/model/active_medications/ActivePrescriptionReport.dart index 1917a6c8..06aeea26 100644 --- a/lib/core/model/active_medications/ActivePrescriptionReport.dart +++ b/lib/core/model/active_medications/ActivePrescriptionReport.dart @@ -10,11 +10,11 @@ class ActivePrescriptionReport { int doseDailyQuantity; String frequency; int frequencyNumber; - List image; - String imageExtension; - dynamic imageSRCUrl; + // List image; + // String imageExtension; + // dynamic imageSRCUrl; String imageString; - dynamic imageThumbUrl; + // dynamic imageThumbUrl; dynamic isCovered; String itemDescription; int itemID; @@ -23,7 +23,7 @@ class ActivePrescriptionReport { dynamic patientName; dynamic phoneOffice1; dynamic prescriptionQR; - double prescriptionTimes; + int prescriptionTimes; dynamic productImage; String productImageBase64; String productImageString; @@ -45,11 +45,11 @@ class ActivePrescriptionReport { this.doseDailyQuantity, this.frequency, this.frequencyNumber, - this.image, - this.imageExtension, - this.imageSRCUrl, + // this.image, + // this.imageExtension, + // this.imageSRCUrl, this.imageString, - this.imageThumbUrl, + // this.imageThumbUrl, this.isCovered, this.itemDescription, this.itemID, @@ -80,11 +80,11 @@ class ActivePrescriptionReport { doseDailyQuantity = json['DoseDailyQuantity']; frequency = json['Frequency']; frequencyNumber = json['FrequencyNumber']; - image = json['Image'].cast(); - imageExtension = json['ImageExtension']; - imageSRCUrl = json['ImageSRCUrl']; + // image = json['Image'].cast(); + // imageExtension = json['ImageExtension']; + // imageSRCUrl = json['ImageSRCUrl']; imageString = json['ImageString']; - imageThumbUrl = json['ImageThumbUrl']; + // imageThumbUrl = json['ImageThumbUrl']; isCovered = json['IsCovered']; itemDescription = json['ItemDescription']; itemID = json['ItemID']; @@ -117,11 +117,11 @@ class ActivePrescriptionReport { data['DoseDailyQuantity'] = this.doseDailyQuantity; data['Frequency'] = this.frequency; data['FrequencyNumber'] = this.frequencyNumber; - data['Image'] = this.image; - data['ImageExtension'] = this.imageExtension; - data['ImageSRCUrl'] = this.imageSRCUrl; + // data['Image'] = this.image; + // data['ImageExtension'] = this.imageExtension; + // data['ImageSRCUrl'] = this.imageSRCUrl; data['ImageString'] = this.imageString; - data['ImageThumbUrl'] = this.imageThumbUrl; + // data['ImageThumbUrl'] = this.imageThumbUrl; data['IsCovered'] = this.isCovered; data['ItemDescription'] = this.itemDescription; data['ItemID'] = this.itemID; diff --git a/lib/core/model/contactus/get_patientI_cprojects.dart b/lib/core/model/contactus/get_patientI_cprojects.dart index e9a6b712..556affd2 100644 --- a/lib/core/model/contactus/get_patientI_cprojects.dart +++ b/lib/core/model/contactus/get_patientI_cprojects.dart @@ -11,6 +11,7 @@ class GetPatientICProjectsModel { dynamic editedOn; dynamic editedBy; bool isActive; + dynamic distanceInKilometers; GetPatientICProjectsModel( {this.id, @@ -22,6 +23,7 @@ class GetPatientICProjectsModel { this.createdBy, this.editedOn, this.editedBy, + this.distanceInKilometers, this.isActive}); GetPatientICProjectsModel.fromJson(Map json) { @@ -35,6 +37,7 @@ class GetPatientICProjectsModel { editedOn = json['EditedOn']; editedBy = json['EditedBy']; isActive = json['IsActive']; + distanceInKilometers = json['DistanceInKilometers']; } Map toJson() { @@ -49,6 +52,7 @@ class GetPatientICProjectsModel { data['EditedOn'] = this.editedOn; data['EditedBy'] = this.editedBy; data['IsActive'] = this.isActive; + data['DistanceInKilometers'] = this.distanceInKilometers; return data; } } \ No newline at end of file diff --git a/lib/core/model/er/AmbulanceRequestOrdersModel.dart b/lib/core/model/er/AmbulanceRequestOrdersModel.dart index 6bcc02b0..72a3fd5f 100644 --- a/lib/core/model/er/AmbulanceRequestOrdersModel.dart +++ b/lib/core/model/er/AmbulanceRequestOrdersModel.dart @@ -1,26 +1,27 @@ class AmbulanceRequestOrdersModel { String statusText; - int paymentStatus; + num paymentStatus; dynamic clientRequestid; dynamic paymentStatusText; dynamic projectName; String nearestProjectName; - double paymentAmount; + num paymentAmount; WFOrder wFOrder; String serviceText; bool isSentForApproval; - int exaCartOrderId; + num exaCartOrderId; + String exaCartGUID; bool isTimer; - int timeSeconds; - int totalPendingSeconds; - int timeMinute; - int timeHour; - int timeTotalSeconds; - int timeTotalMinute; - int timeTotalHour; + num timeSeconds; + num totalPendingSeconds; + num timeMinute; + num timeHour; + num timeTotalSeconds; + num timeTotalMinute; + num timeTotalHour; dynamic approvalStatus; bool isActive; - int clickButton; + num clickButton; dynamic orderHistory; String pickupLocation; String dropOffLocation; @@ -28,22 +29,21 @@ class AmbulanceRequestOrdersModel { String doctorName; String branch; String time; - dynamic notes; - int id; - String patientId; - int patientOutSa; + String notes; + num iD; + num patientId; + num patientOutSa; bool isOutPatient; - int projectId; - int nearestProjectId; + num projectId; + num nearestProjectId; dynamic longitude; dynamic latitude; dynamic appointmentNo; dynamic dischargeId; - int statusId; - int serviceId; - int channel; + num statusId; + num serviceId; + num channel; Orderpayment orderpayment; - dynamic orderselectedservice; dynamic wforder; dynamic orderapprovalobj; String created; @@ -54,266 +54,293 @@ class AmbulanceRequestOrdersModel { AmbulanceRequestOrdersModel( {this.statusText, - this.paymentStatus, - this.clientRequestid, - this.paymentStatusText, - this.projectName, - this.nearestProjectName, - this.paymentAmount, - this.wFOrder, - this.serviceText, - this.isSentForApproval, - this.exaCartOrderId, - this.isTimer, - this.timeSeconds, - this.totalPendingSeconds, - this.timeMinute, - this.timeHour, - this.timeTotalSeconds, - this.timeTotalMinute, - this.timeTotalHour, - this.approvalStatus, - this.isActive, - this.clickButton, - this.orderHistory, - this.pickupLocation, - this.dropOffLocation, - this.clinicName, - this.doctorName, - this.branch, - this.time, - this.notes, - this.id, - this.patientId, - this.patientOutSa, - this.isOutPatient, - this.projectId, - this.nearestProjectId, - this.longitude, - this.latitude, - this.appointmentNo, - this.dischargeId, - this.statusId, - this.serviceId, - this.channel, - this.orderpayment, - this.orderselectedservice, - this.wforder, - this.orderapprovalobj, - this.created, - this.createdBy, - this.modified, - this.modifiedBy, - this.isDeleted}); + this.paymentStatus, + this.clientRequestid, + this.paymentStatusText, + this.projectName, + this.nearestProjectName, + this.paymentAmount, + this.wFOrder, + this.serviceText, + this.isSentForApproval, + this.exaCartOrderId, + this.exaCartGUID, + this.isTimer, + this.timeSeconds, + this.totalPendingSeconds, + this.timeMinute, + this.timeHour, + this.timeTotalSeconds, + this.timeTotalMinute, + this.timeTotalHour, + this.approvalStatus, + this.isActive, + this.clickButton, + this.orderHistory, + this.pickupLocation, + this.dropOffLocation, + this.clinicName, + this.doctorName, + this.branch, + this.time, + this.notes, + this.iD, + this.patientId, + this.patientOutSa, + this.isOutPatient, + this.projectId, + this.nearestProjectId, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeId, + this.statusId, + this.serviceId, + this.channel, + this.orderpayment, + this.wforder, + this.orderapprovalobj, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); AmbulanceRequestOrdersModel.fromJson(Map json) { - statusText = json['statusText']; - paymentStatus = json['paymentStatus']; - clientRequestid = json['clientRequestid']; - paymentStatusText = json['paymentStatusText']; - projectName = json['projectName']; - nearestProjectName = json['nearestProjectName']; - paymentAmount = json['paymentAmount']; - wFOrder = json['wF_order'] != null ? new WFOrder.fromJson(json['wF_order']) : null; - serviceText = json['serviceText']; + statusText = json['StatusText']; + paymentStatus = json['PaymentStatus']; + clientRequestid = json['ClientRequestid']; + paymentStatusText = json['PaymentStatusText']; + projectName = json['ProjectName']; + nearestProjectName = json['NearestProjectName']; + paymentAmount = json['PaymentAmount']; + wFOrder = json['WF_order'] != null + ? new WFOrder.fromJson(json['WF_order']) + : null; + serviceText = json['ServiceText']; isSentForApproval = json['isSentForApproval']; - exaCartOrderId = json['exaCart_OrderId']; + exaCartOrderId = json['ExaCart_OrderId']; + exaCartGUID = json['ExaCart_GUID']; isTimer = json['isTimer']; - timeSeconds = json['timeSeconds']; - totalPendingSeconds = json['totalPendingSeconds']; - timeMinute = json['timeMinute']; - timeHour = json['timeHour']; - timeTotalSeconds = json['timeTotalSeconds']; - timeTotalMinute = json['timeTotalMinute']; - timeTotalHour = json['timeTotalHour']; - approvalStatus = json['approvalStatus']; + timeSeconds = json['TimeSeconds']; + totalPendingSeconds = json['TotalPendingSeconds']; + timeMinute = json['TimeMinute']; + timeHour = json['TimeHour']; + timeTotalSeconds = json['TimeTotalSeconds']; + timeTotalMinute = json['TimeTotalMinute']; + timeTotalHour = json['TimeTotalHour']; + approvalStatus = json['ApprovalStatus']; isActive = json['isActive']; - clickButton = json['clickButton']; - orderHistory = json['orderHistory']; - pickupLocation = json['pickupLocation']; - dropOffLocation = json['dropOffLocation']; + clickButton = json['ClickButton']; + orderHistory = json['OrderHistory']; + pickupLocation = json['PickupLocation']; + dropOffLocation = json['DropOffLocation']; clinicName = json['clinicName']; - doctorName = json['doctorName']; - branch = json['branch']; - time = json['time']; - notes = json['notes']; - id = json['id']; - patientId = json['patientId']; - patientOutSa = json['patientOutSa']; - isOutPatient = json['isOutPatient']; - projectId = json['projectId']; - nearestProjectId = json['nearestProjectId']; - longitude = json['longitude']; - latitude = json['latitude']; - appointmentNo = json['appointmentNo']; - dischargeId = json['dischargeId']; - statusId = json['statusId']; - serviceId = json['serviceId']; - channel = json['channel']; - orderpayment = json['orderpayment'] != null ? new Orderpayment.fromJson(json['orderpayment']) : null; - orderselectedservice = json['orderselectedservice']; + doctorName = json['DoctorName']; + branch = json['Branch']; + time = json['Time']; + notes = json['Notes']; + iD = json['ID']; + patientId = json['PatientId']; + patientOutSa = json['PatientOutSa']; + isOutPatient = json['IsOutPatient']; + projectId = json['ProjectId']; + nearestProjectId = json['NearestProjectId']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeId = json['DischargeId']; + statusId = json['StatusId']; + serviceId = json['ServiceId']; + channel = json['Channel']; + orderpayment = json['orderpayment'] != null + ? new Orderpayment.fromJson(json['orderpayment']) + : null; wforder = json['wforder']; orderapprovalobj = json['orderapprovalobj']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); - data['statusText'] = this.statusText; - data['paymentStatus'] = this.paymentStatus; - data['clientRequestid'] = this.clientRequestid; - data['paymentStatusText'] = this.paymentStatusText; - data['projectName'] = this.projectName; - data['nearestProjectName'] = this.nearestProjectName; - data['paymentAmount'] = this.paymentAmount; + data['StatusText'] = this.statusText; + data['PaymentStatus'] = this.paymentStatus; + data['ClientRequestid'] = this.clientRequestid; + data['PaymentStatusText'] = this.paymentStatusText; + data['ProjectName'] = this.projectName; + data['NearestProjectName'] = this.nearestProjectName; + data['PaymentAmount'] = this.paymentAmount; if (this.wFOrder != null) { - data['wF_order'] = this.wFOrder.toJson(); + data['WF_order'] = this.wFOrder.toJson(); } - data['serviceText'] = this.serviceText; + data['ServiceText'] = this.serviceText; data['isSentForApproval'] = this.isSentForApproval; - data['exaCart_OrderId'] = this.exaCartOrderId; + data['ExaCart_OrderId'] = this.exaCartOrderId; + data['ExaCart_GUID'] = this.exaCartGUID; data['isTimer'] = this.isTimer; - data['timeSeconds'] = this.timeSeconds; - data['totalPendingSeconds'] = this.totalPendingSeconds; - data['timeMinute'] = this.timeMinute; - data['timeHour'] = this.timeHour; - data['timeTotalSeconds'] = this.timeTotalSeconds; - data['timeTotalMinute'] = this.timeTotalMinute; - data['timeTotalHour'] = this.timeTotalHour; - data['approvalStatus'] = this.approvalStatus; + data['TimeSeconds'] = this.timeSeconds; + data['TotalPendingSeconds'] = this.totalPendingSeconds; + data['TimeMinute'] = this.timeMinute; + data['TimeHour'] = this.timeHour; + data['TimeTotalSeconds'] = this.timeTotalSeconds; + data['TimeTotalMinute'] = this.timeTotalMinute; + data['TimeTotalHour'] = this.timeTotalHour; + data['ApprovalStatus'] = this.approvalStatus; data['isActive'] = this.isActive; - data['clickButton'] = this.clickButton; - data['orderHistory'] = this.orderHistory; - data['pickupLocation'] = this.pickupLocation; - data['dropOffLocation'] = this.dropOffLocation; + data['ClickButton'] = this.clickButton; + data['OrderHistory'] = this.orderHistory; + data['PickupLocation'] = this.pickupLocation; + data['DropOffLocation'] = this.dropOffLocation; data['clinicName'] = this.clinicName; - data['doctorName'] = this.doctorName; - data['branch'] = this.branch; - data['time'] = this.time; - data['notes'] = this.notes; - data['id'] = this.id; - data['patientId'] = this.patientId; - data['patientOutSa'] = this.patientOutSa; - data['isOutPatient'] = this.isOutPatient; - data['projectId'] = this.projectId; - data['nearestProjectId'] = this.nearestProjectId; - data['longitude'] = this.longitude; - data['latitude'] = this.latitude; - data['appointmentNo'] = this.appointmentNo; - data['dischargeId'] = this.dischargeId; - data['statusId'] = this.statusId; - data['serviceId'] = this.serviceId; - data['channel'] = this.channel; + data['DoctorName'] = this.doctorName; + data['Branch'] = this.branch; + data['Time'] = this.time; + data['Notes'] = this.notes; + data['ID'] = this.iD; + data['PatientId'] = this.patientId; + data['PatientOutSa'] = this.patientOutSa; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectId'] = this.projectId; + data['NearestProjectId'] = this.nearestProjectId; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeId'] = this.dischargeId; + data['StatusId'] = this.statusId; + data['ServiceId'] = this.serviceId; + data['Channel'] = this.channel; if (this.orderpayment != null) { data['orderpayment'] = this.orderpayment.toJson(); } - data['orderselectedservice'] = this.orderselectedservice; data['wforder'] = this.wforder; data['orderapprovalobj'] = this.orderapprovalobj; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } class WFOrder { - dynamic wfButtonsDTO; - int id; - int orderId; - int previousStep; - int nextStep; - int serviceId; - dynamic order; + Null wfButtonsDTO; + num iD; + num orderId; + num previousStep; + num nextStep; + num serviceId; + Null order; String created; - dynamic createdBy; - dynamic modified; - dynamic modifiedBy; + Null createdBy; + Null modified; + Null modifiedBy; bool isDeleted; - WFOrder({this.wfButtonsDTO, this.id, this.orderId, this.previousStep, this.nextStep, this.serviceId, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted}); + WFOrder( + {this.wfButtonsDTO, + this.iD, + this.orderId, + this.previousStep, + this.nextStep, + this.serviceId, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); WFOrder.fromJson(Map json) { wfButtonsDTO = json['wf_ButtonsDTO']; - id = json['id']; - orderId = json['orderId']; - previousStep = json['previousStep']; - nextStep = json['nextStep']; - serviceId = json['serviceId']; - order = json['order']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + iD = json['ID']; + orderId = json['OrderId']; + previousStep = json['PreviousStep']; + nextStep = json['NextStep']; + serviceId = json['ServiceId']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); data['wf_ButtonsDTO'] = this.wfButtonsDTO; - data['id'] = this.id; - data['orderId'] = this.orderId; - data['previousStep'] = this.previousStep; - data['nextStep'] = this.nextStep; - data['serviceId'] = this.serviceId; - data['order'] = this.order; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['PreviousStep'] = this.previousStep; + data['NextStep'] = this.nextStep; + data['ServiceId'] = this.serviceId; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } class Orderpayment { - int id; - int orderId; - dynamic clientRequestId; - double totalAmount; - int paymentStatus; - dynamic order; + num iD; + num orderId; + Null clientRequestId; + num totalAmount; + num paymentStatus; + Null order; String created; - dynamic createdBy; - dynamic modified; - dynamic modifiedBy; + Null createdBy; + Null modified; + Null modifiedBy; bool isDeleted; - Orderpayment({this.id, this.orderId, this.clientRequestId, this.totalAmount, this.paymentStatus, this.order, this.created, this.createdBy, this.modified, this.modifiedBy, this.isDeleted}); + Orderpayment( + {this.iD, + this.orderId, + this.clientRequestId, + this.totalAmount, + this.paymentStatus, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); Orderpayment.fromJson(Map json) { - id = json['id']; - orderId = json['orderId']; - clientRequestId = json['clientRequestId']; - totalAmount = json['totalAmount']; - paymentStatus = json['paymentStatus']; - order = json['order']; - created = json['created']; - createdBy = json['createdBy']; - modified = json['modified']; - modifiedBy = json['modifiedBy']; - isDeleted = json['isDeleted']; + iD = json['ID']; + orderId = json['OrderId']; + clientRequestId = json['ClientRequestId']; + totalAmount = json['TotalAmount']; + paymentStatus = json['PaymentStatus']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; } Map toJson() { final Map data = new Map(); - data['id'] = this.id; - data['orderId'] = this.orderId; - data['clientRequestId'] = this.clientRequestId; - data['totalAmount'] = this.totalAmount; - data['paymentStatus'] = this.paymentStatus; - data['order'] = this.order; - data['created'] = this.created; - data['createdBy'] = this.createdBy; - data['modified'] = this.modified; - data['modifiedBy'] = this.modifiedBy; - data['isDeleted'] = this.isDeleted; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['ClientRequestId'] = this.clientRequestId; + data['TotalAmount'] = this.totalAmount; + data['PaymentStatus'] = this.paymentStatus; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; return data; } } diff --git a/lib/core/model/er/PatientER_RC.dart b/lib/core/model/er/PatientER_RC.dart index f5afc1d6..6abec2d6 100644 --- a/lib/core/model/er/PatientER_RC.dart +++ b/lib/core/model/er/PatientER_RC.dart @@ -10,7 +10,7 @@ class PatientER_RC { String sessionID; bool isDentalAllowedBackend; int deviceTypeID; - String patientID; + int patientID; String tokenID; int patientTypeID; int patientType; @@ -103,6 +103,7 @@ class TransportationDetails { String pickupDateTime; String transportationType; int ambulate; + String ambulateTitle; String notes; int requesterFileNo; String requesterMobileNo; @@ -128,6 +129,7 @@ class TransportationDetails { this.pickupDateTime, this.transportationType, this.ambulate, + this.ambulateTitle, this.notes, this.requesterFileNo, this.requesterMobileNo, @@ -153,6 +155,7 @@ class TransportationDetails { pickupDateTime = json['pickupDateTime']; transportationType = json['transportationType']; ambulate = json['ambulate']; + ambulateTitle = ""; notes = json['notes']; requesterFileNo = json['requesterFileNo']; requesterMobileNo = json['requesterMobileNo']; @@ -180,6 +183,7 @@ class TransportationDetails { data['pickupDateTime'] = this.pickupDateTime; data['transportationType'] = this.transportationType; data['ambulate'] = this.ambulate; + data['ambulateTitle'] = this.ambulateTitle; data['notes'] = this.notes; data['requesterFileNo'] = this.requesterFileNo; data['requesterMobileNo'] = this.requesterMobileNo; diff --git a/lib/core/model/er/get_all_transportation_method_list_model.dart b/lib/core/model/er/get_all_transportation_method_list_model.dart index 1f0a91c3..530b4f25 100644 --- a/lib/core/model/er/get_all_transportation_method_list_model.dart +++ b/lib/core/model/er/get_all_transportation_method_list_model.dart @@ -1,5 +1,5 @@ class PatientERTransportationMethod { - int id; + int iD; String serviceID; int orderServiceID; String text; @@ -12,7 +12,7 @@ class PatientERTransportationMethod { int quantity; PatientERTransportationMethod( - {this.id, + {this.iD, this.serviceID, this.orderServiceID, this.text, @@ -25,32 +25,32 @@ class PatientERTransportationMethod { this.quantity}); PatientERTransportationMethod.fromJson(Map json) { - id = json['id']; - serviceID = json['serviceID']; - orderServiceID = json['orderServiceID']; - text = json['text']; - textN = json['textN']; - price = json['price']; - priceVAT = json['priceVAT']; - priceTotal = json['priceTotal']; - isEnabled = json['isEnabled']; - orderId = json['orderId']; - quantity = json['quantity']; + iD = json['ID']; + serviceID = json['ServiceID']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); - data['id'] = this.id; - data['serviceID'] = this.serviceID; - data['orderServiceID'] = this.orderServiceID; - data['text'] = this.text; - data['textN'] = this.textN; - data['price'] = this.price; - data['priceVAT'] = this.priceVAT; - data['priceTotal'] = this.priceTotal; - data['isEnabled'] = this.isEnabled; - data['orderId'] = this.orderId; - data['quantity'] = this.quantity; + data['ID'] = this.iD; + data['ServiceID'] = this.serviceID; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/eye/AppoimentAllHistoryResult.dart b/lib/core/model/eye/AppoimentAllHistoryResult.dart index ed123023..71c9573b 100644 --- a/lib/core/model/eye/AppoimentAllHistoryResult.dart +++ b/lib/core/model/eye/AppoimentAllHistoryResult.dart @@ -66,74 +66,76 @@ class AppoimentAllHistoryResultList { String qR; int remaniningHoursTocanPay; bool sMSButtonVisable; + bool isInOutPatient; - AppoimentAllHistoryResultList( - {this.setupID, - this.projectID, - this.appointmentNo, - this.appointmentDate, - this.appointmentDateN, - this.appointmentType, - this.bookDate, - this.patientID, - this.doctorID, - this.endDate, - this.startTime, - this.endTime, - this.status, - this.visitFor, - this.patientStatusType, - this.companyID, - this.bookedBy, - this.bookedOn, - this.confirmedBy, - this.confirmedOn, - this.arrivalChangedBy, - this.arrivedOn, - this.editedBy, - this.editedOn, - this.doctorName, - this.doctorNameN, - this.statusDesc, - this.statusDescN, - this.vitalStatus, - this.vitalSignAppointmentNo, - this.episodeID, - this.actualDoctorRate, - this.clinicName, - this.complainExists, - this.doctorImageURL, - this.doctorNameObj, - this.doctorRate, - this.doctorSpeciality, - this.doctorTitle, - this.gender, - this.genderDescription, - this.iSAllowOnlineCheckedIN, - this.isActiveDoctor, - this.isActiveDoctorProfile, - this.isDoctorAllowVedioCall, - this.isExecludeDoctor, - this.isFollowup, - this.isLiveCareAppointment, - this.isMedicalReportRequested, - this.isOnlineCheckedIN, - this.latitude, - this.listHISGetContactLensPerscription, - this.listHISGetGlassPerscription, - this.longitude, - this.nextAction, - this.noOfPatientsRate, - this.originalClinicID, - this.originalProjectID, - this.projectName, - this.qR, - this.remaniningHoursTocanPay, - this.sMSButtonVisable, - this.clinicID, - this.patientType, - - this.visitType}); + AppoimentAllHistoryResultList({ + this.setupID, + this.projectID, + this.appointmentNo, + this.appointmentDate, + this.appointmentDateN, + this.appointmentType, + this.bookDate, + this.patientID, + this.doctorID, + this.endDate, + this.startTime, + this.endTime, + this.status, + this.visitFor, + this.patientStatusType, + this.companyID, + this.bookedBy, + this.bookedOn, + this.confirmedBy, + this.confirmedOn, + this.arrivalChangedBy, + this.arrivedOn, + this.editedBy, + this.editedOn, + this.doctorName, + this.doctorNameN, + this.statusDesc, + this.statusDescN, + this.vitalStatus, + this.vitalSignAppointmentNo, + this.episodeID, + this.actualDoctorRate, + this.clinicName, + this.complainExists, + this.doctorImageURL, + this.doctorNameObj, + this.doctorRate, + this.doctorSpeciality, + this.doctorTitle, + this.gender, + this.genderDescription, + this.iSAllowOnlineCheckedIN, + this.isActiveDoctor, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isFollowup, + this.isLiveCareAppointment, + this.isMedicalReportRequested, + this.isOnlineCheckedIN, + this.latitude, + this.listHISGetContactLensPerscription, + this.listHISGetGlassPerscription, + this.longitude, + this.nextAction, + this.noOfPatientsRate, + this.originalClinicID, + this.originalProjectID, + this.projectName, + this.qR, + this.remaniningHoursTocanPay, + this.sMSButtonVisable, + this.clinicID, + this.patientType, + this.visitType, + this.isInOutPatient, + }); AppoimentAllHistoryResultList.fromJson(Map json) { setupID = json['SetupID']; @@ -176,7 +178,7 @@ class AppoimentAllHistoryResultList { doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; doctorRate = json['DoctorRate']; - // doctorSpeciality = json['DoctorSpeciality'].cast(); + doctorSpeciality = json['DoctorSpeciality'].cast(); doctorTitle = json['DoctorTitle']; gender = json['Gender']; genderDescription = json['GenderDescription']; @@ -191,18 +193,15 @@ class AppoimentAllHistoryResultList { isOnlineCheckedIN = json['IsOnlineCheckedIN']; latitude = json['Latitude']; if (json['List_HIS_GetContactLensPerscription'] != null) { - listHISGetContactLensPerscription = - new List(); + listHISGetContactLensPerscription = new List(); json['List_HIS_GetContactLensPerscription'].forEach((v) { - listHISGetContactLensPerscription - .add(new ListHISGetContactLensPerscription.fromJson(v)); + listHISGetContactLensPerscription.add(new ListHISGetContactLensPerscription.fromJson(v)); }); } if (json['List_HIS_GetGlassPerscription'] != null) { listHISGetGlassPerscription = new List(); json['List_HIS_GetGlassPerscription'].forEach((v) { - listHISGetGlassPerscription - .add(new ListHISGetGlassPerscription.fromJson(v)); + listHISGetGlassPerscription.add(new ListHISGetGlassPerscription.fromJson(v)); }); } longitude = json['Longitude']; @@ -218,6 +217,7 @@ class AppoimentAllHistoryResultList { patientType = json['patientType']; status = json['status']; visitType = json['visitType']; + isInOutPatient = json['IsInOutPatient']; } Map toJson() { @@ -277,14 +277,10 @@ class AppoimentAllHistoryResultList { data['IsOnlineCheckedIN'] = this.isOnlineCheckedIN; data['Latitude'] = this.latitude; if (this.listHISGetContactLensPerscription != null) { - data['List_HIS_GetContactLensPerscription'] = this - .listHISGetContactLensPerscription - .map((v) => v.toJson()) - .toList(); + data['List_HIS_GetContactLensPerscription'] = this.listHISGetContactLensPerscription.map((v) => v.toJson()).toList(); } if (this.listHISGetGlassPerscription != null) { - data['List_HIS_GetGlassPerscription'] = - this.listHISGetGlassPerscription.map((v) => v.toJson()).toList(); + data['List_HIS_GetGlassPerscription'] = this.listHISGetGlassPerscription.map((v) => v.toJson()).toList(); } data['Longitude'] = this.longitude; data['NextAction'] = this.nextAction; @@ -325,23 +321,23 @@ class ListHISGetContactLensPerscription { ListHISGetContactLensPerscription( {this.setupId, - this.projectId, - this.patientType, - this.patientId, - this.encounterType, - this.encounterNo, - this.oDOS, - this.brand, - this.baseCurve, - this.power, - this.diameter, - this.oZ, - this.cT, - this.blend, - this.remarks, - this.status, - this.isActive, - this.createdOn}); + this.projectId, + this.patientType, + this.patientId, + this.encounterType, + this.encounterNo, + this.oDOS, + this.brand, + this.baseCurve, + this.power, + this.diameter, + this.oZ, + this.cT, + this.blend, + this.remarks, + this.status, + this.isActive, + this.createdOn}); ListHISGetContactLensPerscription.fromJson(Map json) { setupId = json['SetupId']; @@ -415,28 +411,28 @@ class ListHISGetGlassPerscription { ListHISGetGlassPerscription( {this.projectID, - this.setupID, - this.patientId, - this.encounterType, - this.encounterNo, - this.visionType, - this.rightEyeSpherical, - this.rightEyeCylinder, - this.rightEyeAxis, - this.rightEyePrism, - this.rightEyeVA, - this.rightEyeRemarks, - this.leftEyeSpherical, - this.leftEyeCylinder, - this.leftEyeAxis, - this.leftEyePrism, - this.leftEyeVA, - this.leftEyeRemarks, - this.pD, - this.bVD, - this.status, - this.isActive, - this.createdOn}); + this.setupID, + this.patientId, + this.encounterType, + this.encounterNo, + this.visionType, + this.rightEyeSpherical, + this.rightEyeCylinder, + this.rightEyeAxis, + this.rightEyePrism, + this.rightEyeVA, + this.rightEyeRemarks, + this.leftEyeSpherical, + this.leftEyeCylinder, + this.leftEyeAxis, + this.leftEyePrism, + this.leftEyeVA, + this.leftEyeRemarks, + this.pD, + this.bVD, + this.status, + this.isActive, + this.createdOn}); ListHISGetGlassPerscription.fromJson(Map json) { projectID = json['ProjectID']; @@ -492,6 +488,3 @@ class ListHISGetGlassPerscription { return data; } } - - - diff --git a/lib/core/model/feedback/COC_items.dart b/lib/core/model/feedback/COC_items.dart index 2748ca50..4139fc59 100644 --- a/lib/core/model/feedback/COC_items.dart +++ b/lib/core/model/feedback/COC_items.dart @@ -26,6 +26,7 @@ class COCItem { String status; String statusAr; dynamic statusEn; + int statusId; COCItem({ this.appointment, @@ -55,6 +56,7 @@ class COCItem { this.status, this.statusAr, this.statusEn, + this.statusId, }); COCItem.fromJson(Map json) { @@ -85,6 +87,7 @@ class COCItem { status = json['Status']; statusAr = json['StatusAr']; statusEn = json['StatusEn']; + statusId = json['StatusId']; } Map toJson() { diff --git a/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart b/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart index 26bf567a..3fa91ecf 100644 --- a/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart +++ b/lib/core/model/insurance/ReauestInsuranceApprovalModel.dart @@ -14,6 +14,7 @@ class RequestInsuranceApprovalModel { int patientType; int eXuldAPPNO; int projectID; + int appointmentNo; RequestInsuranceApprovalModel( {this.versionID, @@ -30,7 +31,8 @@ class RequestInsuranceApprovalModel { this.patientTypeID, this.patientType, this.eXuldAPPNO, - this.projectID}); + this.projectID, + this.appointmentNo}); RequestInsuranceApprovalModel.fromJson(Map json) { versionID = json['VersionID']; @@ -48,6 +50,7 @@ class RequestInsuranceApprovalModel { patientType = json['PatientType']; eXuldAPPNO = json['EXuldAPPNO']; projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; } Map toJson() { @@ -67,6 +70,7 @@ class RequestInsuranceApprovalModel { data['PatientType'] = this.patientType; data['EXuldAPPNO'] = this.eXuldAPPNO; data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; return data; } } diff --git a/lib/core/model/insurance/insurance_approval.dart b/lib/core/model/insurance/insurance_approval.dart index 27911267..52100514 100644 --- a/lib/core/model/insurance/insurance_approval.dart +++ b/lib/core/model/insurance/insurance_approval.dart @@ -216,7 +216,7 @@ class InsuranceApprovalModel { eApprovalRemarks = json['EApprovalRemarks']; isEmailSentOnDelayApproval = json['IsEmailSentOnDelayApproval']; eAuthorizationID = json['EAuthorizationID']; - if (json['ApporvalDetails'] != null) { + if (json['ApporvalDetails'] != null && json['ApporvalDetails'].length != 0) { apporvalDetails = InsuranceApprovalDetails.fromJson(json['ApporvalDetails'][0]); } approvalStatusDescption = json['ApprovalStatusDescption']; @@ -239,7 +239,7 @@ class InsuranceApprovalModel { projectName = json['ProjectName']; projectNameN = json['ProjectNameN']; qR = json['QR']; - speciality = json['Speciality'].cast(); + if (json['Speciality'] != null) speciality = json['Speciality'].cast(); strApprovalDate = json['StrApprovalDate']; strExpiryDate = json['StrExpiryDate']; strSubmitDate = json['StrSubmitDate']; diff --git a/lib/core/model/insurance/insurance_card.dart b/lib/core/model/insurance/insurance_card.dart index ebab8d71..3b91ea9a 100644 --- a/lib/core/model/insurance/insurance_card.dart +++ b/lib/core/model/insurance/insurance_card.dart @@ -1,4 +1,4 @@ -import 'dart:convert'; + class InsuranceCardModel { double versionID; diff --git a/lib/core/model/insurance/insurance_card_update_model.dart b/lib/core/model/insurance/insurance_card_update_model.dart index 6f5331ce..52bd8ad7 100644 --- a/lib/core/model/insurance/insurance_card_update_model.dart +++ b/lib/core/model/insurance/insurance_card_update_model.dart @@ -1,6 +1,4 @@ -import 'dart:convert'; -import 'package:intl/intl.dart'; class InsuranceUpdateModel { int patientID; diff --git a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart index 116545bd..9cc3d3b9 100644 --- a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart +++ b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart @@ -1,20 +1,41 @@ +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:flutter/cupertino.dart'; class PackagesCustomerRequestModel { + String username; + String first_name; + String last_name; String email; - String phoneNumber; + String phone; + String national_id; + String date_of_birth; - PackagesCustomerRequestModel({@required this.email, @required this.phoneNumber}); + + PackagesCustomerRequestModel.fromUser(AuthenticatedUser user){ + this.username = "${user.patientID}"; + this.first_name = user.firstName; + this.last_name = user.lastName; + this.email = user.emailAddress; + this.phone = user.mobileNumber; + this.national_id = user.patientIdentificationNo; + this.date_of_birth = user.dateofBirth; + } Map json() { return { "customer" : { - "email": email, - "addresses": [{ - "email": email, - "phone_number": phoneNumber - }] + "email": email ?? '', + "username": username ?? '', + "national_id": national_id ?? '', + "phone": phone ?? '', + "date_of_birth": date_of_birth ?? '', + "first_name": first_name ?? '', + "last_name": last_name ?? '', + // "addresses": [{ + // "email": email, + // "phone_number": phoneNumber + // }] } }; } diff --git a/lib/core/model/packages_offers/responses/PackagesResponseModel.dart b/lib/core/model/packages_offers/responses/PackagesResponseModel.dart index 7297a20a..23a864f7 100644 --- a/lib/core/model/packages_offers/responses/PackagesResponseModel.dart +++ b/lib/core/model/packages_offers/responses/PackagesResponseModel.dart @@ -192,6 +192,8 @@ class PackagesResponseModel with JsonConvert { List discountIds; @JSONField(name: "store_ids") List storeIds; + @JSONField(name: "store_names") + List storeNames; @JSONField(name: "manufacturer_ids") List manufacturerIds; List reviews; @@ -207,12 +209,10 @@ class PackagesResponseModel with JsonConvert { String seName; String getName() { - if(localizedNames.length == 2){ - if(localizedNames.first.languageId == 2) + if (localizedNames.length == 2) { + if (localizedNames.first.languageId == 2) return localizedNames.first.localizedName ?? name; - - else if(localizedNames.first.languageId == 1) - return localizedNames.last.localizedName ?? name; + else if (localizedNames.first.languageId == 1) return localizedNames.last.localizedName ?? name; } return name; } diff --git a/lib/core/model/packages_offers/responses/order_response_model.dart b/lib/core/model/packages_offers/responses/order_response_model.dart index ed53a765..0a464043 100644 --- a/lib/core/model/packages_offers/responses/order_response_model.dart +++ b/lib/core/model/packages_offers/responses/order_response_model.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart'; + import 'PackagesCartItemsResponseModel.dart'; class PackagesOrderResponseModel { diff --git a/lib/core/model/packages_offers/responses/tamara_payment_option.dart b/lib/core/model/packages_offers/responses/tamara_payment_option.dart new file mode 100644 index 00000000..ad79f5f3 --- /dev/null +++ b/lib/core/model/packages_offers/responses/tamara_payment_option.dart @@ -0,0 +1,35 @@ +class TamaraPaymentOption { + String name; + double minLimit; + double maxLimit; + int id; + + String fullName() => '$name Months'; + + TamaraPaymentOption({ + this.name, + this.minLimit, + this.maxLimit, + this.id}); + + + @override + String toString() => fullName(); + + TamaraPaymentOption.fromJson(dynamic json) { + name = json["name"]; + minLimit = json["min_limit"]; + maxLimit = json["max_limit"]; + id = json["id"]; + } + + Map toJson() { + var map = {}; + map["name"] = name; + map["min_limit"] = minLimit; + map["max_limit"] = maxLimit; + map["id"] = id; + return map; + } + +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/Prescriptions.dart b/lib/core/model/pharmacies/Prescriptions.dart deleted file mode 100644 index 80caff0a..00000000 --- a/lib/core/model/pharmacies/Prescriptions.dart +++ /dev/null @@ -1,157 +0,0 @@ - - -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; - -class Prescriptions { - String setupID; - int projectID; - int patientID; - int appointmentNo; - String appointmentDate; - String doctorName; - String clinicDescription; - String name; - int episodeID; - int actualDoctorRate; - int admission; - int clinicID; - String companyName; - String despensedStatus; - DateTime dischargeDate; - int dischargeNo; - int doctorID; - String doctorImageURL; - int doctorRate; - String doctorTitle; - int gender; - String genderDescription; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; - String isInOutPatientDescription; - String isInOutPatientDescriptionN; - bool isInsurancePatient; - String nationalityFlagURL; - int noOfPatientsRate; - String qR; - List speciality; - - Prescriptions( - {this.setupID, - this.projectID, - this.patientID, - this.appointmentNo, - this.appointmentDate, - this.doctorName, - this.clinicDescription, - this.name, - this.episodeID, - this.actualDoctorRate, - this.admission, - this.clinicID, - this.companyName, - this.despensedStatus, - this.dischargeDate, - this.dischargeNo, - this.doctorID, - this.doctorImageURL, - this.doctorRate, - this.doctorTitle, - this.gender, - this.genderDescription, - this.isActiveDoctorProfile, - this.isDoctorAllowVedioCall, - this.isExecludeDoctor, - this.isInOutPatient, - this.isInOutPatientDescription, - this.isInOutPatientDescriptionN, - this.isInsurancePatient, - this.nationalityFlagURL, - this.noOfPatientsRate, - this.qR, - this.speciality}); - - Prescriptions.fromJson(Map json) { - setupID = json['SetupID']; - projectID = json['ProjectID']; - patientID = json['PatientID']; - appointmentNo = json['AppointmentNo']; - appointmentDate = json['AppointmentDate']; - doctorName = json['DoctorName']; - clinicDescription = json['ClinicDescription']; - name = json['Name']; - episodeID = json['EpisodeID']; - actualDoctorRate = json['ActualDoctorRate']; - admission = json['Admission']; - clinicID = json['ClinicID']; - companyName = json['CompanyName']; - despensedStatus = json['Despensed_Status']; - dischargeDate = DateUtil.convertStringToDate(json['DischargeDate']); - dischargeNo = json['DischargeNo']; - doctorID = json['DoctorID']; - doctorImageURL = json['DoctorImageURL']; - doctorRate = json['DoctorRate']; - doctorTitle = json['DoctorTitle']; - gender = json['Gender']; - genderDescription = json['GenderDescription']; - isActiveDoctorProfile = json['IsActiveDoctorProfile']; - isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; - isExecludeDoctor = json['IsExecludeDoctor']; - isInOutPatient = json['IsInOutPatient']; - isInOutPatientDescription = json['IsInOutPatientDescription']; - isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; - isInsurancePatient = json['IsInsurancePatient']; - nationalityFlagURL = json['NationalityFlagURL']; - noOfPatientsRate = json['NoOfPatientsRate']; - qR = json['QR']; - // speciality = json['Speciality'].cast(); - } - - Map toJson() { - final Map data = new Map(); - data['SetupID'] = this.setupID; - data['ProjectID'] = this.projectID; - data['PatientID'] = this.patientID; - data['AppointmentNo'] = this.appointmentNo; - data['AppointmentDate'] = this.appointmentDate; - data['DoctorName'] = this.doctorName; - data['ClinicDescription'] = this.clinicDescription; - data['Name'] = this.name; - data['EpisodeID'] = this.episodeID; - data['ActualDoctorRate'] = this.actualDoctorRate; - data['Admission'] = this.admission; - data['ClinicID'] = this.clinicID; - data['CompanyName'] = this.companyName; - data['Despensed_Status'] = this.despensedStatus; - data['DischargeDate'] = this.dischargeDate; - data['DischargeNo'] = this.dischargeNo; - data['DoctorID'] = this.doctorID; - data['DoctorImageURL'] = this.doctorImageURL; - data['DoctorRate'] = this.doctorRate; - data['DoctorTitle'] = this.doctorTitle; - data['Gender'] = this.gender; - data['GenderDescription'] = this.genderDescription; - data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; - data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; - data['IsExecludeDoctor'] = this.isExecludeDoctor; - data['IsInOutPatient'] = this.isInOutPatient; - data['IsInOutPatientDescription'] = this.isInOutPatientDescription; - data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; - data['IsInsurancePatient'] = this.isInsurancePatient; - data['NationalityFlagURL'] = this.nationalityFlagURL; - data['NoOfPatientsRate'] = this.noOfPatientsRate; - data['QR'] = this.qR; - data['Speciality'] = this.speciality; - return data; - } -} - -//class PrescriptionsList { -// String filterName = ""; -// List prescriptionsList = List(); -// -// PrescriptionsList({this.filterName, Prescriptions prescriptions}) { -// prescriptionsList.add(prescriptions); -// } -//} diff --git a/lib/core/model/pharmacies/ShoppingCartResponse.dart b/lib/core/model/pharmacies/ShoppingCartResponse.dart index 332f63b6..1d90464d 100644 --- a/lib/core/model/pharmacies/ShoppingCartResponse.dart +++ b/lib/core/model/pharmacies/ShoppingCartResponse.dart @@ -8,6 +8,7 @@ class ShoppingCartResponse { double subtotalWithVat; double subtotalVatAmount; double subtotalVatRate; + double totalAmount; List shoppingCarts; ShoppingCartResponse( @@ -16,7 +17,8 @@ class ShoppingCartResponse { this.subtotal=0.0, this.subtotalWithVat = 0.0, this.subtotalVatAmount = 0.0, - this.subtotalVatRate = 0.0 , + this.subtotalVatRate = 0.0, + this.totalAmount = 0.0, this.shoppingCarts}); diff --git a/lib/core/model/prescriptions/perscription_pharmacy.dart b/lib/core/model/prescriptions/perscription_pharmacy.dart index 3adaef7e..9c9bec08 100644 --- a/lib/core/model/prescriptions/perscription_pharmacy.dart +++ b/lib/core/model/prescriptions/perscription_pharmacy.dart @@ -7,7 +7,7 @@ class PharmacyPrescriptions { int projectID; String setupID; String locationDescription; - Null locationDescriptionN; + dynamic locationDescriptionN; String itemDescription; Null itemDescriptionN; String alias; @@ -16,7 +16,7 @@ class PharmacyPrescriptions { Null companybarcode; int cityID; String cityName; - int distanceInKilometers; + dynamic distanceInKilometers; String latitude; int locationType; String longitude; diff --git a/lib/core/model/prescriptions/prescription_info_rc_model.dart b/lib/core/model/prescriptions/prescription_info_rc_model.dart new file mode 100644 index 00000000..23c4ad55 --- /dev/null +++ b/lib/core/model/prescriptions/prescription_info_rc_model.dart @@ -0,0 +1,52 @@ +class PrescriptionInfoRCModel { + String itemDescription; + String image; + String sKU; + dynamic productId; + dynamic productName; + int quantity; + int orderId; + int totalPrice; + int dispenseQuantity; + dynamic itemhand; + + PrescriptionInfoRCModel( + {this.itemDescription, + this.image, + this.sKU, + this.productId, + this.productName, + this.quantity, + this.orderId, + this.totalPrice, + this.dispenseQuantity, + this.itemhand}); + + PrescriptionInfoRCModel.fromJson(Map json) { + itemDescription = json['ItemDescription']; + image = json['image']; + sKU = json['SKU']; + productId = json['ProductId']; + productName = json['ProductName']; + quantity = json['Quantity']; + orderId = json['OrderId']; + totalPrice = json['TotalPrice']; + dispenseQuantity = json['DispenseQuantity']; + itemhand = json['itemhand']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemDescription'] = this.itemDescription; + data['image'] = this.image; + data['SKU'] = this.sKU; + data['ProductId'] = this.productId; + data['ProductName'] = this.productName; + data['Quantity'] = this.quantity; + data['OrderId'] = this.orderId; + data['TotalPrice'] = this.totalPrice; + data['DispenseQuantity'] = this.dispenseQuantity; + data['itemhand'] = this.itemhand; + return data; + } +} diff --git a/lib/core/model/prescriptions/prescription_report.dart b/lib/core/model/prescriptions/prescription_report.dart index 5545b25b..c521bede 100644 --- a/lib/core/model/prescriptions/prescription_report.dart +++ b/lib/core/model/prescriptions/prescription_report.dart @@ -1,4 +1,4 @@ -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + class PrescriptionReport { String address; diff --git a/lib/core/model/prescriptions/prescriptions_order.dart b/lib/core/model/prescriptions/prescriptions_order.dart index d3390d92..fe4239ba 100644 --- a/lib/core/model/prescriptions/prescriptions_order.dart +++ b/lib/core/model/prescriptions/prescriptions_order.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -46,7 +45,7 @@ class PrescriptionsOrder { return '$status'; } - String getFormattedDateTime()=> DateUtil.getDateFormatted(pickupDateTime); + String getFormattedDateTime()=> DateUtil.getWeekDayMonthDayYearDateFormatted(createdOn, isAppArabic ? 'ar' : 'en'); PrescriptionsOrder( {this.iD, diff --git a/lib/core/model/prescriptions/request_get_list_pharmacy_for_prescriptions.dart b/lib/core/model/prescriptions/request_get_list_pharmacy_for_prescriptions.dart index 739bb838..4b099f5b 100644 --- a/lib/core/model/prescriptions/request_get_list_pharmacy_for_prescriptions.dart +++ b/lib/core/model/prescriptions/request_get_list_pharmacy_for_prescriptions.dart @@ -1,6 +1,6 @@ class RequestGetListPharmacyForPrescriptions { - int latitude; - int longitude; + dynamic latitude; + dynamic longitude; double versionID; int channel; int languageID; diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 9e99f3ad..c6c2d82f 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,12 +1,12 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_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'; @@ -15,7 +15,7 @@ import '../base_service.dart'; class CMCService extends BaseService { List cmcAllServicesList = List(); - List cmcAllPresOrdersList = List(); + List cmcAllPresOrdersList = List(); List cmcAllOrderDetail = List(); List checkupItemsList = List(); @@ -23,95 +23,136 @@ class CMCService extends BaseService { bool isOrderUpdated; Future getCMCAllServices() async { - - - GetCMCServicesRequestModel getCMCServicesRequestModel= new GetCMCServicesRequestModel(genderID: user.gender, identificationNo: user.patientIdentificationNo); + GetCMCServicesRequestModel getCMCServicesRequestModel = + new GetCMCServicesRequestModel(genderID: authenticatedUserObject.user.gender, identificationNo: authenticatedUserObject.user.patientIdentificationNo); hasError = false; - await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, - onSuccess: (dynamic response, int statusCode) { + + // RC IMPLEMENTATION + await baseAppClient.post(GET_ALL_CMC_SERVICES_RC + "?patientID=" + user.patientID.toString(), isRCService: true, isAllowAny: true, onSuccess: (dynamic response, int statusCode) { cmcAllServicesList.clear(); - response['PatientER_CMC_GetAllServicesList'].forEach((data) { + response['response'].forEach((data) { cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getCMCServicesRequestModel.toJson()); + }, body: {}); + + // await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, onSuccess: (dynamic response, int statusCode) { + // cmcAllServicesList.clear(); + // response['PatientER_CMC_GetAllServicesList'].forEach((data) { + // cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); + // }); + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: getCMCServicesRequestModel.toJson()); } - - Future getCmcAllPresOrders() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); + hasError = false; + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { + cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); + response['response'].forEach((data) { + if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); + } - GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel= GetHHCAllPresOrdersRequestModel(); + Future getCmcAllPresOrdersRC() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, - onSuccess: (dynamic response, int statusCode) { - cmcAllPresOrdersList.clear(); - cmcAllOrderDetail.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) - cmcAllPresOrdersList - .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + await baseAppClient.post(GET_ALL_CMC_ORDERS_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { + cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); + + response['response'].forEach((data) { + cmcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getHHCAllPresOrdersRequestModel.toJson()); + + // response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + // if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + // }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); } Future getOrderDetailByOrderID(GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel) async { - hasError = false; - await baseAppClient.post(GET_CMC_ORDER_DETAIL_BY_ID, - onSuccess: (dynamic response, int statusCode) { - cmcAllOrderDetail.clear(); - response['PatientER_CMC_GetTransactionsForOrderList'].forEach((data) { - cmcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getOrderDetailByOrderIDRequestModel.toJson()); + await baseAppClient.post(GET_CMC_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { + cmcAllOrderDetail.clear(); + response['PatientER_CMC_GetTransactionsForOrderList'].forEach((data) { + cmcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getOrderDetailByOrderIDRequestModel.toJson()); } - Future getCheckupItems(CMCGetItemsRequestModel cMCGetItemsRequestModel) async { - hasError = false; - await baseAppClient.post(GET_CHECK_UP_ITEMS, - onSuccess: (dynamic response, int statusCode) { - checkupItemsList.clear(); - response['GetCheckUpItemsList'].forEach((data) { - checkupItemsList.add(CMCGetItemsResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: cMCGetItemsRequestModel.toJson()); + await baseAppClient.post(GET_CHECK_UP_ITEMS, onSuccess: (dynamic response, int statusCode) { + checkupItemsList.clear(); + response['GetCheckUpItemsList'].forEach((data) { + checkupItemsList.add(CMCGetItemsResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: cMCGetItemsRequestModel.toJson()); } Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + hasError = false; + await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); + } + Future updateCmcPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - isOrderUpdated = true; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: updatePresOrderRequestModel.toJson()); + await baseAppClient.post(UPDATE_CMC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); } - Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { + Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { + hasError = false; + String reqId = ""; + await baseAppClient.post(ADD_CMC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + reqId = response['response'].toString(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + return reqId; + } + Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - isOrderUpdated = true; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: order.toJson()); + String reqId = ""; + await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + reqId = response['RequestNo'].toString(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + return reqId; } } diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index ea5d03ca..bd2e94e4 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -1,82 +1,68 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:intl/intl.dart'; -import '../../../locator.dart'; import '../base_service.dart'; class CustomerAddressesService extends BaseService { - List addressesList = List(); - CustomerInfo customerInfo; - - - Future addAddressInfo({ AddNewAddressRequestModel - addNewAddressRequestModel }) async { + CustomerInfo customerInfo = new CustomerInfo(); + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { addNewAddressRequestModel.customer.email = customerInfo.email; addNewAddressRequestModel.customer.id = customerInfo.customerId; addNewAddressRequestModel.customer.roleIds = [3]; addNewAddressRequestModel.customer.addresses[0].email = customerInfo.email; addNewAddressRequestModel.customer.addresses[0].phoneNumber = customerInfo.mobileNumber; - addNewAddressRequestModel.customer.addresses[0].firstName = user.firstName; - addNewAddressRequestModel.customer.addresses[0].lastName = user.lastName; + addNewAddressRequestModel.customer.addresses[0].firstName = authenticatedUserObject.user.firstName; + addNewAddressRequestModel.customer.addresses[0].lastName = authenticatedUserObject.user.lastName; addNewAddressRequestModel.customer.addresses[0].countryId = 69; var f = DateFormat('E, d MMM yyyy HH:mm:ss'); var date = f.format(DateTime.now().toUtc()) + " GMT"; addNewAddressRequestModel.customer.addresses[0].createdOnUtc = date; hasError = false; - await baseAppClient.post(ADD_CUSTOMER_ADDRESS, - onSuccess: (dynamic response, int statusCode) { - addressesList.clear(); - response["customers"][0]["addresses"].forEach((data) { - addressesList - .add(AddressInfo.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: addNewAddressRequestModel.toJson(), isAllowAny: true); + await baseAppClient.postPharmacy(ADD_ADDRESS_INFO, onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList.add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addNewAddressRequestModel.toJson(), isAllowAny: true); } Future getCustomerAddresses() async { - Map queryParams = { - 'fields':'addresses' - }; + Map queryParams = {'fields': 'addresses'}; hasError = false; - await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", - onSuccess: (dynamic response, int statusCode) { - addressesList.clear(); - response["customers"][0]["addresses"].forEach((data) { - addressesList - .add(AddressInfo.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, queryParams: queryParams, isExternal: true); + var customerID = await sharedPref.getObject(PHARMACY_CUSTOMER_ID); + await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID", onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList.add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); } - Future getCustomerInfo() async { - Map queryParams = { - 'FileNumber':'${user.patientID}' - }; + Map queryParams = {'FileNumber': '${authenticatedUserObject.user.patientID}'}; hasError = false; - await baseAppClient.getPharmacy(BASE_PHARMACY_URL+GET_CUSTOMER_INFO, - onSuccess: (dynamic response, int statusCode) { - customerInfo= CustomerInfo.fromJson(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, queryParams: queryParams, isExternal: true); + await baseAppClient.getPharmacy(BASE_PHARMACY_URL + GET_CUSTOMER_INFO, onSuccess: (dynamic response, int statusCode) { + customerInfo = CustomerInfo.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); } } - class CustomerInfo { bool isRegistered; String userName; @@ -86,14 +72,7 @@ class CustomerInfo { String mobileNumber; int customerId; - CustomerInfo( - {this.isRegistered, - this.userName, - this.password, - this.email, - this.errorMessage, - this.mobileNumber, - this.customerId}); + CustomerInfo({this.isRegistered, this.userName, this.password, this.email, this.errorMessage, this.mobileNumber, this.customerId}); CustomerInfo.fromJson(Map json) { isRegistered = json['IsRegistered']; @@ -118,7 +97,6 @@ class CustomerInfo { } } - class AddressInfo { String id; String firstName; @@ -141,23 +119,23 @@ class AddressInfo { AddressInfo( {this.id, - this.firstName, - this.lastName, - this.email, - this.company, - this.countryId, - this.country, - this.stateProvinceId, - this.city, - this.address1, - this.address2, - this.zipPostalCode, - this.phoneNumber, - this.faxNumber, - this.customerAttributes, - this.createdOnUtc, - this.province, - this.latLong}); + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong}); AddressInfo.fromJson(Map json) { id = json['id']; diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index 6c356f5c..f3791f4b 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -7,20 +7,27 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:flutter/material.dart'; class EReferralService extends BaseService { List _relationTypes = List(); + List get relationTypes => _relationTypes; List _allCities = List(); + List get allCities => _allCities; List _allReferral = List(); + List get allReferral => _allReferral; String _activationCode; String _logInTokenID; + String _referralNumber; String get activationCode => _activationCode; + String get referralNumber => _referralNumber; + bool _isActivationCodeValid = false; bool get isActivationCodeValid => _isActivationCodeValid; @@ -39,22 +46,34 @@ class EReferralService extends BaseService { }, body: {}); } + Future getProjectsList(context) async { + Map request; + request = {}; + + dynamic localRes; + + await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getAllCities() async { await baseAppClient.post(GET_ALL_CITIES, onSuccess: (dynamic response, int statusCode) { - _allCities.clear(); - response['ListCities'].forEach((city) { - _allCities - .add(GetAllCitiesResponseModel.fromJson(city)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {}); + _allCities.clear(); + response['ListCities'].forEach((city) { + _allCities.add(GetAllCitiesResponseModel.fromJson(city)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); } Future sendActivationCodeForEReferral( - SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { hasError = false; @@ -62,24 +81,21 @@ class EReferralService extends BaseService { onSuccess: (dynamic response, int statusCode) { _activationCode = response["VerificationCode"]; _logInTokenID = response["LogInTokenID"]; - }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: sendActivationCodeForEReferralRequestModel.toJson()); } - - Future checkActivationCodeForEReferral( CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { checkActivationCodeForEReferralRequestModel.isDentalAllowedBackend = false; - checkActivationCodeForEReferralRequestModel.logInTokenID= _logInTokenID; - hasError =false; + checkActivationCodeForEReferralRequestModel.logInTokenID = _logInTokenID; + hasError = false; await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL, onSuccess: (dynamic response, int statusCode) { - _isActivationCodeValid = true; + _isActivationCodeValid = true; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -87,39 +103,35 @@ class EReferralService extends BaseService { } Future createEReferral( - CreateEReferralRequestModel createEReferralRequestModel - ) async { - hasError = false; - await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/, + CreateEReferralRequestModel createEReferralRequestModel) async { + hasError = false; + await baseAppClient.post( + CREATE_E_REFERRAL /*'Services/Patients.svc/REST/CreateEReferral'*/, onSuccess: (dynamic response, int statusCode) { - // TODO Waiting for fix service - var asd= ("EEEEEE"); - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: createEReferralRequestModel.toJson()); + // TODO Waiting for fix service + _referralNumber = response['ReferralNumber'].toString(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: createEReferralRequestModel.toJson()); } Future getEReferrals( - SearchEReferralRequestModel searchEReferralRequestModel - ) async { + SearchEReferralRequestModel searchEReferralRequestModel) async { + _allReferral.clear(); hasError = false; + // TODO return this code when the fix the server - // await baseAppClient.post(GET_E_REFERRALS, - // onSuccess: (dynamic response, int statusCode) { - // print("EEEEEE"); - // // TODO Waiting for fix service - // // ToDo change this one when you have data - // _allReferral.clear(); - // // response['ListCities'].forEach((city) { - // // _allReferral - // // .add(SearchEReferralResponseModel.fromJson(city)); - // // }); - // - // }, onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: searchEReferralRequestModel.toJson()); + await baseAppClient.post(GET_E_REFERRALS, + onSuccess: (dynamic response, int statusCode) { + _allReferral.clear(); + response['List_EReferrals'].forEach((referral) { + _allReferral + .add(SearchEReferralResponseModel.fromJson(referral)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: searchEReferralRequestModel.toJson()); } } diff --git a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart index 4b38ef65..139c251b 100644 --- a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart +++ b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart @@ -3,9 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_by_time_model.dart'; -import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_by_time_request_model.dart'; import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_model.dart'; -import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_request_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:flutter/cupertino.dart'; @@ -15,6 +13,9 @@ class BariatricsService extends BaseService { List doctorList = []; List doctorListByTime = []; + double lat; + double long; + Future getClinicCategory() async { hasError = false; Map body = Map(); @@ -69,8 +70,7 @@ class BariatricsService extends BaseService { body['Longitude'] = 0; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(SEARCH_DOCTOR_BY_TIME, onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEARCH_DOCTOR_BY_TIME, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -92,8 +92,7 @@ class BariatricsService extends BaseService { body['PatientID'] = 0; body['isDentalAllowedBackend'] = false; - if(disease != null) - body['DiseaseID'] = disease.diseasesID; + if (disease != null) body['DiseaseID'] = disease.diseasesID; await baseAppClient.post(GET_DOCTOR_LIST_BY_TIME, onSuccess: (dynamic response, int statusCode) { doctorListByTime.clear(); @@ -106,4 +105,31 @@ class BariatricsService extends BaseService { super.error = error; }, body: body); } + + Future getCalculationDoctors({@required int calculationID}) async { + + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + + hasError = false; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + + Map body = Map(); + body['CalculationID'] = calculationID; // hint: it is static depend on IONIC project + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['Latitude'] = lat != null ? lat.toString() : 0; + body['Longitude'] = long != null ? long.toString() : 0; + + dynamic localRes; + + await baseAppClient.post(GET_DOCTOR_LIST_CALCULATION, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } } diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index 2ec1e310..99220b07 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -1,32 +1,31 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_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/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import '../base_service.dart'; class HomeHealthCareService extends BaseService { List hhcAllServicesList = List(); - List hhcAllPresOrdersList = List(); + List hhcAllPresOrdersList = List(); List hhcAllOrderDetail = List(); List addressesList = List(); - + dynamic hhcResponse; bool isOrderUpdated; CustomerInfo customerInfo; - Future getHHCAllServices( - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { + int requestNo; + + Future getHHCAllServices(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; - await baseAppClient.post(HHC_GET_ALL_SERVICES, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(HHC_GET_ALL_SERVICES, onSuccess: (dynamic response, int statusCode) { hhcAllServicesList.clear(); response['PatientER_HHC_GetAllServicesList'].forEach((data) { hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); @@ -37,17 +36,27 @@ class HomeHealthCareService extends BaseService { }, body: hHCGetAllServicesRequestModel.toJson()); } - Future getHHCAllPresOrders() async { - GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = - GetHHCAllPresOrdersRequestModel(); + Future getHHCAllServicesRC(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { + hasError = false; + await baseAppClient.post(HHC_GET_ALL_SERVICES_RC + "?PatientID=" + user.patientID.toString(), isRCService: true, onSuccess: (dynamic response, int statusCode) { + hhcAllServicesList.clear(); + response['response'].forEach((data) { + hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: hHCGetAllServicesRequestModel.toJson()); + } + + Future getHHCAllPresOrdersRC() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_HHC_ORDERS_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) - hhcAllPresOrdersList - .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + hhcAllOrderDetail.clear(); + response['response'].forEach((data) { + hhcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -55,17 +64,29 @@ class HomeHealthCareService extends BaseService { }, body: getHHCAllPresOrdersRequestModel.toJson()); } + Future getHHCAllPresOrders() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); + hasError = false; + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, onSuccess: (dynamic response, int statusCode) { + hhcAllPresOrdersList.clear(); + // response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + // if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + // }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); + } + Future getOrderDetailByOrderID(int presOrderID) async { hasError = false; Map body = Map(); body['PresOrderID'] = presOrderID; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { hhcAllOrderDetail.clear(); response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { - hhcAllOrderDetail - .add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + hhcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -75,8 +96,17 @@ class HomeHealthCareService extends BaseService { Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); + } + + Future updateHHCPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + hasError = false; + await baseAppClient.post(UPDATE_HHC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { hasError = true; @@ -86,14 +116,23 @@ class HomeHealthCareService extends BaseService { Future insertPresPresOrder({PatientERInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + hhcResponse = response; + requestNo = response['RequestNo']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + } + Future insertHHCOrderRC({PatientERInsertPresOrderRequestModel order}) async { + hasError = false; + await baseAppClient.post(ADD_HHC_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { + hhcResponse = response; + requestNo = response["response"]; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: order.toJson()); } } - - diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index c36efe89..1d849755 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -2,13 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class PrescriptionDeliveryService extends BaseService { - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { hasError = false; Map body = Map(); body['LineItemNo'] = lineItemNo; @@ -17,11 +11,26 @@ class PrescriptionDeliveryService extends BaseService { body['AppointmentNo'] = appointmentNo; body['CreatedBy'] = createdBy; body['DischargeID'] = dischargeID; - await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - var asd=""; - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + print(error); + super.error = error; + }, body: body); + } + + Future insertDeliveryOrderRC({double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { + hasError = false; + Map body = Map(); + body['latitude'] = latitude; + body['longitude'] = longitude; + body['AppointmentNo'] = appointmentNo.toString(); + // body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID.toString(); + await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { hasError = true; print(error); super.error = error; diff --git a/lib/core/service/ancillary_orders_service.dart b/lib/core/service/ancillary_orders_service.dart index 27ff2694..4bfbad53 100644 --- a/lib/core/service/ancillary_orders_service.dart +++ b/lib/core/service/ancillary_orders_service.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_list_model.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_proc_model.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class AncillaryOrdersService extends BaseService { List _ancillaryLists = List(); diff --git a/lib/core/service/appointment_rate_service.dart b/lib/core/service/appointment_rate_service.dart index a0c2b208..16355e9a 100644 --- a/lib/core/service/appointment_rate_service.dart +++ b/lib/core/service/appointment_rate_service.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/model/rate/appointment_rate.dart'; import 'package:diplomaticquarterapp/core/model/rate/appoitment_rated.dart'; -import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class AppointmentRateService extends BaseService { @@ -10,8 +10,7 @@ class AppointmentRateService extends BaseService { Future getIsLastAppointmentRatedList() async { hasError = false; - await baseAppClient.post(IS_LAST_APPOITMENT_RATED, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(IS_LAST_APPOITMENT_RATED, onSuccess: (dynamic response, int statusCode) { appointmentRatedList.clear(); response['IsLastAppoitmentRatedList'].forEach((appoint) { appointmentRatedList.add(AppoitmentRated.fromJson(appoint)); @@ -27,19 +26,15 @@ class AppointmentRateService extends BaseService { Map bodyData = Map(); bodyData['AppointmentNumber'] = appointmentRatedList[0].appointmentNo; bodyData['ProjectID'] = appointmentRatedList[0].projectID; - await baseAppClient.post(GET_APPOINTMENT_DETAILS_BY_NO, - onSuccess: (dynamic response, int statusCode) { - if (response['AppointmentDetails'] != null) - appointmentDetails = - AppointmentDetails.fromJson(response['AppointmentDetails']); + await baseAppClient.post(GET_APPOINTMENT_DETAILS_BY_NO, onSuccess: (dynamic response, int statusCode) { + if (response['AppointmentDetails'] != null) appointmentDetails = AppointmentDetails.fromJson(response['AppointmentDetails']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: bodyData); } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, - int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { hasError = false; AppointmentRate appointmentRate = AppointmentRate(); appointmentRate.rate = rate; @@ -48,18 +43,45 @@ class AppointmentRateService extends BaseService { appointmentRate.doctorID = doctorID; appointmentRate.clinicID = clinicID; appointmentRate.note = note; + appointmentRate.createdBy = 2; + appointmentRate.editedBy = 2; - await baseAppClient.post(GET_APPOINTMENT_DETAILS_BY_NO, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(NEW_RATE_APPOINTMENT_URL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: appointmentRate.toJson()); } + Future sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName) async { + Map request; + hasError = false; + request = { + "DoctorID": doctorID, + "Rate": rate, + "ClinicID": clinicID, + "ProjectID": projectID, + "AppointmentNo": appointmentNo, + "Note": note, + "MobileNumber": authenticatedUserObject.user.mobileNumber, + "AppointmentDate": appoDate, + "DoctorName": docName, + "ProjectName": projectName, + "COCTypeName": 1, + "PatientName": authenticatedUserObject.user.firstName + " " + authenticatedUserObject.user.lastName, + "PatientOutSA": authenticatedUserObject.user.outSA, + "PatientTypeID": authenticatedUserObject.user.patientType, + "ClinicName": clinicName, + "PatientIdentificationID": authenticatedUserObject.user.patientIdentificationNo + }; + + await baseAppClient.post(NEW_RATE_DOCTOR_URL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + AppoitmentRated get lastAppointmentRated { - if (appointmentRatedList.length > 0) - return appointmentRatedList[appointmentRatedList.length - 1]; + if (appointmentRatedList.length > 0) return appointmentRatedList[appointmentRatedList.length - 1]; return null; } diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index fdb80604..34b7e1f6 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -10,7 +10,7 @@ class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); - AuthenticatedUser user; + AuthenticatedUser user = new AuthenticatedUser(); AuthenticatedUserObject authenticatedUserObject = locator(); @@ -23,9 +23,9 @@ class BaseService { } getUser() async { - if (user==null) { + // if (user==null) { var userData = await sharedPref.getObject(USER_PROFILE); if (userData != null) user = AuthenticatedUser.fromJson(userData); - } + // } } } diff --git a/lib/core/service/blood/blood_details_servies.dart b/lib/core/service/blood/blood_details_servies.dart index 644d96d9..589b8dda 100644 --- a/lib/core/service/blood/blood_details_servies.dart +++ b/lib/core/service/blood/blood_details_servies.dart @@ -22,7 +22,7 @@ class BloodDetailsService extends BaseService{ BloodModelList.add(List_BloodGroupDetailsModel.fromJson(vital)); }); }, onFailure: (String error, int statusCode) { - hasError = true; + // hasError = true; super.error = error; }, body: body); } diff --git a/lib/core/service/blood/blood_donation_service.dart b/lib/core/service/blood/blood_donation_service.dart index 9fc11c04..a59a2169 100644 --- a/lib/core/service/blood/blood_donation_service.dart +++ b/lib/core/service/blood/blood_donation_service.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import '../base_service.dart'; @@ -11,13 +10,13 @@ class BloodDonationService extends BaseService { List CitiesModelList = List(); Map body = Map(); + Future getAllCitiesOrders() async { hasError = false; body['ListCities'] = false; - await baseAppClient.post(GET_CITIES_REQUEST, - onSuccess: (dynamic response, int statusCode) { + body["IsPublicRequest"] = true; + await baseAppClient.post(GET_CITIES_REQUEST, onSuccess: (dynamic response, int statusCode) { CitiesModelList.clear(); - response['ListCities'].forEach((vital) { CitiesModelList.add(CitiesModel.fromJson(vital)); }); @@ -26,16 +25,16 @@ class BloodDonationService extends BaseService { super.error = error; }, body: body); } + Future bloodDonationSave(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_REQUEST, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_REQUEST, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; @@ -45,30 +44,27 @@ class BloodDonationService extends BaseService { Future getAgreement() async { var localRes; try { - await baseAppClient.post(GET_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: {}); + await baseAppClient.post(GET_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: {}); return Future.value(localRes); } catch (error) { throw error; } } - Future saveAgreement(request) async { var localRes; try { - await baseAppClient.post(SAVE_BLOOD_AGREEMENT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - localRes = error; - return Future.value(error); - }, body: request); + await baseAppClient.post(SAVE_BLOOD_AGREEMENT, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + }, body: request); return Future.value(localRes); } catch (error) { throw error; diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart index 5e4a4d86..95757331 100644 --- a/lib/core/service/childvaccines/add_new_child_service.dart +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; + import '../base_service.dart'; class CreteNewBabyService extends BaseService { diff --git a/lib/core/service/childvaccines/child_vaccines_service.dart b/lib/core/service/childvaccines/child_vaccines_service.dart index 09256f47..03da5ed8 100644 --- a/lib/core/service/childvaccines/child_vaccines_service.dart +++ b/lib/core/service/childvaccines/child_vaccines_service.dart @@ -1,9 +1,9 @@ -import 'dart:convert'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; + import '../base_service.dart'; class ChildVaccinesService extends BaseService { diff --git a/lib/core/service/childvaccines/delete_baby_service.dart b/lib/core/service/childvaccines/delete_baby_service.dart index 115d13c5..6fb77a1a 100644 --- a/lib/core/service/childvaccines/delete_baby_service.dart +++ b/lib/core/service/childvaccines/delete_baby_service.dart @@ -1,9 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; + import '../base_service.dart'; diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart index 0628920c..125ebf73 100644 --- a/lib/core/service/childvaccines/user_information_service.dart +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; + import '../base_service.dart'; class UserInformationService extends BaseService { diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart index fc2b40e9..22c0d561 100644 --- a/lib/core/service/childvaccines/vaccination_table_service.dart +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -1,9 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + import '../base_service.dart'; class VaccinationTableService extends BaseService { diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index cf204e6a..1f6ca580 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -1,13 +1,15 @@ +import 'dart:async'; import 'dart:convert'; +import 'dart:io' show Platform; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; +import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -19,7 +21,6 @@ import 'package:provider/provider.dart'; import '../../../locator.dart'; import '../../../routes.dart'; import '../AuthenticatedUserObject.dart'; -import 'dart:io' show Platform; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -29,8 +30,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = - locator(); +AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); class BaseAppClient { @@ -39,25 +39,25 @@ class BaseAppClient { Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, bool isAllowAny = false, - bool isExternal = false}) async { + bool isExternal = false, + bool isRCService = false}) async { String url; if (isExternal) { url = endPoint; } else { - url = BASE_URL + endPoint; + if (isRCService) + url = RC_BASE_URL + endPoint; + else + url = BASE_URL + endPoint; } try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); var pharmacyToken = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); - Map headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }; + Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; if (!isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null @@ -74,12 +74,11 @@ class BaseAppClient { body['generalid'] = GENERAL_ID; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -101,26 +100,21 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; if (user != null) { - body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : user['PatientID']; + body['TokenID'] = body['TokenID'] != null ? body['TokenID'] : token; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] != null ? body['PatientOutSA'] : PATIENT_OUT_SA : PATIENT_OUT_SA; - body['SessionID'] = SESSION_ID; //getSe + body['SessionID'] = getSessionId(body['TokenID']); //getSe headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': pharmacyToken, - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero( - user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user['PatientID'].toString(), }; @@ -128,84 +122,85 @@ class BaseAppClient { } } + // body['IdentificationNo'] = 1009199553; + // body['MobileNo'] = "966545156035"; + // body['PatientID'] = 1018977; //3844083 + // body['TokenID'] = "@dm!n"; + + body.removeWhere((key, value) => key == null || value == null); + print("URL : $url"); final jsonBody = json.encode(body); print(jsonBody); if (await Utils.checkConnection()) { - final response = await http.post(url.trim(), - body: json.encode(body), headers: headers); + final response = await http.post(url.trim(), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { - // var parsed = json.decode(response.body.toString()); + var decoded = utf8.decode(response.bodyBytes); var parsed = json.decode(utf8.decode(response.bodyBytes)); - if (parsed['Response_Message'] != null) { + + if (isAllowAny) { onSuccess(parsed, statusCode); } else { - if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); - } - if (isAllowAny) { + if (parsed['Response_Message'] != null) { onSuccess(parsed, statusCode); - } else if (parsed['IsAuthenticated'] == null) { - if (parsed['isSMSSent'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 1) { - onSuccess(parsed, statusCode); - } else if (parsed['Result'] == 'OK') { + } else { + if (parsed['ErrorType'] == 4) { + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); + } + if (parsed['ErrorType'] == 2) { + await logout(); + } + if (isAllowAny) { onSuccess(parsed, statusCode); - } else { - if (parsed != null) { + } else if (parsed['IsAuthenticated'] == null) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else if (parsed['Result'] == 'OK') { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logout(); + // if (parsed != null) { + // onSuccess(parsed, statusCode); + // } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + // logout(); + // } } - } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { - if (parsed['SameClinicApptList'] != null) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { - if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { + if (parsed['ErrorSearchMsg'] == null) { + onFailure("Server Error found with no available message", statusCode); + } else { + onFailure(parsed['ErrorSearchMsg'], statusCode); + } } else { - onFailure(parsed['ErrorSearchMsg'], statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } - } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); } } - } else if (!parsed['IsAuthenticated']) { - await logout(); - - //helpers.showErrorToast('Your session expired Please login agian'); - } else { - if (parsed['SameClinicApptList'] != null) { - onSuccess(parsed, statusCode); - } else { - if (parsed['message'] != null) { - onFailure(parsed['message'] ?? parsed['message'], statusCode); + // else if (!parsed['IsAuthenticated']) { + // await logout(); + // } + else { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + } } } } @@ -221,11 +216,7 @@ class BaseAppClient { } postPharmacy(String endPoint, - {Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - bool isAllowAny = false, - bool isExternal = false}) async { + {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, bool isAllowAny = false, bool isExternal = false}) async { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); String url; @@ -242,16 +233,13 @@ class BaseAppClient { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': token ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", }; if (!isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null @@ -273,12 +261,11 @@ class BaseAppClient { : PATIENT_OUT_SA; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -301,9 +288,7 @@ class BaseAppClient { : PATIENT_TYPE_ID; if (user != null) { body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : user['PatientID']; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['SessionID'] = SESSION_ID; //getSe headers = { @@ -322,8 +307,7 @@ class BaseAppClient { print("Body : ${json.encode(body)}"); if (await Utils.checkConnection()) { - final response = await http.post(url.trim(), - body: json.encode(body), headers: headers); + final response = await http.post(url.trim(), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -335,8 +319,7 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); } if (isAllowAny) { onSuccess(parsed, statusCode); @@ -351,34 +334,24 @@ class BaseAppClient { if (parsed != null) { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); logout(); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + onFailure("Server Error found with no available message", statusCode); } else { onFailure(parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } else if (!parsed['IsAuthenticated']) { @@ -392,9 +365,7 @@ class BaseAppClient { if (parsed['message'] != null) { onFailure(parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -410,20 +381,23 @@ class BaseAppClient { } Future navigateToAppUpdate(context, String text) async { - Navigator.pushReplacement( - context, FadePage(page: AppUpdatePage(appUpdateText: text))); + Navigator.pushReplacement(context, FadePage(page: AppUpdatePage(appUpdateText: text))); } get(String endPoint, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, - bool isExternal = false}) async { + bool isExternal = false, + bool isRCService = false}) async { String url; if (isExternal) { url = endPoint; } else { - url = BASE_URL + endPoint; + if (isRCService) + url = RC_BASE_URL + endPoint; + else + url = BASE_URL + endPoint; } if (queryParams != null) { String queryString = Uri(queryParameters: queryParams).query; @@ -435,10 +409,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { final response = await http.get( url.trim(), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); @@ -476,15 +447,14 @@ class BaseAppClient { } print("URL : $url"); + var ss = json.encode(queryParams); if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { 'Content-Type': 'text/html; charset=utf-8', 'Accept': 'application/json', 'Authorization': token ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", 'Host': "mdlaboratories.com", @@ -511,7 +481,8 @@ class BaseAppClient { simplePost( String fullUrl, { - Map body, + Map body, + Map headers, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, }) async { @@ -519,17 +490,15 @@ class BaseAppClient { print("URL Query String: $url"); if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.post( url.trim(), body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: headers, ); - final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -542,11 +511,8 @@ class BaseAppClient { } simpleGet(String fullUrl, - {Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - Map queryParams}) async { + {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, Map headers}) async { String url = fullUrl; - print("URL Query String: $url"); var haveParams = (queryParams != null); if (haveParams) { @@ -556,16 +522,15 @@ class BaseAppClient { } if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.get( url.trim(), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleGet(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, queryParams: queryParams); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -577,25 +542,21 @@ class BaseAppClient { } } - simplePut(String fullUrl, - {Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure}) async { + simplePut(String fullUrl, {Map body, Map headers, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure}) async { String url = fullUrl; print("URL Query String: $url"); if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.put( url.trim(), body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePut(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, body: body); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -608,9 +569,7 @@ class BaseAppClient { } simpleDelete(String fullUrl, - {Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - Map queryParams}) async { + {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, Map headers}) async { String url = fullUrl; print("URL Query String: $url"); @@ -622,16 +581,15 @@ class BaseAppClient { } if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.delete( url.trim(), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleDelete(fullUrl, onFailure: onFailure, onSuccess: onSuccess, queryParams: queryParams, headers: headers); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -643,17 +601,24 @@ class BaseAppClient { } } + Future handleUnauthorized(int statusCode, {String forUrl}) async { + if (forUrl.startsWith(EXA_CART_API_BASE_URL) && statusCode == 401) { + final token = await generatePackagesToken(); + packagesAuthHeader['Authorization'] = 'Bearer $token'; + return token != null && (token is String); + } + return false; + } + 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); + Provider.of(AppGlobal.context, listen: false).isLogin = false; + var model = Provider.of(AppGlobal.context, listen: false); _vitalSignService.weightKg = ""; _vitalSignService.heightCm = ""; - model.setState(0, false); + model.setState(0, false, null); Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } @@ -664,8 +629,7 @@ class BaseAppClient { static defaultHttpParameters() async { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); var params = {}; if (user != null) { @@ -685,11 +649,7 @@ class BaseAppClient { } pharmacyPost(String endPoint, - {Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - bool isAllowAny = false, - bool isExternal = false}) async { + {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, bool isAllowAny = false, bool isExternal = false}) async { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); String url; @@ -701,8 +661,7 @@ class BaseAppClient { try { if (isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') @@ -725,12 +684,11 @@ class BaseAppClient { : PATIENT_OUT_SA; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -746,6 +704,7 @@ class BaseAppClient { body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null + ? body['PatientTypeID'] : user['PatientType'] != null ? user['PatientType'] @@ -753,9 +712,7 @@ class BaseAppClient { : PATIENT_TYPE_ID; if (user != null) { body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : user['PatientID']; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['SessionID'] = SESSION_ID; //getSessionId(token); } @@ -767,17 +724,14 @@ class BaseAppClient { var ss = json.encode(body); if (await Utils.checkConnection()) { - final response = - await http.post(url.trim(), body: json.encode(body), headers: { + final response = await http.post(url.trim(), body: json.encode(body), headers: { // 'Content-Type': 'application/json', // 'Accept': 'application/json', // 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': token ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", }); @@ -785,7 +739,7 @@ class BaseAppClient { print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { var parsed = json.decode(utf8.decode(response.bodyBytes)); - onFailure(parsed['error']['ErrorEndUserMsg'] ??'Error While Fetching data', statusCode); + onFailure(parsed['error']['ErrorEndUserMsgN'] ?? 'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); @@ -793,8 +747,7 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); } if (isAllowAny) { onSuccess(parsed, statusCode); @@ -809,31 +762,21 @@ class BaseAppClient { if (parsed != null) { onSuccess(parsed, statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); logout(); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + onFailure("Server Error found with no available message", statusCode); } else { onFailure(parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } else if (!parsed['IsAuthenticated']) { await logout(); @@ -846,9 +789,7 @@ class BaseAppClient { if (parsed['message'] != null) { onFailure(parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -862,4 +803,24 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + + Future generatePackagesToken() async { + var url = EXA_CART_API_BASE_URL + PACKAGES_TOKEN; + var body = { + "api_client": {"client_id": "a4ab6be4-424f-4836-b032-46caed88e184", "client_secret": "3c1a3e07-4a40-4510-9fb0-ee5f0a72752c"} + }; + String token; + final completer = Completer(); + simplePost(url, body: body, headers: {}, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + token = jsonResponse['auth_token']; + completer.complete(); + } + }, onFailure: (String error, int statusCode) { + completer.complete(); + }); + await completer.future; + return token; + } } diff --git a/lib/core/service/contactus/finadus_service.dart b/lib/core/service/contactus/finadus_service.dart index 4086def9..8f629db7 100644 --- a/lib/core/service/contactus/finadus_service.dart +++ b/lib/core/service/contactus/finadus_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; + import '../base_service.dart'; class FindusService extends BaseService { @@ -14,6 +15,11 @@ class FindusService extends BaseService { Future getAllFindUsOrders() async { hasError = false; + var lat = await sharedPref.getDouble(USER_LAT); + var long = await sharedPref.getDouble(USER_LONG); + body['Latitude'] = lat ?? 0; + body['Longitude'] = long ?? 0; + await baseAppClient.post(GET_FINDUS_REQUEST, onSuccess: (dynamic response, int statusCode) { FindusModelList.clear(); diff --git a/lib/core/service/contactus/livechat_service.dart b/lib/core/service/contactus/livechat_service.dart index 025073ca..0029e1e9 100644 --- a/lib/core/service/contactus/livechat_service.dart +++ b/lib/core/service/contactus/livechat_service.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/model/contactus/get_patientI_cprojects.dart'; + import '../base_service.dart'; class LiveChatService extends BaseService { @@ -13,6 +13,9 @@ class LiveChatService extends BaseService { Future getAllLiveChatOrders() async { hasError = false; body['List_PatientICProjects'] = false; + body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); + body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); + await baseAppClient.post(GET_LIVECHAT_REQUEST, onSuccess: (dynamic response, int statusCode) { LivechatModelList.clear(); diff --git a/lib/core/service/dashboard_service.dart b/lib/core/service/dashboard_service.dart index a15a4b39..4db1fd6a 100644 --- a/lib/core/service/dashboard_service.dart +++ b/lib/core/service/dashboard_service.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/rate/appoitment_rated.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class DashboardService extends BaseService { diff --git a/lib/core/service/er/am_service.dart b/lib/core/service/er/am_service.dart index 9c66d373..a76ae73a 100644 --- a/lib/core/service/er/am_service.dart +++ b/lib/core/service/er/am_service.dart @@ -28,9 +28,9 @@ class AmService extends BaseService { Map body = Map(); body['isDentalAllowedBackend'] = false; body['IdentificationNo'] = user.patientIdentificationNo; - await baseAppClient.get(GET_ALL_TRANSPORTATIONS_RC + "?patientID=" + user.patientID.toString(), isExternal: false, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.get(GET_ALL_TRANSPORTATIONS_RC + "?patientID=" + user.patientID.toString(), isRCService: true, isExternal: false, onSuccess: (dynamic response, int statusCode) { amModelList.clear(); - response['data']['transportationservices'].forEach((item) { + response['response']['transportationservices'].forEach((item) { amModelList.add(PatientERTransportationMethod.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -69,18 +69,18 @@ class AmService extends BaseService { pickUpRequestPresOrder = null; Map body = Map(); - body['patientId'] = patientID.toString(); - body['PatientID'] = patientID.toString(); + body['patientId'] = patientID; + body['PatientID'] = patientID; - await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_TRANSPORTATIONS_ORDERS, isRCService: true, onSuccess: (dynamic response, int statusCode) { patientAmbulanceRequestOrdersList.clear(); hasPendingOrder = false; pendingOrderID = 0; pendingAmbulanceRequestOrder = null; - response['data'].forEach((item) { + response['response'].forEach((item) { patientAmbulanceRequestOrdersList.add(AmbulanceRequestOrdersModel.fromJson(item)); - if (item['statusId'] == 1) { + if (item['StatusId'] == 1) { hasPendingOrder = true; pendingOrderID = item['orderpayment']['id']; pendingOrderStatus = item['statusText']; @@ -127,14 +127,14 @@ class AmService extends BaseService { }, body: body); } - Future updatePressOrderRC({@required int presOrderID, @required String patientID}) async { + Future updatePressOrderRC({@required int presOrderID, @required int patientID}) async { hasError = false; Map body = Map(); body['Id'] = presOrderID; body['StatusId'] = 6; body['ClickButton'] = 14; body['PatientID'] = patientID; - await baseAppClient.post(CANCEL_AMBULANCE_REQUEST, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + await baseAppClient.post(CANCEL_AMBULANCE_REQUEST, isRCService: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -146,7 +146,7 @@ class AmService extends BaseService { var body = patientER.toJson(); print(body); - await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_TRANSPORTATION_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/core/service/er/er_service.dart b/lib/core/service/er/er_service.dart index 3e899f97..5b7552bb 100644 --- a/lib/core/service/er/er_service.dart +++ b/lib/core/service/er/er_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; + import '../base_service.dart'; class ErService extends BaseService { diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index bd5bfa42..67ebc641 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -1,12 +1,11 @@ import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; class FeedbackService extends BaseService { @@ -14,38 +13,32 @@ class FeedbackService extends BaseService { RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem(); List appointHistoryList = List(); - Future sendCOCItem( - {String title, - String details, - String cOCTypeName, - String attachment, - AppoitmentAllHistoryResultList appointHistory}) async { + Future sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async { hasError = false; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); _requestInsertCOCItem.attachment = attachment; _requestInsertCOCItem.title = title; _requestInsertCOCItem.details = details; _requestInsertCOCItem.cOCTypeName = cOCTypeName; _requestInsertCOCItem.formTypeID = cOCTypeName; - _requestInsertCOCItem.mobileNo = - "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); + _requestInsertCOCItem.mobileNo = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); _requestInsertCOCItem.isUserLoggedIn = true; _requestInsertCOCItem.projectID = user.projectID; _requestInsertCOCItem.patientName = user.firstName + " " + user.lastName; _requestInsertCOCItem.fileName = ""; _requestInsertCOCItem.appVersion = VERSION_ID; - _requestInsertCOCItem.uILanguage = - languageID; //TODO Change it to be dynamic + _requestInsertCOCItem.uILanguage = languageID; //TODO Change it to be dynamic _requestInsertCOCItem.browserInfo = Platform.localHostname; _requestInsertCOCItem.deviceInfo = Platform.localHostname; _requestInsertCOCItem.resolution = "400x847"; _requestInsertCOCItem.projectID = 0; - _requestInsertCOCItem.identificationNo = - int.parse(user.patientIdentificationNo); + _requestInsertCOCItem.tokenID = "C0c@@dm!n?T&A&A@Barcha202029582948"; + _requestInsertCOCItem.identificationNo = int.parse(user.patientIdentificationNo); if (BASE_URL.contains('uat')) { _requestInsertCOCItem.forDemo = true; + } else { + _requestInsertCOCItem.forDemo = false; } final Map body = _requestInsertCOCItem.toJson(); @@ -59,9 +52,7 @@ class FeedbackService extends BaseService { body['ProjectName'] = appointHistory.projectName; } - await baseAppClient - .post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -71,19 +62,54 @@ class FeedbackService extends BaseService { hasError = false; Map body = new Map(); body['IdentificationNo'] = user.patientIdentificationNo; - body['MobileNo'] = - "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); - body['Searching_type'] = '1'; + body['MobileNo'] = "966" + Utils.getPhoneNumberWithoutZero(user.mobileNumber); + body['Searching_type'] = 1; + + if (BASE_URL.contains('uat')) { + body['ForDemo'] = true; + } + await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) { + cOCItemList = []; + response['ListCOCItems'].forEach((cOC) { + cOCItemList.add(COCItem.fromJson(cOC)); + }); + cOCItemList = cOCItemList.reversed.toList(); // Sort list in desc order + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async { + hasError = false; + Map body = new Map(); + if (type == 1) { + body['IdentificationNo'] = 0; + body['PatientID'] = num.tryParse(idNumber); + body['ItemID'] = 0; + } else if (type == 2) { + body['IdentificationNo'] = idNumber; + body['PatientID'] = 0; + body['ItemID'] = 0; + } else { + body['IdentificationNo'] = 0; + body['PatientID'] = 0; + body['ItemID'] = idNumber; + } + + body['PatientOutSA'] = countryCode.contains("966") ? 0 : 1; + body['MobileNo'] = countryCode + Utils.getPhoneNumberWithoutZero(phoneNumber); + body['Searching_type'] = type; if (BASE_URL.contains('uat')) { body['ForDemo'] = true; } - await baseAppClient.post(GET_STATUS_FOR_COCO, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_STATUS_FOR_COCO, onSuccess: (dynamic response, int statusCode) { cOCItemList = []; response['ListCOCItems'].forEach((cOC) { cOCItemList.add(COCItem.fromJson(cOC)); }); + cOCItemList = cOCItemList.reversed.toList(); // Sort list in desc order }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -94,12 +120,10 @@ class FeedbackService extends BaseService { hasError = false; Map body = new Map(); body['IsComingFromCOC'] = true; - baseAppClient.post(GET_PATIENT_AppointmentHistory, - onSuccess: (dynamic response, int statusCode) { + baseAppClient.post(GET_PATIENT_AppointmentHistory, onSuccess: (dynamic response, int statusCode) { appointHistoryList = []; response['AppoimentAllHistoryResultList'].forEach((appoint) { - appointHistoryList - .add(AppoitmentAllHistoryResultList.fromJson(appoint)); + appointHistoryList.add(AppoitmentAllHistoryResultList.fromJson(appoint)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/geofencing/GeofencingServices.dart b/lib/core/service/geofencing/GeofencingServices.dart index 56b4f56e..0ae93dff 100644 --- a/lib/core/service/geofencing/GeofencingServices.dart +++ b/lib/core/service/geofencing/GeofencingServices.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:developer'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -12,8 +11,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import '../../../locator.dart'; - class GeofencingServices extends BaseService { List geoZones = List(); bool testZones = true; diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index 6e32d8e6..46bc95f9 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/request_get_hospitals_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:geolocator/geolocator.dart'; @@ -26,8 +26,8 @@ class HospitalService extends BaseService { if(isResBasedOnLoc) await _getCurrentLocation(); Map body = Map(); - body['Latitude'] = isResBasedOnLoc?_latitude:0; - body['Longitude'] = isResBasedOnLoc?_longitude:0; + body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); + body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); body['IsOnlineCheckIn'] = isResBasedOnLoc; body['PatientOutSA'] = 0; diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index 6eb1f415..176043e1 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -10,6 +10,8 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; class InsuranceCardService extends BaseService { List _cardList = List(); @@ -67,21 +69,19 @@ class InsuranceCardService extends BaseService { Future getInsuranceApproval({int appointmentNo}) async { hasError = false; - // _cardList.clear(); if (appointmentNo != null) { - // _requestInsuranceApprovalModel.appointmentNo = appointmentNo; - _requestInsuranceApprovalModel.eXuldAPPNO = null; - _requestInsuranceApprovalModel.projectID = null; + _requestInsuranceApprovalModel.appointmentNo = appointmentNo; + _requestInsuranceApprovalModel.eXuldAPPNO = 0; + _requestInsuranceApprovalModel.projectID = 0; } else { - // _requestInsuranceApprovalModel.appointmentNo = null; + _requestInsuranceApprovalModel.appointmentNo = 0; _requestInsuranceApprovalModel.eXuldAPPNO = 0; _requestInsuranceApprovalModel.projectID = 0; } + _insuranceApproval.clear(); + _insuranceApproval.length = 0; await baseAppClient.post(GET_PAtIENTS_INSURANCE_APPROVALS, onSuccess: (dynamic response, int statusCode) { - print(response['HIS_Approval_List'].length); - _insuranceApproval.clear(); - _insuranceApproval.length = 0; response['HIS_Approval_List'].forEach((item) { _insuranceApproval.add(InsuranceApprovalModel.fromJson(item)); }); @@ -101,21 +101,27 @@ class InsuranceCardService extends BaseService { } Future getSharedRecordByStatus() async { - try { - dynamic localRes; - var request = GetAllSharedRecordsByStatusReq(); - request.status = 0; - await baseAppClient.post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - AppToast.showErrorToast(message: error); + var myFamily = await sharedPref.getObject(FAMILY_FILE); + if (myFamily != null) { + getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(myFamily); + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(myFamily)); + } else { + try { + dynamic localRes; + var request = GetAllSharedRecordsByStatusReq(); + request.status = 0; + await baseAppClient.post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + AppToast.showErrorToast(message: error); + throw error; + }, body: request.toJson()); + sharedPref.setObject(FAMILY_FILE, localRes); + getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); + } catch (error) { + print(error); throw error; - }, body: request.toJson()); - sharedPref.setObject(FAMILY_FILE, localRes); - getAllSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); - } catch (error) { - print(error); - throw error; + } } } @@ -157,7 +163,7 @@ class InsuranceCardService extends BaseService { ); } - Future uploadInsuranceCard({String patientIdentificationID, int patientID, String image = ""}) async { + Future uploadInsuranceCard(BuildContext context, {String patientIdentificationID, int patientID, String image = ""}) async { error = ""; Map body = Map(); body['PatientID'] = patientID; @@ -166,14 +172,26 @@ class InsuranceCardService extends BaseService { body['PatientIdentificationID'] = patientIdentificationID; body['InsuranceCardImage'] = image; + dynamic localRes; + await baseAppClient.post( UPLOAD_INSURANCE_CARD, - onSuccess: (dynamic response, int statusCode) {}, + onSuccess: (dynamic response, int statusCode) { + print(response); + if(response['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); + } else { + AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + } + localRes = response; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; + throw error; }, body: body, ); + return Future.value(localRes); } } diff --git a/lib/core/service/medical/ActiveMedicationsService.dart b/lib/core/service/medical/ActiveMedicationsService.dart index 070b7e5f..f82290b7 100644 --- a/lib/core/service/medical/ActiveMedicationsService.dart +++ b/lib/core/service/medical/ActiveMedicationsService.dart @@ -10,7 +10,8 @@ class ActiveMedicationsService extends BaseService{ hasError = false; super.error = ""; Map body = Map(); - body['isDentalAllowedBackend'] = false; + // body['isDentalAllowedBackend'] = false; + // body['PatientID'] = 1298851; await baseAppClient.post(ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID, onSuccess: (response, statusCode) async { activePrescriptionReport.clear(); diff --git a/lib/core/service/medical/BloodPressureService.dart b/lib/core/service/medical/BloodPressureService.dart index 7a849808..08ca9027 100644 --- a/lib/core/service/medical/BloodPressureService.dart +++ b/lib/core/service/medical/BloodPressureService.dart @@ -24,6 +24,7 @@ class BloodPressureService extends BaseService { monthDiabtectResultAverageList.clear(); weekDiabtectResultAverageList.clear(); yearDiabtecResultAverageList.clear(); + response['List_MonthBloodPressureResultAverage'].forEach((item) { monthDiabtectResultAverageList .add(MonthBloodPressureResultAverage.fromJson(item)); @@ -111,6 +112,7 @@ class BloodPressureService extends BaseService { {String bloodPressureDate, String diastolicPressure, String systolicePressure, + int lineItemNo, int measuredArm}) async { hasError = false; super.error = ""; @@ -120,6 +122,7 @@ class BloodPressureService extends BaseService { body['DiastolicPressure'] = diastolicPressure; body['SystolicePressure'] = systolicePressure; body['MeasuredArm'] ='$measuredArm'; + body['LineItemNo'] = lineItemNo; body['isDentalAllowedBackend'] = false; await baseAppClient.post(UPDATE_BLOOD_PRESSURE_RESULT, diff --git a/lib/core/service/medical/BloodSugarService.dart b/lib/core/service/medical/BloodSugarService.dart index 4de444ea..9c8e9cd9 100644 --- a/lib/core/service/medical/BloodSugarService.dart +++ b/lib/core/service/medical/BloodSugarService.dart @@ -18,30 +18,25 @@ class BloodSugarService extends BaseService { Future getBloodSugar() async { hasError = false; Map body = Map(); + monthDiabtectResultAverageList.clear(); + weekDiabtectResultAverageList.clear(); + yearDiabtecResultAverageList.clear(); + monthDiabtecPatientResult.clear(); + weekDiabtecPatientResult.clear(); + yearDiabtecPatientResult.clear(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_DIABETIC_RESULT_AVERAGE, - onSuccess: (dynamic response, int statusCode) { - monthDiabtectResultAverageList.clear(); - weekDiabtectResultAverageList.clear(); - yearDiabtecResultAverageList.clear(); - - monthDiabtecPatientResult.clear(); - weekDiabtecPatientResult.clear(); - yearDiabtecPatientResult.clear(); + await baseAppClient.post(GET_DIABETIC_RESULT_AVERAGE, onSuccess: (dynamic response, int statusCode) { response['List_MonthDiabtectResultAverage'].forEach((item) { - monthDiabtectResultAverageList - .add(MonthDiabtectResultAverage.fromJson(item)); + monthDiabtectResultAverageList.add(MonthDiabtectResultAverage.fromJson(item)); }); response['List_WeekDiabtectResultAverage'].forEach((item) { - weekDiabtectResultAverageList - .add(WeekDiabtectResultAverage.fromJson(item)); + weekDiabtectResultAverageList.add(WeekDiabtectResultAverage.fromJson(item)); }); response['List_YearDiabtecResultAverage'].forEach((item) { - yearDiabtecResultAverageList - .add(YearDiabtecResultAverage.fromJson(item)); + yearDiabtecResultAverageList.add(YearDiabtecResultAverage.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -51,11 +46,10 @@ class BloodSugarService extends BaseService { Future getDiabtecResults() async { hasError = false; - await baseAppClient.post(GET_DIABTEC_RESULT, - onSuccess: (dynamic response, int statusCode) { - monthDiabtecPatientResult.clear(); - weekDiabtecPatientResult.clear(); - yearDiabtecPatientResult.clear(); + monthDiabtecPatientResult.clear(); + weekDiabtecPatientResult.clear(); + yearDiabtecPatientResult.clear(); + await baseAppClient.post(GET_DIABTEC_RESULT, onSuccess: (dynamic response, int statusCode) { response['List_MonthDiabtecPatientResult'].forEach((item) { monthDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item)); @@ -69,7 +63,6 @@ class BloodSugarService extends BaseService { yearDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item)); }); }, onFailure: (String error, int statusCode) { - hasError = true; super.error = error; }, body: Map()); } @@ -81,17 +74,15 @@ class BloodSugarService extends BaseService { body['BloodSugerDateChart'] = bloodSugerDateChart; body['BloodSugerResult'] = bloodSugerResult; body['DiabtecUnit'] = diabtecUnit; - body['MeasuredTime'] = measuredTime+1; + body['MeasuredTime'] = measuredTime + 1; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(ADD_DIABTEC_RESULT, - onSuccess: (response, statusCode) async {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(ADD_DIABTEC_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async { + updateDiabtecResult({DateTime month, DateTime hour, String bloodSugerResult, String diabtecUnit, int measuredTime, int lineItemNo}) async { hasError = false; super.error = ""; Map body = Map(); @@ -99,11 +90,9 @@ class BloodSugarService extends BaseService { body['DiabtecUnit'] = diabtecUnit; body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00'; body['isDentalAllowedBackend'] = false; - body['MeasuredTime'] = measuredTime+1; + body['MeasuredTime'] = measuredTime + 1; body['LineItemNo'] = lineItemNo; - await baseAppClient.post(UPDATE_DIABETIC_RESULT, - onSuccess: (response, statusCode) async {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(UPDATE_DIABETIC_RESULT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -115,25 +104,21 @@ class BloodSugarService extends BaseService { Map body = Map(); body['isDentalAllowedBackend'] = false; body['To'] = user.emailAddress; - await baseAppClient.post(SEND_AVERAGE_BLOOD_SUGAR_REPORT, - onSuccess: (response, statusCode) async {}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + await baseAppClient.post(SEND_AVERAGE_BLOOD_SUGAR_REPORT, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - Future deactivateDiabeticStatus({int lineItemNo }) async { - hasError = false; + Future deactivateDiabeticStatus({int lineItemNo}) async { + hasError = false; super.error = ""; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['LineItemNo'] =lineItemNo; - await baseAppClient.post(DEACTIVATE_DIABETIC_STATUS, - onSuccess: (response, statusCode) async {}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + body['LineItemNo'] = lineItemNo; + await baseAppClient.post(DEACTIVATE_DIABETIC_STATUS, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } } diff --git a/lib/core/service/medical/WeightPressureService.dart b/lib/core/service/medical/WeightPressureService.dart index 6d150c28..5cfcc35c 100644 --- a/lib/core/service/medical/WeightPressureService.dart +++ b/lib/core/service/medical/WeightPressureService.dart @@ -20,10 +20,10 @@ class WeightService extends BaseService { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; + monthWeightMeasurementResultAverage.clear(); + weekWeightMeasurementResultAverage.clear(); + yearWeightMeasurementResultAverage.clear(); await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT_AVERAGE, onSuccess: (dynamic response, int statusCode) { - monthWeightMeasurementResultAverage.clear(); - weekWeightMeasurementResultAverage.clear(); - yearWeightMeasurementResultAverage.clear(); response['List_MonthWeightMeasurementResultAverage'].forEach((item) { monthWeightMeasurementResultAverage.add(MonthWeightMeasurementResultAverage.fromJson(item)); }); @@ -43,10 +43,10 @@ class WeightService extends BaseService { Future getWeightMeasurementResult() async { hasError = false; + monthWeightMeasurementResult.clear(); + weekWeightMeasurementResult.clear(); + yearWeightMeasurementResult.clear(); await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT, onSuccess: (dynamic response, int statusCode) { - monthWeightMeasurementResult.clear(); - weekWeightMeasurementResult.clear(); - yearWeightMeasurementResult.clear(); response['List_WeekWeightMeasurementResult'].forEach((item) { weekWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item)); diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 9a819a6e..57ab856b 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -16,14 +16,16 @@ class AskDoctorService extends BaseService { body['DoctorID'] = doctorId; body['ProjectID'] = projectId; + dynamic localRes; + await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, onSuccess: (dynamic response, int statusCode) { - ///OKAY - var asd=""; + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); + return Future.value(localRes); } Future getCallRequestTypeLOV() async { diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart index 5888fa0d..c8f29e44 100644 --- a/lib/core/service/medical/medical_service.dart +++ b/lib/core/service/medical/medical_service.dart @@ -1,10 +1,11 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:flutter/cupertino.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; +import 'package:flutter/cupertino.dart'; class MedicalService extends BaseService { List appoitmentAllHistoryResultList = List(); @@ -18,18 +19,24 @@ class MedicalService extends BaseService { body['IsActiveAppointment'] = true; body['isDentalAllowedBackend'] = false; } - - await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, - onSuccess: (response, statusCode) async { + var appoHistory = await sharedPref.getObject(APPOINTMENT_HISTORY_MEDICAL); + if (appoHistory != null) { appoitmentAllHistoryResultList.clear(); - response['AppoimentAllHistoryResultList'].forEach((appoitment) { - appoitmentAllHistoryResultList - .add(AppoitmentAllHistoryResultList.fromJson(appoitment)); + appoHistory.forEach((appoitment) { + appoitmentAllHistoryResultList.add(AppoitmentAllHistoryResultList.fromJson(appoitment)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + } else { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { + appoitmentAllHistoryResultList.clear(); + response['AppoimentAllHistoryResultList'].forEach((appoitment) { + appoitmentAllHistoryResultList.add(AppoitmentAllHistoryResultList.fromJson(appoitment)); + }); + sharedPref.setObject(APPOINTMENT_HISTORY_MEDICAL, response['AppoimentAllHistoryResultList']); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } addAmbulanceRequest({@required PatientER patientER}) async { @@ -39,9 +46,7 @@ class MedicalService extends BaseService { body['RequesterFileNo'] = user.patientID; body['RequesterMobileNo'] = user.mobileNumber; body['RequesterIsOutSA'] = user.outSA; - await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, - onSuccess: (response, statusCode) async {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -49,35 +54,22 @@ class MedicalService extends BaseService { getSchedule(DoctorList doctorRequest) async { Map request; - request = { - 'DoctorID': doctorRequest.doctorID, - 'ProjectID': doctorRequest.projectID, - 'ClinicID': doctorRequest.clinicID, - 'DoctorWorkingHoursDays': 7 - }; + request = {'DoctorID': doctorRequest.doctorID, 'ProjectID': doctorRequest.projectID, 'ClinicID': doctorRequest.clinicID, 'DoctorWorkingHoursDays': 7}; dynamic localRes; - await baseAppClient.post(DOCTOR_SCHEDULE_URL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(DOCTOR_SCHEDULE_URL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; }, body: request); doctorScheduleResponse.clear(); - localRes['List_DoctorWorkingHoursTable'].forEach((item) => - {doctorScheduleResponse.add(DoctorScheduleResponse.fromJson(item))}); + localRes['List_DoctorWorkingHoursTable'].forEach((item) => {doctorScheduleResponse.add(DoctorScheduleResponse.fromJson(item))}); } getFreeSlot(DoctorList doctorRequest) async { Map request; - request = { - 'DoctorID': doctorRequest.doctorID, - 'ProjectID': doctorRequest.projectID, - 'ClinicID': doctorRequest.clinicID, - 'DoctorWorkingHoursDays': 7 - }; + request = {'DoctorID': doctorRequest.doctorID, 'ProjectID': doctorRequest.projectID, 'ClinicID': doctorRequest.clinicID, 'DoctorWorkingHoursDays': 7}; dynamic localRes; - await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; diff --git a/lib/core/service/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart index 6fb91a37..283eac4b 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -1,4 +1,3 @@ -import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -29,7 +28,7 @@ class MyBalanceService extends BaseService { locator(); MyBalanceService() { - getFamilyFiles(); + // getFamilyFiles(); } getPatientAdvanceBalanceAmount() async { diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index d815ea30..0a7d9e68 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -1,15 +1,16 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_info_rc_model.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/request_get_list_pharmacy_for_prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescription_report_enh.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/request_prescriptions_orders.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/request_send_prescription_email.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:flutter/cupertino.dart'; @@ -17,7 +18,9 @@ import 'package:flutter/cupertino.dart'; class PrescriptionsService extends BaseService { List prescriptionsList = List(); List prescriptionReportListINP = List(); - List prescriptionsOrderList = List(); + List prescriptionsOrderList = List(); + List prescriptionsOrderListRC = List(); + var isMedDeliveryAllowed; Future getPrescriptions() async { hasError = false; @@ -35,12 +38,40 @@ class PrescriptionsService extends BaseService { } Future getPrescriptionsOrders() async { + prescriptionsOrderList.clear(); Map body = Map(); - body['isDentalAllowedBackend'] = false; + // body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { - prescriptionsOrderList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { - prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + // prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescriptionsInfoRC(int orderID, dynamic patientID) async { + prescriptionsOrderListRC.clear(); + Map body = Map(); + body['ID'] = orderID; + await baseAppClient.post(GET_ALL_PRESCRIPTION_INFO_RC + "?PatientId=" + patientID.toString(), onSuccess: (dynamic response, int statusCode) { + response['response']['report'].forEach((prescriptionsOrder) { + prescriptionsOrderListRC.add(PrescriptionInfoRCModel.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescriptionsOrdersRC() async { + prescriptionsOrderList.clear(); + Map body = Map(); + // body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + response['response'].forEach((prescriptionsOrder) { + prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -48,8 +79,7 @@ class PrescriptionsService extends BaseService { }, body: body); } - RequestPrescriptionReport _requestPrescriptionReport = - RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false); + RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false); List prescriptionReportList = List(); Future getPrescriptionReport({Prescriptions prescriptions}) async { @@ -65,10 +95,10 @@ class PrescriptionsService extends BaseService { _requestPrescriptionReport.episodeID = prescriptions.episodeID; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; - await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(prescriptions.isInOutPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) { prescriptionReportList.clear(); prescriptionReportEnhList.clear(); + isMedDeliveryAllowed = response['IsHomeMedicineDeliverySupported']; if (prescriptions.isInOutPatient) { response['ListPRM'].forEach((prescriptions) { prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); @@ -90,8 +120,7 @@ class PrescriptionsService extends BaseService { isDentalAllowedBackend: false, ); - Future sendPrescriptionEmail( - String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async { + Future sendPrescriptionEmail(String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, int projectID) async { _requestSendPrescriptionEmail.listPrescriptions = prescriptionReportList; _requestSendPrescriptionEmail.appointmentDate = appointmentDate; _requestSendPrescriptionEmail.patientID = patientID; @@ -107,15 +136,13 @@ class PrescriptionsService extends BaseService { _requestSendPrescriptionEmail.setupID = user.setupID; _requestSendPrescriptionEmail.to = user.emailAddress; hasError = false; - await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: _requestSendPrescriptionEmail.toJson()); } - RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = - RequestGetListPharmacyForPrescriptions( + RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions( latitude: 0, longitude: 0, isDentalAllowedBackend: false, @@ -125,6 +152,13 @@ class PrescriptionsService extends BaseService { Future getListPharmacyForPrescriptions({int itemId}) async { hasError = false; requestGetListPharmacyForPrescriptions.itemID = itemId; + + requestGetListPharmacyForPrescriptions.latitude = await sharedPref.getDouble(USER_LAT); + requestGetListPharmacyForPrescriptions.longitude = await sharedPref.getDouble(USER_LONG); + + // requestGetListPharmacyForPrescriptions.latitude = 24.709863; + // requestGetListPharmacyForPrescriptions.longitude = 46.668348; + pharmacyPrescriptionsList.clear(); await baseAppClient.post(GET_PHARMACY_LIST, onSuccess: (dynamic response, int statusCode) { pharmacyPrescriptionsList.clear(); @@ -144,7 +178,6 @@ class PrescriptionsService extends BaseService { List prescriptionReportEnhList = List(); Future getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async { - ///This logic copy from the old app from class [order-history.component.ts] in line 45 bool isInPatient = false; prescriptionsList.forEach((element) { if (prescriptionsOrder.appointmentNo == "0") { @@ -166,16 +199,13 @@ class PrescriptionsService extends BaseService { _requestPrescriptionReportEnh.setupID = element.setupID; _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; isInPatient = element.isInOutPatient; - - ///call inpGetPrescriptionReport } } }); hasError = false; - await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT, onSuccess: (dynamic response, int statusCode) { prescriptionReportEnhList.clear(); if (isInPatient) { @@ -195,6 +225,18 @@ class PrescriptionsService extends BaseService { }, body: _requestPrescriptionReportEnh.toJson()); } + Future updatePressOrderRC({@required int presOrderID}) async { + hasError = false; + Map body = Map(); + body['Id'] = presOrderID; + body['StatusId'] = 6; + body['ClickButton'] = 14; + await baseAppClient.post(UPDATE_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future updatePressOrder({@required int presOrderID}) async { hasError = false; Map body = Map(); @@ -203,8 +245,7 @@ class PrescriptionsService extends BaseService { body['RejectionReason'] = ''; body['PresOrderStatus'] = 4; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(UPDATE_PRESS_ORDER, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart index 15811b82..ae5396a7 100644 --- a/lib/core/service/packages_offers/PackagesOffersServices.dart +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -1,33 +1,38 @@ import 'dart:convert'; import 'dart:developer'; -import 'dart:ui'; import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/enum/PaymentOptions.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/order_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; -import '../../../locator.dart'; +Map packagesAuthHeader = {}; class OffersAndPackagesServices extends BaseService { + AuthenticatedUser patientUser; List categoryList = List(); List productList = List(); List latestOffersList = List(); + List tamaraPaymentOptions = List(); List bestSellerList = List(); List bannersList = List(); List cartItemList = List(); + List _hospitals = List(); + List get hospitals => _hospitals; String cartItemCount = ""; PackagesCustomerResponseModel customer; @@ -36,16 +41,14 @@ class OffersAndPackagesServices extends BaseService { Future errorThrow; var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['categories'].forEach((json) { categoryList.add(PackagesCategoriesResponseModel().fromJson(json)); }); } - }, onFailure: (String error, int statusCode) { - log(error); - }, queryParams: request.toFlatMap()); + }, onFailure: (String error, int statusCode) {}, queryParams: request.toFlatMap()); return categoryList; } @@ -54,27 +57,43 @@ class OffersAndPackagesServices extends BaseService { Future errorThrow; request.sinceId = (productList.isNotEmpty) ? productList.last.id : 0; - + productList = List(); var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { productList.add(PackagesResponseModel().fromJson(json)); }); } + }, onFailure: (String error, int statusCode) {}, queryParams: request.toFlatMap()); + + return productList; + } + + Future> getTamaraOptions({@required BuildContext context, @required bool showLoading = true}) async { + if (tamaraPaymentOptions != null && tamaraPaymentOptions.isNotEmpty) return tamaraPaymentOptions; + + var url = EXA_CART_API_BASE_URL + PACKAGES_TAMARA_OPT; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + jsonResponse['payment_option'].forEach((json) { + tamaraPaymentOptions.add(TamaraPaymentOption.fromJson(json)); + }); + } }, onFailure: (String error, int statusCode) { log(error); - }, queryParams: request.toFlatMap()); + }); - return productList; + return tamaraPaymentOptions; } Future> getLatestOffers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async { - var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { + latestOffersList.clear(); if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -89,9 +108,9 @@ class OffersAndPackagesServices extends BaseService { } Future> getBestSellers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async { - var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { + bestSellerList.clear(); if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -105,10 +124,9 @@ class OffersAndPackagesServices extends BaseService { return bestSellerList; } - Future> getBanners({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async { var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -122,14 +140,13 @@ class OffersAndPackagesServices extends BaseService { return bannersList; } - Future loadOffersPackagesDataForMainPage({@required BuildContext context, bool showLoading = true, Function completion }) async { + Future loadOffersPackagesDataForMainPage({@required BuildContext context, bool showLoading = true, Function completion}) async { var finished = 0; - var totalCalls = 3; - - completedAll(){ + var totalCalls = 2; + completedAll() { finished++; - if(completion != null && finished == totalCalls) { + if (completion != null && finished == totalCalls) { _hideLoading(context, showLoading); completion(); } @@ -137,83 +154,111 @@ class OffersAndPackagesServices extends BaseService { _showLoading(context, showLoading); + final auth_token = await baseAppClient.generatePackagesToken(); + if (auth_token == null) { + throw 'Something went wrong while authentication, Please try again letter'; + } + packagesAuthHeader["Authorization"] = 'Bearer $auth_token'; + + // Check and Create Customer + if (patientUser != null) { + customer = await getCurrentCustomer(context: context, showLoading: showLoading); + if (customer == null) { + createCustomer(PackagesCustomerRequestModel.fromUser(patientUser), context: context); + } + } + // Performing Parallel Request on same time // # 1 - getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){ - completedAll(); + getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value) { + completedAll(); }); // # 2 - getLatestOffers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){ + getLatestOffers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value) { completedAll(); }); // # 3 - getBanners(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){ - completedAll(); - }); - + // getBanners( + // request: OffersProductsRequestModel(), + // context: context, + // showLoading: false) + // .then((value) { + // completedAll(); + // }); } // -------------------- // Create Customer // -------------------- - Future createCustomer(PackagesCustomerRequestModel request, {@required BuildContext context, bool showLoading = true, Function(bool) completion }) async{ - if(customer != null) - return Future.value(customer); + Future createCustomer(PackagesCustomerRequestModel request, {@required BuildContext context, bool showLoading = true, Function(bool) completion}) async { + if (customer != null) return Future.value(customer); customer = null; Future errorThrow; _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER; - await baseAppClient.simplePost(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){ - _hideLoading(context, showLoading); - + await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) { var jsonResponse = json.decode(stringResponse); var customerJson = jsonResponse['customers'].first; customer = PackagesCustomerResponseModel.fromJson(customerJson); - - }, onFailure: (String error, int statusCode){ - _hideLoading(context, showLoading); + }, onFailure: (String error, int statusCode) { errorThrow = Future.error(error); log(error); }); + _hideLoading(context, showLoading); await Future.delayed(Duration(seconds: 1)); return errorThrow ?? customer; } + Future getCurrentCustomer({@required BuildContext context, bool showLoading = true}) async { + if (customer != null) return Future.value(customer); + + _showLoading(context, showLoading); + var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER + "/username/${patientUser.patientID}"; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { + var jsonResponse = json.decode(stringResponse); + var customerJson = jsonResponse['customers'].first; + customer = PackagesCustomerResponseModel.fromJson(customerJson); + }, onFailure: (String error, int statusCode) { + log(error); + }); + _hideLoading(context, showLoading); + return customer; + } // -------------------- // Shopping Cart // -------------------- - Future> cartItems({@required BuildContext context, bool showLoading = true}) async{ + Future> cartItems({@required BuildContext context, bool showLoading = true}) async { Future errorThrow; cartItemList.clear(); _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/${customer.id}'; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + Map jsonResponse; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); - var jsonResponse = json.decode(stringResponse); + jsonResponse = json.decode(stringResponse); jsonResponse['shopping_carts'].forEach((json) { cartItemList.add(PackagesCartItemsResponseModel.fromJson(json)); }); - }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); log(error); - errorThrow = Future.error({"error":error, "statusCode":statusCode}); + errorThrow = Future.error({"error": error, "statusCode": statusCode}); }, queryParams: null); - return errorThrow ?? cartItemList; + return errorThrow ?? jsonResponse; } - Future> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async{ + Future> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async { Future errorThrow; ResponseModel response; @@ -221,15 +266,14 @@ class OffersAndPackagesServices extends BaseService { _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART; - await baseAppClient.simplePost(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){ + await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); var jsonCartItem = jsonResponse["shopping_carts"][0]; response = ResponseModel(status: true, data: PackagesCartItemsResponseModel.fromJson(jsonCartItem), error: null); - cartItemCount = response.data.quantity.toString(); - - }, onFailure: (String error, int statusCode){ + cartItemCount = (jsonResponse['count'] ?? 0).toString(); + }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); errorThrow = Future.error(ResponseModel(status: true, data: null, error: error)); }); @@ -237,39 +281,35 @@ class OffersAndPackagesServices extends BaseService { return errorThrow ?? response; } - Future updateProductToCart(int cartItemID, {UpdateProductToCartRequestModel request, @required BuildContext context, bool showLoading = true}) async{ + Future updateProductToCart(int cartItemID, {UpdateProductToCartRequestModel request, @required BuildContext context, bool showLoading = true}) async { Future errorThrow; _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID'; - await baseAppClient.simplePut(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){ + await baseAppClient.simplePut(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); - - }, onFailure: (String error, int statusCode){ + }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); log(error); - errorThrow = Future.error({"error":error, "statusCode":statusCode}); + errorThrow = Future.error({"error": error, "statusCode": statusCode}); }); return errorThrow ?? bannersList; } - - Future deleteProductFromCart(int cartItemID, {@required BuildContext context, bool showLoading = true}) async{ + Future deleteProductFromCart(int cartItemID, {@required BuildContext context, bool showLoading = true}) async { Future errorThrow; _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID'; - await baseAppClient.simpleDelete(url, onSuccess: (dynamic stringResponse, int statusCode){ + await baseAppClient.simpleDelete(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); - // var jsonResponse = json.decode(stringResponse); - - }, onFailure: (String error, int statusCode){ + }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); log(error); - errorThrow = Future.error({"error":error, "statusCode":statusCode}); + errorThrow = Future.error({"error": error, "statusCode": statusCode}); }); return errorThrow ?? true; @@ -278,31 +318,28 @@ class OffersAndPackagesServices extends BaseService { // -------------------- // Place Order // -------------------- - Future placeOrder({@required String paymentOption, @required BuildContext context, bool showLoading = true}) async{ + Future placeOrder({@required Map paymentParams, @required int projectID, @required BuildContext context, bool showLoading = true}) async { Future errorThrow; - var jsonBody = { - "order": { - "customer_id" : customer.id, - "billing_address": { - "email": customer.email, - "phone_number": customer.addresses.first.phoneNumber - }, - "payment_method_system_name": "Payments.PayFort", - "payment_option": paymentOption - } + Map jsonBody = { + "customer_id": customer.id, + "project_id": projectID, + "billing_address": {"email": patientUser.emailAddress, "phone_number": patientUser.mobileNumber}, }; + jsonBody.addAll(paymentParams); + jsonBody = {'order': jsonBody}; + + print(jsonBody); int order_id; _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS; - await baseAppClient.simplePost(url, body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode){ + await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); order_id = jsonResponse['orders'][0]['id']; - - }, onFailure: (String error, int statusCode){ + }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); log(error); errorThrow = Future.error(error); @@ -311,35 +348,51 @@ class OffersAndPackagesServices extends BaseService { return errorThrow ?? order_id; } - Future> getOrderById(int id, {@required BuildContext context, bool showLoading = true}) async{ + Future> getOrderById(int id, {@required BuildContext context, bool showLoading = true}) async { Future errorThrow; ResponseModel response; _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS + '/$id'; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); var jsonOrder = jsonResponse['orders'][0]; response = ResponseModel(status: true, data: PackagesOrderResponseModel.fromJson(jsonOrder)); - }, onFailure: (String error, int statusCode) { _hideLoading(context, showLoading); - errorThrow = Future.error(ResponseModel(status: false,error: error)); + errorThrow = Future.error(ResponseModel(status: false, error: error)); }, queryParams: null); return errorThrow ?? response; } + Future getHospitals({bool isResBasedOnLoc = true}) async { + Map body = Map(); + body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); + body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); + body['IsOnlineCheckIn'] = isResBasedOnLoc; + body['PatientOutSA'] = 0; + + await baseAppClient.post(GET_PROJECT, + onSuccess: (dynamic response, int statusCode) { + _hospitals.clear(); + response['ListProject'].forEach((hospital) { + _hospitals.add(HospitalsModel.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + } -_showLoading(BuildContext context, bool flag){ - if(flag) - GifLoaderDialogUtils.showMyDialog(context); +_showLoading(BuildContext context, bool flag) { + if (flag) GifLoaderDialogUtils.showMyDialog(context); } -_hideLoading(BuildContext context, bool flag){ - if(flag) - GifLoaderDialogUtils.hideDialog(context); -} \ No newline at end of file +_hideLoading(BuildContext context, bool flag) { + if (flag) GifLoaderDialogUtils.hideDialog(context); +} diff --git a/lib/core/service/parmacyModule/lacum-service.dart b/lib/core/service/parmacyModule/lacum-service.dart index c7117303..122bafd6 100644 --- a/lib/core/service/parmacyModule/lacum-service.dart +++ b/lib/core/service/parmacyModule/lacum-service.dart @@ -23,6 +23,8 @@ class LacumService extends BaseService{ await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, onSuccess: (response, statusCode) async { lacumInformation = LacumAccountInformation.fromJson(response); + print("Test Lacum Account Information"); + print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -45,6 +47,8 @@ class LacumService extends BaseService{ await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, onSuccess: (response, statusCode) async { lacumGroupInformation = LacumAccountInformation.fromJson(response); + print("Test Lacum Group Information"); + print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 0364d64f..899cc66b 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:flutter/cupertino.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; class OrderPreviewService extends BaseService { @@ -25,8 +24,7 @@ class OrderPreviewService extends BaseService { Map queryParams = {'fields': 'addresses'}; hasError = false; try { - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) { addresses.clear(); response['customers'][0]['addresses'].forEach((item) { addresses.add(Addresses.fromJson(item)); @@ -46,9 +44,7 @@ class OrderPreviewService extends BaseService { dynamic localRes; hasError = false; try { - await baseAppClient - .getPharmacy("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_SHIPPING_OPTIONS$customerId/${selectedAddress.id}", onSuccess: (dynamic response, int statusCode) { localRes = response['shipping_option'][0]; }, onFailure: (String error, int statusCode) { hasError = true; @@ -68,8 +64,7 @@ class OrderPreviewService extends BaseService { dynamic localRes; hasError = false; try { - await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -81,8 +76,7 @@ class OrderPreviewService extends BaseService { return Future.value(localRes); } - Future changeProductQuantity( - String productId, ShoppingCart product) async { + Future changeProductQuantity(String productId, ShoppingCart product) async { hasError = false; super.error = ""; dynamic localRes; @@ -96,8 +90,7 @@ class OrderPreviewService extends BaseService { Map body = Map(); body["shopping_cart_item"] = choppingCartObject; - await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", - isExternal: false, onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", isExternal: false, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -114,8 +107,7 @@ class OrderPreviewService extends BaseService { Map body = Map(); - await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", - isExternal: false, onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", isExternal: false, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -132,9 +124,7 @@ class OrderPreviewService extends BaseService { super.error = ""; dynamic localRes; - await baseAppClient - .getPharmacy("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", - onSuccess: (response, statusCode) async { + await baseAppClient.getPharmacy("$DELETE_SHOPPING_CART_ALL$customerId/ShoppingCart", onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -144,16 +134,15 @@ class OrderPreviewService extends BaseService { return Future.value(localRes); } - Future getLacumAccountInformation() async { + Future getLacumAccountInformation(String identificationNo) async { hasError = false; super.error = ""; Map body = Map(); - body['IdentificationNo'] = user.patientIdentificationNo; + body['IdentificationNo'] = identificationNo; try { - await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, onSuccess: (response, statusCode) async { lacumInformation = LacumAccountInformation.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -164,17 +153,16 @@ class OrderPreviewService extends BaseService { } } - Future getLacumGroupInformation() async { + Future getLacumGroupInformation(String identificationNo) async { hasError = false; super.error = ""; Map body = Map(); - body['IdentificationNo'] = user.patientIdentificationNo; + body['IdentificationNo'] = identificationNo; body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; try { - await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LACUM_GROUP_INFORMATION, onSuccess: (response, statusCode) async { lacumGroupInformation = LacumAccountInformation.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -185,31 +173,29 @@ class OrderPreviewService extends BaseService { } } - Future makeOrder(PaymentCheckoutData paymentCheckoutData, - List shoppingCarts) async { + Future makeOrder(PaymentCheckoutData paymentCheckoutData, List shoppingCarts) async { paymentCheckoutData.address.isChecked = true; hasError = false; super.error = ""; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); Map orderBody = Map(); orderBody['rx_attachments'] = ""; - orderBody['customer_language_id'] = languageID == 'ar' ? 1 : 2; + orderBody['customer_language_id'] = languageID == 'ar' ? 2 : 1; orderBody['billing_address'] = paymentCheckoutData.address; orderBody['pick_up_in_store'] = false; orderBody['payment_method_system_name'] = "Payments.PayFort"; - orderBody['shipping_method'] = languageID == 'ar' - ? paymentCheckoutData.shippingOption.namen - : paymentCheckoutData.shippingOption.name; - orderBody['shipping_rate_computation_method_system_name'] = - paymentCheckoutData - .shippingOption.shippingRateComputationMethodSystemName; + + if (paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.Aramex") + orderBody['shipping_method'] = "Aramex Domestic"; + else + orderBody['shipping_method'] = "Fixed Price"; + + orderBody['shipping_rate_computation_method_system_name'] = paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName; orderBody['customer_id'] = int.parse(customerId); - orderBody['custom_values_xml'] = - "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; + orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; @@ -227,9 +213,7 @@ class OrderPreviewService extends BaseService { body['order'] = orderBody; try { - await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, - isExternal: false, - isAllowAny: true, onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, isExternal: false, isAllowAny: true, onSuccess: (response, statusCode) async { orderList.clear(); response['orders'].forEach((item) { orderList.add(OrderDetailModel.fromJson(item)); @@ -271,8 +255,7 @@ class OrderPreviewService extends BaseService { jsonBody['DriverID'] = driverId; LatLng coordinates; - await baseAppClient.post(DRIVER_LOCATION, - onSuccess: (response, statusCode) async { + await baseAppClient.post(DRIVER_LOCATION, onSuccess: (response, statusCode) async { if (statusCode == 200) { dynamic locationObject = response['PatientER_GetDriverLocationList'][0]; double lat = locationObject['Latitude']; diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 5a0a9e54..cc330ed7 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -12,11 +13,13 @@ class PharmacyModuleService extends BaseService { bool isFinished = true; String errorMsg = ''; String url = ""; + CustomerInfo customerInfo; List bannerItems = List(); List manufacturerList = List(); List bestSellerProducts = List(); List lastVisitedProducts = List(); + List mostViewedProducts = List(); Future makeVerifyCustomer(dynamic data) async { Map queryParams = { @@ -47,21 +50,22 @@ class PharmacyModuleService extends BaseService { var languageID = await sharedPref.getString(APP_LANGUAGE); Map queryParams = { 'Phone': data['MobileNumber'], - 'Email': data['EmailAddress'], 'FileNumber': data['PatientID'].toString(), - 'Language': languageID.toString(), - 'Gender': data['Gender'].toString(), - 'FirstName': data['FirstName'], - 'LastName': data['LastName'], - 'LanguageId': languageID.toString(), - 'CountryCode': data['ZipCode'], + 'Language': languageID.toString() == 'en' ? '2' : '1', + 'Iqama': data['PatientIdentificationNo'], + 'CountryCode': data['ZipCode'] ?? '966', }; hasError = false; try { - await baseAppClient.get(PHARMACY_CREATE_CUSTOMER, + await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { - if (!response['IsRegistered']) {} - await generatePharmacyToken(); + if (!response['IsRegistered']) { + } else { + customerInfo = CustomerInfo.fromJson(response); + await sharedPref.setObject( + PHARMACY_CUSTOMER_ID, customerInfo.customerId); + } + // await generatePharmacyToken(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -185,4 +189,30 @@ class PharmacyModuleService extends BaseService { } } } + + Future getMostViewedProducts() async { + hasError = false; + Map queryParams = { + 'fields': + 'id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage', + }; + try { + await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, + onSuccess: (dynamic response, int statusCode) { + mostViewedProducts.clear(); + response['products'].forEach((item) { + mostViewedProducts.add(PharmacyProduct.fromJson(item)); + }); + // print("most viewed products ---------"); + // print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + hasError = true; + super.error = error.toString(); + // throw error; + } + } } diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index 6b34255b..9a77b7bc 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -1,8 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; class PrescriptionService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -11,19 +10,18 @@ class PrescriptionService extends BaseService { String errorMsg = ''; List _prescriptionsList = List(); + List get prescriptionsList => _prescriptionsList; Future getPrescription() async { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(PRESCRIPTION, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(PRESCRIPTION, onSuccess: (dynamic response, int statusCode) { _prescriptionsList.clear(); response['PatientPrescriptionList'].forEach((prescriptions) { _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); }); - print(_prescriptionsList.length); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/pharmacies_service.dart b/lib/core/service/pharmacies_service.dart index dbd4fae1..05f45710 100644 --- a/lib/core/service/pharmacies_service.dart +++ b/lib/core/service/pharmacies_service.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; -import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:geolocator/geolocator.dart'; class PharmacyService extends BaseService { diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 97230230..3cc45680 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -1,15 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; -import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; import 'base_service.dart'; @@ -148,11 +143,14 @@ class PharmacyCategoriseService extends BaseService { ); } - Future getParentProducts({String id}) async { + Future getParentProducts( + {String id, int pageNumber, bool isLoading = false}) async { hasError = false; - _parentProductsList.clear(); + if (isLoading == false) { + _parentProductsList.clear(); + } String endPoint = id != null - ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' + ? GET_PARENT_PRODUCTS + "$id" + '&page=' + '$pageNumber' + '&limit=24' : GET_PARENT_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, @@ -160,6 +158,7 @@ class PharmacyCategoriseService extends BaseService { response['products'].forEach((item) { _parentProductsList.add(PharmacyProduct.fromJson(item)); }); + //pageNumber++; }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/vaccine_service.dart b/lib/core/service/vaccine_service.dart index 297909a4..238ae3e5 100644 --- a/lib/core/service/vaccine_service.dart +++ b/lib/core/service/vaccine_service.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart'; import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_item.dart'; import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_on_hand.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart'; class VaccineService extends BaseService { List _vaccineList = List(); @@ -15,6 +15,7 @@ class VaccineService extends BaseService { Map body = Map(); body['To'] = "0"; body['From'] = "0"; + hasError = false; _vaccineList.clear(); await baseAppClient.post(GET_VACCINES, diff --git a/lib/core/service/weather_service.dart b/lib/core/service/weather_service.dart index ea7d65bf..107f1010 100644 --- a/lib/core/service/weather_service.dart +++ b/lib/core/service/weather_service.dart @@ -24,7 +24,6 @@ class WeatherService extends BaseService { response['GetCityInfo_List'].forEach((data) { weatherIndicatorData.add(GetCityInfoList.fromJson(data)); }); - print(weatherIndicatorData); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 9d163a27..3e980071 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -1,3 +1,6 @@ +import 'dart:math' as math; + +import 'package:charts_flutter/flutter.dart' as charts; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart'; @@ -6,16 +9,19 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_p import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; + import '../../../locator.dart'; -import 'dart:math' as math; class H2OViewModel extends BaseViewModel { H2OService _h2OService = locator(); - List userProgressForWeekDataSeries; - List userProgressForMonthDataSeries; + // + // List userProgressForWeekDataSeries; + List userProgressForWeekDataSeries; + List userProgressForMonthDataSeries; + + // List userProgressForMonthDataSeries; UserDetailModel get userDetail => _h2OService.userDetailModel; @@ -70,7 +76,8 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + // userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + userProgressForWeekDataSeries = createUserProgressForWeekDataSeriesNew(); setState(ViewState.Idle); } } @@ -82,7 +89,7 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForMonthDataSeries = createUserProgressForMonthDataSeries(); + userProgressForMonthDataSeries = createUserProgressForMonthDataSeriesNew(); setState(ViewState.Idle); } } @@ -112,6 +119,23 @@ class H2OViewModel extends BaseViewModel { ]; } + List createUserProgressForWeekDataSeriesNew() { + List list = []; + + _h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) { + list.add(new LineChartModel(data.dayName, data.percentageConsumed)); + }); + return list; + } + + List createUserProgressForMonthDataSeriesNew() { + List list = []; + _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { + list.add(new LineChartModel(data.monthName, data.percentageConsumed)); + }); + return list; + } + List> createUserProgressForMonthDataSeries() { List globalData = []; _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index 65fffe33..10edbeb8 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; @@ -17,34 +18,27 @@ import '../../../locator.dart'; import 'add_new_address_Request_Model.dart'; class CMCViewModel extends BaseViewModel { - CMCService _cMCService = - locator(); - CustomerAddressesService _customerAddressesService = - locator(); - List get addressesList => - _customerAddressesService.addressesList; - List get cmcAllServicesList => + CMCService _cMCService = locator(); + CustomerAddressesService _customerAddressesService = locator(); - _cMCService.cmcAllServicesList; + List get addressesList => _customerAddressesService.addressesList; - List get cmcAllPresOrders => - _cMCService.cmcAllPresOrdersList; + List get cmcAllServicesList => _cMCService.cmcAllServicesList; - List get cmcAllOrderDetail => - _cMCService.cmcAllOrderDetail; - List get checkupItems => - _cMCService.checkupItemsList; + List get cmcAllPresOrders => _cMCService.cmcAllPresOrdersList; - PharmacyModuleService _pharmacyModuleService = locator(); + List get cmcAllOrderDetail => _cMCService.cmcAllOrderDetail; + + List get checkupItems => _cMCService.checkupItemsList; + + PharmacyModuleService _pharmacyModuleService = locator(); + + GetCMCAllOrdersResponseModel pendingOrder; bool get isOrderUpdated => _cMCService.isOrderUpdated; Future getCMCAllServices() async { - await _cMCService - .getCMCAllServices(); - CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: cmcAllServicesList[0].iD); - - await getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel,isFirst: true); + await _cMCService.getCMCAllServices(); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); @@ -52,30 +46,28 @@ class CMCViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future getCheckupItems({CMCGetItemsRequestModel cMCGetItemsRequestModel, bool isFirst = false}) async { - if(!isFirst) - setState(ViewState.Busy); + if (!isFirst) setState(ViewState.Busy); await _cMCService.getCheckupItems(cMCGetItemsRequestModel); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); } - if(!isFirst) - setState(ViewState.Idle); + if (!isFirst) setState(ViewState.Idle); } Future getCmcAllPresOrders() async { setState(ViewState.Busy); - await _cMCService.getCmcAllPresOrders(); + // await _cMCService.getCmcAllPresOrders(); + await _cMCService.getCmcAllPresOrdersRC(); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); } else { - var pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere( - (element) => element.status == 1 || element.status == 2, - orElse: () => null); + pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere((element) => element.statusId == 1 || element.statusId == 2, orElse: () => null); if (pendingOrder != null) { - await getOrderDetailByOrderID(pendingOrder); + // await getOrderDetailByOrderID(pendingOrder); setState(ViewState.Idle); } else { getCMCAllServices(); @@ -83,11 +75,10 @@ class CMCViewModel extends BaseViewModel { } } - Future updateCmcPresOrder( - UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.BusyLocal); - await _cMCService.updateCmcPresOrder( - updatePresOrderRequestModel); + // await _cMCService.updateCmcPresOrder(updatePresOrderRequestModel); + await _cMCService.updateCmcPresOrderRC(updatePresOrderRequestModel); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.ErrorLocal); @@ -96,24 +87,37 @@ class CMCViewModel extends BaseViewModel { } } - Future getOrderDetailByOrderID(GetHHCAllPresOrdersResponseModel order) async { - GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = - GetOrderDetailByOrderIDRequestModel(presOrderID: order.iD); - await _cMCService - .getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); + Future getOrderDetailByOrderID(GetCMCAllOrdersResponseModel order) async { + GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = GetOrderDetailByOrderIDRequestModel(presOrderID: order.iD); + await _cMCService.getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } - //TODO check it in uat - Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { + + Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { setState(ViewState.Busy); order.createdBy = user.patientID; order.orderServiceID = OrderService.Comprehensive_Medical_Checkup.getIdOrderService(); - await _cMCService.insertPresPresOrder(order: order); + String requestId = await _cMCService.insertPresPresOrder(order: order); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.ErrorLocal); } else { getCmcAllPresOrders(); } + return requestId; + } + + Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { + setState(ViewState.Busy); + order.createdBy = user.patientID; + order.orderServiceID = OrderService.Comprehensive_Medical_Checkup.getIdOrderService(); + String requestId = await _cMCService.insertCMCOrderRC(order: order); + if (_cMCService.hasError) { + error = _cMCService.error; + setState(ViewState.ErrorLocal); + } else { + getCmcAllPresOrders(); + } + return requestId; } Future getCustomerAddresses() async { @@ -129,25 +133,21 @@ class CMCViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ - await _customerAddressesService.getCustomerInfo(); - }); + await _pharmacyModuleService.generatePharmacyToken(); + if (_customerAddressesService.hasError) { error = _customerAddressesService.error; + await _pharmacyModuleService.createUser(); setState(ViewState.ErrorLocal); } else { + await _pharmacyModuleService.createUser(); await getCustomerAddresses(); } } - Future addAddressInfo( - {AddNewAddressRequestModel addNewAddressRequestModel}) async { - - + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { setState(ViewState.Busy); - await _customerAddressesService.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel - ); + await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); @@ -155,4 +155,4 @@ class CMCViewModel extends BaseViewModel { setState(ViewState.Idle); } } -} \ No newline at end of file +} diff --git a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart index 53b39025..ce46a9c6 100644 --- a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart +++ b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_by_time_model.dart'; import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 32644fd4..09b2a73d 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -1,10 +1,10 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_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/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; @@ -12,48 +12,37 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/home_health_care_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:intl/intl.dart'; import '../../../locator.dart'; import 'add_new_address_Request_Model.dart'; class HomeHealthCareViewModel extends BaseViewModel { - HomeHealthCareService _homeHealthCareService = - locator(); + HomeHealthCareService _homeHealthCareService = locator(); - CustomerAddressesService _customerAddressesService = - locator(); + CustomerAddressesService _customerAddressesService = locator(); - List get hhcAllServicesList => - _homeHealthCareService.hhcAllServicesList; + List get hhcAllServicesList => _homeHealthCareService.hhcAllServicesList; + List get addressesList => _customerAddressesService.addressesList; - List get addressesList => - _customerAddressesService.addressesList; + List get hhcAllPresOrders => _homeHealthCareService.hhcAllPresOrdersList; - List get hhcAllPresOrders => - _homeHealthCareService.hhcAllPresOrdersList; - - List get hhcAllOrderDetail => - _homeHealthCareService.hhcAllOrderDetail; + List get hhcAllOrderDetail => _homeHealthCareService.hhcAllOrderDetail; PharmacyModuleService _pharmacyModuleService = locator(); - - - bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; - GetHHCAllPresOrdersResponseModel pendingOrder; + int get orderId => _homeHealthCareService.requestNo; + GetCMCAllOrdersResponseModel pendingOrder; List patientERHHCInsertServicesList = List(); + dynamic get hhcResponse => _homeHealthCareService.hhcResponse; Future getHHCAllServices() async { - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = - new HHCGetAllServicesRequestModel(); - //setState(ViewState.Busy); - await _homeHealthCareService - .getHHCAllServices(hHCGetAllServicesRequestModel); + HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = new HHCGetAllServicesRequestModel(); + // await _homeHealthCareService.getHHCAllServices(hHCGetAllServicesRequestModel); + await _homeHealthCareService.getHHCAllServicesRC(hHCGetAllServicesRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); @@ -65,28 +54,25 @@ class HomeHealthCareViewModel extends BaseViewModel { Future getHHCAllPresOrders() async { pendingOrder = null; setState(ViewState.Busy); - await _homeHealthCareService.getHHCAllPresOrders(); + await _homeHealthCareService.getHHCAllPresOrdersRC(); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); } else { - pendingOrder = _homeHealthCareService.hhcAllPresOrdersList - .firstWhere((element) => element.status == 1 || element.status == 2, - orElse: () => null); + pendingOrder = _homeHealthCareService.hhcAllPresOrdersList.firstWhere((element) => element.statusId == 1 || element.statusId == 2, orElse: () => null); if (pendingOrder != null) { - await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); + // await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); setState(ViewState.Idle); } else { getHHCAllServices(); } - } } Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.Busy); - await _homeHealthCareService.updateHHCPresOrder( - updatePresOrderRequestModel); + // await _homeHealthCareService.updateHHCPresOrder(updatePresOrderRequestModel); + await _homeHealthCareService.updateHHCPresOrderRC(updatePresOrderRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.ErrorLocal); @@ -99,7 +85,8 @@ class HomeHealthCareViewModel extends BaseViewModel { setState(ViewState.Busy); order.createdBy = user.patientID; order.orderServiceID = OrderService.HOME_HEALTH_CARE.getIdOrderService(); - await _homeHealthCareService.insertPresPresOrder(order: order); + // await _homeHealthCareService.insertPresPresOrder(order: order); + await _homeHealthCareService.insertHHCOrderRC(order: order); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.ErrorLocal); @@ -108,11 +95,9 @@ class HomeHealthCareViewModel extends BaseViewModel { } } - Future getCustomerAddresses() async { setState(ViewState.Busy); - await _customerAddressesService.getCustomerAddresses( - ); + await _customerAddressesService.getCustomerAddresses(); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); @@ -123,26 +108,23 @@ class HomeHealthCareViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ - await _customerAddressesService.getCustomerInfo(); - }); + await _pharmacyModuleService.generatePharmacyToken(); + if (_customerAddressesService.hasError) { error = _customerAddressesService.error; + await _pharmacyModuleService.createUser(); setState(ViewState.ErrorLocal); } else { + await _pharmacyModuleService.createUser(); await getCustomerAddresses(); } } - Future addAddressInfo( - {AddNewAddressRequestModel addNewAddressRequestModel}) async { - + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ - await _customerAddressesService.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel - ); + await _pharmacyModuleService.generatePharmacyToken().then((value) async { + await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); }); if (_customerAddressesService.hasError) { @@ -152,6 +134,4 @@ class HomeHealthCareViewModel extends BaseViewModel { setState(ViewState.Idle); } } - - -} \ No newline at end of file +} diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index 1972e08f..ee803b5e 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -21,7 +21,7 @@ class EReferralViewModel extends BaseViewModel { List get allCities => _eReferralService.allCities; List get allReferral => _eReferralService.allReferral; - + String get referralNumber => _eReferralService.referralNumber; void getRelationTypes() async { setState(ViewState.Busy); @@ -44,6 +44,10 @@ class EReferralViewModel extends BaseViewModel { } } + void getAllProjects() async { + + } + void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); diff --git a/lib/core/viewModels/ancillary_orders_view_model.dart b/lib/core/viewModels/ancillary_orders_view_model.dart index 4a140004..0d846313 100644 --- a/lib/core/viewModels/ancillary_orders_view_model.dart +++ b/lib/core/viewModels/ancillary_orders_view_model.dart @@ -1,10 +1,10 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/service/ancillary_orders_service.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_list_model.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_proc_model.dart'; -import 'base_view_model.dart'; import '../../locator.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'base_view_model.dart'; class AnciallryOrdersViewModel extends BaseViewModel { bool hasError = false; diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index e1bdfc9e..9e0d338b 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -3,16 +3,15 @@ import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/model/rate/appoitment_rated.dart'; import 'package:diplomaticquarterapp/core/service/appointment_rate_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + import '../../locator.dart'; class AppointmentRateViewModel extends BaseViewModel { - AppointmentRateService _appointmentRateService = - locator(); + AppointmentRateService _appointmentRateService = locator(); bool isHaveAppointmentNotRate = false; AppointmentDetails get appointmentDetails => _appointmentRateService.appointmentDetails; - Future getIsLastAppointmentRatedList() async { isHaveAppointmentNotRate = false; setState(ViewState.Busy); @@ -21,8 +20,7 @@ class AppointmentRateViewModel extends BaseViewModel { error = _appointmentRateService.error; setState(ViewState.Error); } else { - if(_appointmentRateService.appointmentRatedList.length>0) - await getAppointmentDetails(); + if (_appointmentRateService.appointmentRatedList.length > 0) await getAppointmentDetails(); } } @@ -32,17 +30,14 @@ class AppointmentRateViewModel extends BaseViewModel { error = _appointmentRateService.error; setState(ViewState.Error); } else { - if (_appointmentRateService.appointmentDetails != null) - isHaveAppointmentNotRate = true; + if (_appointmentRateService.appointmentDetails != null) isHaveAppointmentNotRate = true; setState(ViewState.Idle); } } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, - int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { setState(ViewState.Busy); - await _appointmentRateService.sendAppointmentRate( - rate, appointmentNo, projectID, doctorID, clinicID, note); + await _appointmentRateService.sendAppointmentRate(rate, appointmentNo, projectID, doctorID, clinicID, note); if (_appointmentRateService.hasError) { error = _appointmentRateService.error; setState(ViewState.ErrorLocal); @@ -52,14 +47,23 @@ class AppointmentRateViewModel extends BaseViewModel { } } - AppoitmentRated get lastAppointmentRated => - _appointmentRateService.lastAppointmentRated; + Future sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName) async { + setState(ViewState.Busy); + await _appointmentRateService.sendDoctorRate(rate, appointmentNo, projectID, doctorID, clinicID, note, appoDate, docName, projectName, clinicName); + if (_appointmentRateService.hasError) { + error = _appointmentRateService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + _appointmentRateService.deleteAllAppAppointmentRate(); + } + } - deleteAppointmentRated(AppoitmentRated appointmentRated) => - _appointmentRateService.deleteAppointmentRated(appointmentRated); + AppoitmentRated get lastAppointmentRated => _appointmentRateService.lastAppointmentRated; - deleteAppAppointmentRate() => - _appointmentRateService.deleteAllAppAppointmentRate(); + deleteAppointmentRated(AppoitmentRated appointmentRated) => _appointmentRateService.deleteAppointmentRated(appointmentRated); + + deleteAppAppointmentRate() => _appointmentRateService.deleteAllAppAppointmentRate(); setIsRated(bool isRated) { this.isHaveAppointmentNotRate = isRated; diff --git a/lib/core/viewModels/blooddonation/blood_details_view_model.dart b/lib/core/viewModels/blooddonation/blood_details_view_model.dart index a6b341cf..b534a022 100644 --- a/lib/core/viewModels/blooddonation/blood_details_view_model.dart +++ b/lib/core/viewModels/blooddonation/blood_details_view_model.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; + import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart index eebaca02..5af9a75a 100644 --- a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -1,9 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart'; -import 'package:diplomaticquarterapp/core/service/childvaccines/delete_baby_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart index 7c4af285..a282b774 100644 --- a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; - -import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart'; //======== import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart'; diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart index 43269f42..68da113c 100644 --- a/lib/core/viewModels/child_vaccines/user_information_view_model.dart +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -1,8 +1,9 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/user_information_service.dart'; + import '../../../locator.dart'; import '../base_view_model.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; class UserInformationViewModel extends BaseViewModel { UserInformationService _userInformationService = diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart index d0ccb8a1..e8b4e287 100644 --- a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; -import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; -import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart'; import '../../../locator.dart'; diff --git a/lib/core/viewModels/contactus/findus_view_model.dart b/lib/core/viewModels/contactus/findus_view_model.dart index 800c3106..9b2516ba 100644 --- a/lib/core/viewModels/contactus/findus_view_model.dart +++ b/lib/core/viewModels/contactus/findus_view_model.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/service/contactus/finadus_service.dart'; -import '../base_view_model.dart'; + import '../../../locator.dart'; +import '../base_view_model.dart'; class FindusViewModel extends BaseViewModel { FindusService _findusService = locator(); diff --git a/lib/core/viewModels/contactus/livechat_view_model.dart b/lib/core/viewModels/contactus/livechat_view_model.dart index 8df4e801..bd130789 100644 --- a/lib/core/viewModels/contactus/livechat_view_model.dart +++ b/lib/core/viewModels/contactus/livechat_view_model.dart @@ -1,8 +1,9 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/contactus/get_patientI_cprojects.dart'; import 'package:diplomaticquarterapp/core/service/contactus/livechat_service.dart'; -import '../base_view_model.dart'; + import '../../../locator.dart'; +import '../base_view_model.dart'; class LiveChatViewModel extends BaseViewModel{ diff --git a/lib/core/viewModels/dashboard_view_model.dart b/lib/core/viewModels/dashboard_view_model.dart index cd34fd70..fca76cbf 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -12,16 +12,16 @@ class DashboardViewModel extends BaseViewModel { String get heightCm => _vitalSignService.heightCm; String booldType = "-"; + DashboardViewModel() { - this.getPatientRadOrders(); + // this.getPatientRadOrders(); } - // ToDoCountProviderModel toDoProvider = - // Provider.of(AppGlobal.context); getPatientRadOrders() async { if (isLogin && _vitalSignService.weightKg.isEmpty) { setState(ViewState.Busy); await _vitalSignService.getPatientRadOrders(); + if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.ErrorLocal); @@ -31,17 +31,4 @@ class DashboardViewModel extends BaseViewModel { } } } - -// getToDoCount() { -// toDoProvider.setState(0); -// ClinicListService service = new ClinicListService(); -// service.getActiveAppointmentNo(AppGlobal.context).then((res) { -// print(res['AppointmentActiveNumber']); -// if (res['MessageStatus'] == 1) { -// toDoProvider.setState(res['AppointmentActiveNumber']); -// } else {} -// }).catchError((err) { -// print(err); -// }); -// } } diff --git a/lib/core/viewModels/er/am_request_view_model.dart b/lib/core/viewModels/er/am_request_view_model.dart index 8eb292fe..aff532d7 100644 --- a/lib/core/viewModels/er/am_request_view_model.dart +++ b/lib/core/viewModels/er/am_request_view_model.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientAllPresOrders.dart'; -import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/er/PickUpRequestPresOrder.dart'; import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method_list_model.dart'; @@ -12,8 +11,9 @@ import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:flutter/cupertino.dart'; -import '../base_view_model.dart'; + import '../../../locator.dart'; +import '../base_view_model.dart'; class AmRequestViewModel extends BaseViewModel { AmService _amService = locator(); @@ -106,7 +106,7 @@ class AmRequestViewModel extends BaseViewModel { Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); // await _amService.updatePressOrder(presOrderID: presOrderID); - await _amService.updatePressOrderRC(presOrderID: presOrderID, patientID: authenticatedUserObject.user.patientID.toString()); + await _amService.updatePressOrderRC(presOrderID: presOrderID, patientID: authenticatedUserObject.user.patientID); if (_amService.hasError) { error = _amService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/er/near_hospital_view_model.dart b/lib/core/viewModels/er/near_hospital_view_model.dart index f12aa28f..4ff42a42 100644 --- a/lib/core/viewModels/er/near_hospital_view_model.dart +++ b/lib/core/viewModels/er/near_hospital_view_model.dart @@ -1,9 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; - import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import '../../../locator.dart'; diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index 1289538d..3a5846da 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -1,147 +1,225 @@ - import 'dart:async'; -import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:flutter/cupertino.dart'; import '../base_view_model.dart'; +class RRTService extends BaseService {} -class RRTService extends BaseService{ - -} -class _RRTServiceData{ - List pendingOrders = []; - List completedOrders = []; +class _RRTServiceData { + List pendingOrders = []; + List completedOrders = []; ServicePrice servicePrice; } -class RRTViewModel extends BaseViewModel{ +class RRTViewModel extends BaseViewModel { var _service = RRTService(); var _pharmacy_service = locator(); var _pharmacy_address_service = locator(); - + CustomerAddressesService _customerAddressesService = locator(); + + List get addressesList => _customerAddressesService.addressesList; + _RRTServiceData rrtServiceData = _RRTServiceData(); - Future<_RRTServiceData> loadRequiredData() async{ + Future<_RRTServiceData> loadRequiredData() async { await getServicePrice(); - await getAllOrders(); + // await getAllOrders(); + await getAllOrdersRC(); return rrtServiceData; } - Future createOrder(Map body) async{ + Future createOrder(Map body) async { body['IdentificationNo'] = user.patientIdentificationNo; body['NationalityID'] = user.nationalityID; body['CreatedBy'] = user.patientIdentificationType; body['OrderServiceID'] = 5; + var localRes; + int requestNo; + await _service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode) { + requestNo = response['RequestNo']; + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + }); + return requestNo; + } + Future createOrderRC(Map body) async { + // body['IdentificationNo'] = user.patientIdentificationNo; + // body['NationalityID'] = user.nationalityID; + // body['CreatedBy'] = user.patientIdentificationType; + // body['OrderServiceID'] = 5; + var localRes; int requestNo; - await _service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode){ - requestNo = response['RequestNo']; - }, onFailure: (error, statusCode){ + await _service.baseAppClient.post(ADD_RRT_ORDER_RC, isRCService: true, body: body, onSuccess: (response, statusCode) { + requestNo = response['response']; + }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); }); return requestNo; } // Service ID: 4 == RRT - Future<_RRTServiceData> getAllOrders() async{ - await _service.baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, body: {}, onSuccess: (response, statusCode){ + Future<_RRTServiceData> getAllOrders() async { + await _service.baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, body: {}, onSuccess: (response, statusCode) { var data = response["PatientER_GetPatientAllPresOrdersList"]; - if(data != null && data is List){ - data.forEach((json){ - if(json["ServiceID"] == 5){ - if(json["Status"] == 1){ // Pending - rrtServiceData.pendingOrders.clear(); - rrtServiceData.pendingOrders.add(PrescriptionsOrder.fromJson(json)); - }else if (json["Status"] == 3){ // Completed - rrtServiceData.completedOrders.clear(); - rrtServiceData.completedOrders.add(PrescriptionsOrder.fromJson(json)); + rrtServiceData.completedOrders.clear(); + rrtServiceData.pendingOrders.clear(); + if (data != null && data is List) { + data.forEach((json) { + if (json["ServiceID"] == 5) { + if (json["Status"] == 1 || json["Status"] == 2) { + // Pending + rrtServiceData.pendingOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); } + rrtServiceData.completedOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); } - return Future.error("404"); }); } - }, onFailure: (error, statusCode){ + }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); }); return rrtServiceData; } + Future<_RRTServiceData> getAllOrdersRC() async { + await _service.baseAppClient.post(GET_ALL_RRT_ORDERS_RC, isRCService: true, body: {}, onSuccess: (response, statusCode) { + var data = response["response"]; + rrtServiceData.completedOrders.clear(); + rrtServiceData.pendingOrders.clear(); + if (data != null && data is List) { + data.forEach((json) { + if (json["StatusId"] == 1 || json["StatusId"] == 2) { + // Pending + rrtServiceData.pendingOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); + } + rrtServiceData.completedOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); + }); + } + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + }); + return rrtServiceData; + } - Future getOrderDetails() async{ + Future getOrderDetails() async { return null; } - - Future getAllQuestions() async{ - dynamic response_; - await _service.baseAppClient.post(GET_ALL_RRT_QUESTIONS, body: {}, onSuccess: (response, statusCode){ + Future getAllQuestions() async { + dynamic response_; + await _service.baseAppClient.post(GET_ALL_RRT_QUESTIONS, body: {}, onSuccess: (response, statusCode) { response_ = response; - }, onFailure: (error, statusCode){ + }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); }); return response_; } - - Future getServicePrice() async{ - Map body = {"IdentificationNo":user.patientIdentificationNo}; - ServicePrice servicePrice; - await _service.baseAppClient.post(GET_RRT_SERVICE_PRICE, body: body, onSuccess: (response, statusCode){ + Future getServicePrice() async { + Map body = {"IdentificationNo": user.patientIdentificationNo}; + ServicePrice servicePrice; + await _service.baseAppClient.post(GET_RRT_SERVICE_PRICE, body: body, onSuccess: (response, statusCode) { var data = response['PatientE_RealRRT_GetServicePriceList']; - if(data != null && data is List){ + if (data != null && data is List) { var priceData = data.first; - if(priceData != null){ + if (priceData != null) { servicePrice = ServicePrice.fromJson(priceData); rrtServiceData.servicePrice = servicePrice; } } - }, onFailure: (error, statusCode){ + }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); }); return servicePrice; } - Future cancelOrder(PrescriptionsOrder order, {String reason = ""}) async{ - var body = {"PresOrderID":order.iD, "PresOrderStatus":4,"EditedBy":3,"RejectionReason":reason}; + Future cancelOrder(PrescriptionsOrder order, {String reason = ""}) async { + var body = {"PresOrderID": order.iD, "PresOrderStatus": 4, "EditedBy": 3, "RejectionReason": reason}; var success = false; - await _service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode){ + await _service.baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, body: body, onSuccess: (response, statusCode) { success = true; - }, onFailure: (error, statusCode){ + rrtServiceData.pendingOrders.remove(order); + }, onFailure: (error, statusCode) { AppToast.showErrorToast(message: error); success = false; }); return Future.value(success); } - Future getCancelReasons(){ + Future cancelOrderRC(GetCMCAllOrdersResponseModel order, {String reason = ""}) async { + Map body = {"Id": order.iD, "ClickButton": 14}; + var success = false; + await _service.baseAppClient.post(UPDATE_RRT_ORDER_RC, isRCService: true, body: body, onSuccess: (response, statusCode) { + success = true; + rrtServiceData.pendingOrders.remove(order); + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + success = false; + }); + return Future.value(success); } - Future> getAddresses() async{ + Future> getAddresses() async { Object error; - try{ + try { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); - if(token == null) - await _pharmacy_service.generatePharmacyToken(); + if (token == null) await _pharmacy_service.generatePharmacyToken(); await _pharmacy_service.makeVerifyCustomer({'PatientID': user.patientID.toString()}); await _pharmacy_address_service.getAddresses(); return _pharmacy_address_service.addresses; - }catch(e){ + } catch (e) { error = e; } Future.error(error); } -} \ No newline at end of file + + Future getCustomerAddresses() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerAddresses(); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getCustomerInfo() async { + setState(ViewState.Busy); + await _pharmacy_service.generatePharmacyToken(); + + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + await _pharmacy_service.createUser(); + setState(ViewState.ErrorLocal); + } else { + await _pharmacy_service.createUser(); + await getCustomerAddresses(); + } + + // setState(ViewState.Busy); + // await _pharmacy_service.generatePharmacyToken(); + // if (_customerAddressesService.hasError) { + // error = _customerAddressesService.error; + // await _pharmacy_service.createUser(); + // await getCustomerAddresses(); + // setState(ViewState.ErrorLocal); + // } else { + // await _customerAddressesService.getCustomerInfo(); + // await getCustomerAddresses(); + // } + } +} diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart index 2a9dc90b..0aac283a 100644 --- a/lib/core/viewModels/feedback/feedback_view_model.dart +++ b/lib/core/viewModels/feedback/feedback_view_model.dart @@ -3,43 +3,21 @@ import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/service/feedback/feedback_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/cupertino.dart'; import '../../../locator.dart'; -enum MessageType { - ComplaintOnAnAppointment, - ComplaintWithoutAppointment, - Question, - Compliment, - Suggestion, - NON -} +enum MessageType { ComplaintOnAnAppointment, ComplaintWithoutAppointment, Question, Compliment, Suggestion, NON } class FeedbackViewModel extends BaseViewModel { FeedbackService _feedbackService = locator(); List get cOCItemList => _feedbackService.cOCItemList; + List get appointHistoryList => _feedbackService.appointHistoryList; - List get appointHistoryList => - _feedbackService.appointHistoryList; - - Future sendCOCItem( - {String title, - String details, - String cOCTypeName, - String attachment, - AppoitmentAllHistoryResultList appointHistory}) async { + Future sendCOCItem({String title, String details, String cOCTypeName, String attachment, AppoitmentAllHistoryResultList appointHistory}) async { setState(ViewState.BusyLocal); - await _feedbackService.sendCOCItem( - title: title, - details: details, - cOCTypeName: cOCTypeName, - attachment: attachment, - appointHistory: appointHistory); + await _feedbackService.sendCOCItem(title: title, details: details, cOCTypeName: cOCTypeName, attachment: attachment, appointHistory: appointHistory); if (_feedbackService.hasError) { error = _feedbackService.error; setState(ViewState.ErrorLocal); @@ -61,7 +39,18 @@ class FeedbackViewModel extends BaseViewModel { } } - Future getPatentAppointmentHistory() async { + searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async { + setState(ViewState.Busy); + await _feedbackService.searchFeedback(countryCode, phoneNumber, type, idNumber); + if (_feedbackService.hasError) { + error = _feedbackService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatentAppointmentHistory() async { setState(ViewState.Busy); await _feedbackService.getPatentAppointmentHistory(); if (_feedbackService.hasError) { diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index 234db5d4..a04bbb39 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update_model.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:flutter/material.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -72,9 +73,9 @@ class InsuranceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - Future uploadInsuranceCard({String patientIdentificationID, int patientID,String image =""}) async { + Future uploadInsuranceCard(BuildContext context, {String patientIdentificationID, int patientID,String image =""}) async { setState(ViewState.BusyLocal); - await _insuranceCardService.uploadInsuranceCard(patientIdentificationID: patientIdentificationID,patientID: patientID,image: image); + await _insuranceCardService.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID,patientID: patientID,image: image); if (_insuranceCardService.hasError) { error = _insuranceCardService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart index 455b5934..ada4da78 100644 --- a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart +++ b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart @@ -7,46 +7,32 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; class PrescriptionDeliveryViewModel extends BaseViewModel { - CustomerAddressesService _customerAddressesService = - locator(); - PharmacyModuleService _pharmacyModuleService = - locator(); - PrescriptionDeliveryService _prescriptionDeliveryService = - locator(); + CustomerAddressesService _customerAddressesService = locator(); + PharmacyModuleService _pharmacyModuleService = locator(); + PrescriptionDeliveryService _prescriptionDeliveryService = locator(); - List get addressesList => - _customerAddressesService.addressesList; + List get addressesList => _customerAddressesService.addressesList; Future getCustomerInfo() async { setState(ViewState.Busy); await _pharmacyModuleService.generatePharmacyToken().then((value) async { - await _customerAddressesService.getCustomerInfo(); + // await _customerAddressesService.getCustomerInfo(); + // await _customerAddressesService.getCustomerInfo(); + await _pharmacyModuleService.createUser(); }); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); - } else { - await getCustomerAddresses(); - } + } else {} + await getCustomerAddresses(); } - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { - + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { setState(ViewState.BusyLocal); - await _prescriptionDeliveryService.insertDeliveryOrder( - lineItemNo: lineItemNo, - latitude: latitude, - longitude: longitude, - appointmentNo: appointmentNo, - createdBy: createdBy, - dischargeID: dischargeID - ); + // await _prescriptionDeliveryService.insertDeliveryOrder( + // lineItemNo: lineItemNo, latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); + await _prescriptionDeliveryService.insertDeliveryOrderRC( + latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); if (_prescriptionDeliveryService.hasError) { error = _prescriptionDeliveryService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index 629df0a9..d060db1f 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/AskDoctorReqTypes.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; @@ -6,51 +7,40 @@ import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class AskDoctorViewModel extends BaseViewModel { AskDoctorService _askDoctorService = locator(); MyDoctorService _myDoctorService = locator(); - List patientDoctorAppointmentListHospital = - List(); + List patientDoctorAppointmentListHospital = List(); - List get askDoctorReqTypes => - _askDoctorService.askDoctorReqTypes; + List get askDoctorReqTypes => _askDoctorService.askDoctorReqTypes; - List get doctorResponseList => - _askDoctorService.doctorResponseList; + List get doctorResponseList => _askDoctorService.doctorResponseList; Future getMyDoctor() async { setState(ViewState.Busy); - await _myDoctorService.getPatientDoctorAppointmentList( - top: 25, beforeDays: 15); + await _myDoctorService.getPatientDoctorAppointmentList(top: 25, beforeDays: 15); if (_myDoctorService.hasError) { error = _myDoctorService.error; setState(ViewState.Error); - } else - var asd = ""; - _myDoctorService.patientDoctorAppointmentList.forEach((element) { - List doctorByClinic = - patientDoctorAppointmentListHospital - .where((elementClinic) => - elementClinic.filterName == element.projectName) - .toList(); - - if (doctorByClinic.length != 0) { - patientDoctorAppointmentListHospital[ - patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])] - .patientDoctorAppointmentList - .add(element); - } else { - patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList( - filterName: element.projectName, - patientDoctorAppointment: element)); - } + } else if (_myDoctorService.patientDoctorAppointmentList.length != 0) { + _myDoctorService.patientDoctorAppointmentList.forEach((element) { + List doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); + if (doctorByClinic.length != 0) { + patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); + } else { + patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + } + setState(ViewState.Idle); + }); + } else { setState(ViewState.Idle); - }); + // AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).askDocEmpty); + } } Future getCallRequestTypeLOVs() async { @@ -66,8 +56,7 @@ class AskDoctorViewModel extends BaseViewModel { Future getCallInfoHoursResult({int projectId, int doctorId}) async { setState(ViewState.Busy); - await _askDoctorService.getCallInfoHoursResult( - projectId: projectId, doctorId: doctorId); + await _askDoctorService.getCallInfoHoursResult(projectId: projectId, doctorId: doctorId); if (_askDoctorService.hasError) { error = _askDoctorService.error; setState(ViewState.ErrorLocal); @@ -95,11 +84,9 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future sendRequestLOV( - {DoctorList doctorList, String requestType, String remark}) async { + Future sendRequestLOV({DoctorList doctorList, String requestType, String remark}) async { setState(ViewState.BusyLocal); - await _askDoctorService.sendRequestLOV( - doctorList: doctorList, requestType: requestType, remark: remark); + await _askDoctorService.sendRequestLOV(doctorList: doctorList, requestType: requestType, remark: remark); if (_askDoctorService.hasError) { error = _askDoctorService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/blood_pressure_view_model.dart b/lib/core/viewModels/medical/blood_pressure_view_model.dart index 16a43a6f..548f4b62 100644 --- a/lib/core/viewModels/medical/blood_pressure_view_model.dart +++ b/lib/core/viewModels/medical/blood_pressure_view_model.dart @@ -34,31 +34,23 @@ class BloodPressureViewMode extends BaseViewModel { } else { clearDate(); bloodPressureService.weekDiabtectResultAverageList.forEach((element) { - weightWeekTimeSeriesDataTop - .add(TimeSeriesSales2(element.bloodPressureDate, element.dailyDiastolicPressureAverageResult.toDouble())); - weightWeekTimeSeriesDataLow - .add(TimeSeriesSales2(element.bloodPressureDate, element.dailySystolicePressureAverageResult.toDouble())); - - for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { - weighMonthTimeSeriesDataTop.add(TimeSeriesSales3( - index, - bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult - .toDouble())); - - weighMonthTimeSeriesDataLow.add(TimeSeriesSales3( - index, - bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult - .toDouble())); - } - - bloodPressureService.yearDiabtecResultAverageList.forEach((element) { - weightYearTimeSeriesDataTop - .add(TimeSeriesSales2(element.date, element.monthSystolicePressureAverageResult.toDouble())); - - weightYearTimeSeriesDataLow - .add(TimeSeriesSales2(element.date, element.monthDiastolicPressureAverageResult.toDouble())); - }); + weightWeekTimeSeriesDataTop.add(TimeSeriesSales2(element.bloodPressureDate, element.dailyDiastolicPressureAverageResult.toDouble())); + weightWeekTimeSeriesDataLow.add(TimeSeriesSales2(element.bloodPressureDate, element.dailySystolicePressureAverageResult.toDouble())); }); + + for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { + // weighMonthTimeSeriesDataTop.add(TimeSeriesSales3("Week " + (index + 1).toString(), bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + // weighMonthTimeSeriesDataLow.add(TimeSeriesSales3("Week " + (index + 1).toString(), bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + weighMonthTimeSeriesDataTop.add(TimeSeriesSales3(bloodPressureService.monthDiabtectResultAverageList[index].weekDesc, bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + weighMonthTimeSeriesDataLow.add(TimeSeriesSales3(bloodPressureService.monthDiabtectResultAverageList[index].weekDesc, bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + } + + bloodPressureService.yearDiabtecResultAverageList.forEach((element) { + weightYearTimeSeriesDataTop.add(TimeSeriesSales2(element.date, element.monthSystolicePressureAverageResult.toDouble())); + + weightYearTimeSeriesDataLow.add(TimeSeriesSales2(element.date, element.monthDiastolicPressureAverageResult.toDouble())); + }); + setState(ViewState.Idle); } } @@ -84,30 +76,17 @@ class BloodPressureViewMode extends BaseViewModel { } } - Future addORUpdateDiabtecResult( - {String bloodPressureDate, - String diastolicPressure, - String systolicePressure, - int measuredArm, - bool isUpdate = false}) async { + Future addORUpdateDiabtecResult({String bloodPressureDate, String diastolicPressure, String systolicePressure, int measuredArm, int lineItemNo, bool isUpdate = false}) async { setState(ViewState.BusyLocal); if (!isUpdate) - await bloodPressureService.addDiabtecResult( - bloodPressureDate: bloodPressureDate, - diastolicPressure: diastolicPressure, - systolicePressure: systolicePressure, - measuredArm: measuredArm); + await bloodPressureService.addDiabtecResult(bloodPressureDate: bloodPressureDate, diastolicPressure: diastolicPressure, systolicePressure: systolicePressure, measuredArm: measuredArm); else - await bloodPressureService.updateDiabtecResult( - bloodPressureDate: bloodPressureDate, - diastolicPressure: diastolicPressure, - systolicePressure: systolicePressure, - measuredArm: measuredArm); + await bloodPressureService.updateDiabtecResult(bloodPressureDate: bloodPressureDate, diastolicPressure: diastolicPressure, systolicePressure: systolicePressure, measuredArm: measuredArm, lineItemNo: lineItemNo); if (bloodPressureService.hasError) { error = bloodPressureService.error; setState(ViewState.ErrorLocal); } else { - await getBloodPressure(); + // await getBloodPressure(); setState(ViewState.Idle); } } diff --git a/lib/core/viewModels/medical/blood_sugar_view_model.dart b/lib/core/viewModels/medical/blood_sugar_view_model.dart index 28292311..29b9cfe2 100644 --- a/lib/core/viewModels/medical/blood_sugar_view_model.dart +++ b/lib/core/viewModels/medical/blood_sugar_view_model.dart @@ -1,10 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:charts_flutter/flutter.dart' as charts; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../core/viewModels/base_view_model.dart'; diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index f75abe88..8e61e3f3 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -6,6 +6,8 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_special_result.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -15,12 +17,12 @@ class LabsViewModel extends BaseViewModel { LabsService _labsService = locator(); List get labOrdersResultsList => _labsService.labOrdersResultsList; + List timeSeries = []; List _patientLabOrdersListClinic = List(); List _patientLabOrdersListHospital = List(); - List get patientLabOrdersList => - filterType == FilterType.Clinic ? _patientLabOrdersListClinic : _patientLabOrdersListHospital; + List get patientLabOrdersList => filterType == FilterType.Clinic ? _patientLabOrdersListClinic : _patientLabOrdersListHospital; void getLabs() async { if (authenticatedUserObject.isLogin) { @@ -31,17 +33,12 @@ class LabsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _labsService.patientLabOrdersList.forEach((element) { - List patientLabOrdersClinic = _patientLabOrdersListClinic - .where((elementClinic) => elementClinic.filterName == element.clinicDescription) - .toList(); + List patientLabOrdersClinic = _patientLabOrdersListClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList(); if (patientLabOrdersClinic.length != 0) { - _patientLabOrdersListClinic[_patientLabOrdersListClinic.indexOf(patientLabOrdersClinic[0])] - .patientLabOrdersList - .add(element); + _patientLabOrdersListClinic[_patientLabOrdersListClinic.indexOf(patientLabOrdersClinic[0])].patientLabOrdersList.add(element); } else { - _patientLabOrdersListClinic - .add(PatientLabOrdersList(filterName: element.clinicDescription, patientDoctorAppointment: element)); + _patientLabOrdersListClinic.add(PatientLabOrdersList(filterName: element.clinicDescription ?? element.projectName, patientDoctorAppointment: element)); } // doctor list sort via project @@ -52,12 +49,9 @@ class LabsViewModel extends BaseViewModel { .toList(); if (patientLabOrdersHospital.length != 0) { - _patientLabOrdersListHospital[_patientLabOrdersListHospital.indexOf(patientLabOrdersHospital[0])] - .patientLabOrdersList - .add(element); + _patientLabOrdersListHospital[_patientLabOrdersListHospital.indexOf(patientLabOrdersHospital[0])].patientLabOrdersList.add(element); } else { - _patientLabOrdersListHospital - .add(PatientLabOrdersList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientLabOrdersListHospital.add(PatientLabOrdersList(filterName: element.projectName ?? element.clinicDescription, patientDoctorAppointment: element)); } }); @@ -79,8 +73,7 @@ class LabsViewModel extends BaseViewModel { getLaboratoryResult({String projectID, int clinicID, String invoiceNo, String orderNo}) async { setState(ViewState.Busy); - await _labsService.getLaboratoryResult( - invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID); + await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -97,16 +90,14 @@ class LabsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = - labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); + List patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList(); if (patientLabOrdersClinic.length != 0) { var value = labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] .patientLabResultList .where((e) => e.sampleCollectedOn == element.sampleCollectedOn && e.resultValue == element.resultValue) .toList(); - if (value.isEmpty) - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList.add(element); + if (value.isEmpty) labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList.add(element); } else { labResultLists.add(LabResultList(filterName: element.testCode, lab: element)); } @@ -133,6 +124,12 @@ class LabsViewModel extends BaseViewModel { // if (isShouldClear) // // _labsService.labOrdersResultsList.clear(); + + _labsService.labOrdersResultsList.forEach((element) { + try { + timeSeries.add(new TimeSeriesSales2(DateUtil.convertStringToDate(element.verifiedOnDateTime), double.parse(element.resultValue))); + } catch (e) {} + }); setState(ViewState.Idle); } } diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index 647982d1..004f368b 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/medical_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -10,10 +9,8 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleR class MedicalViewModel extends BaseViewModel { MedicalService _medicalService = locator(); - List get appoitmentAllHistoryResultList => - _medicalService.appoitmentAllHistoryResultList; - List get getDoctorScheduleList => - _medicalService.doctorScheduleResponse; + List get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; + List get getDoctorScheduleList => _medicalService.doctorScheduleResponse; List get freeSlots => _medicalService.freeSlots; getAppointmentHistory() async { if (authenticatedUserObject.isLogin) { @@ -28,26 +25,26 @@ class MedicalViewModel extends BaseViewModel { } getDoctorSchedule(DoctorList doctorRequest) async { - if (authenticatedUserObject.isLogin) { - setState(ViewState.Busy); - await _medicalService.getSchedule(doctorRequest); - if (_medicalService.hasError) { - error = _medicalService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } + //if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + await _medicalService.getSchedule(doctorRequest); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + //} } getFreeSlots(DoctorList doctorRequest) async { - if (authenticatedUserObject.isLogin) { - setState(ViewState.Busy); - await _medicalService.getFreeSlot(doctorRequest); - if (_medicalService.hasError) { - error = _medicalService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } + //if (authenticatedUserObject.isLogin) { + setState(ViewState.Busy); + await _medicalService.getFreeSlot(doctorRequest); + if (_medicalService.hasError) { + error = _medicalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); } + //} } diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index ce9f35fa..e12e2b07 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -32,7 +32,7 @@ class MyBalanceViewModel extends BaseViewModel { _bloodDonationService.CitiesModelList; BloodDetailsService _bloodDetailsService = locator(); - List get BloodDetailsModelList => + List get bloodDetailsModelList => _bloodDetailsService .BloodModelList; //_bloodDonationService.CitiesModelList; @@ -52,6 +52,9 @@ class MyBalanceViewModel extends BaseViewModel { PatientInfoAndMobileNumber get patientInfoAndMobileNumber => _myBalanceService.patientInfoAndMobileNumber; + List get bloodModelList => + _bloodDetailsService.BloodModelList; + String get logInTokenID => _myBalanceService.logInTokenID; String get verificationCode => _myBalanceService.verificationCode; @@ -78,13 +81,15 @@ class MyBalanceViewModel extends BaseViewModel { } Future getCities() async { - setState(ViewState.Busy); - await _bloodDonationService.getAllCitiesOrders(); - if (_bloodDonationService.hasError) { - error = _bloodDonationService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + if(isLogin) { + setState(ViewState.Busy); + await _bloodDonationService.getAllCitiesOrders(); + if (_bloodDonationService.hasError) { + error = _bloodDonationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } Future getBlood() async { diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 2fe174e5..f480fb56 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -1,10 +1,13 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_info_rc_model.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/cupertino.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; + import '../../../core/enum/filter_type.dart'; import '../../../core/enum/viewstate.dart'; import '../../../core/model/prescriptions/Prescriptions.dart'; @@ -25,13 +28,21 @@ class PrescriptionsViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionsService.prescriptionsList; - List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; + List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; - List get prescriptionsOrderList => - filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; + List get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList; + + List get prescriptionsOrderListRC => _prescriptionsService.prescriptionsOrderListRC; + + List get prescriptionsOrderList => filterType == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; + + List prescriptionsOrderListByValue(filterValue) { + return filterValue == FilterType.Clinic ? _prescriptionsOrderListClinic : _prescriptionsOrderListHospital; + } + get isMedDeliveryAllowed => _prescriptionsService.isMedDeliveryAllowed; getPrescriptions() async { setState(ViewState.Busy); await _prescriptionsService.getPrescriptions(); @@ -40,7 +51,7 @@ class PrescriptionsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - await _getPrescriptionsOrders(); +// await getPrescriptionsOrders(); setState(ViewState.Idle); } } @@ -48,17 +59,12 @@ class PrescriptionsViewModel extends BaseViewModel { void _filterList() { _prescriptionsService.prescriptionsList.forEach((element) { /// PrescriptionsList list sort clinic - List prescriptionsByClinic = _prescriptionsOrderListClinic - .where((elementClinic) => elementClinic.filterName == element.clinicDescription) - .toList(); + List prescriptionsByClinic = _prescriptionsOrderListClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList(); if (prescriptionsByClinic.length != 0) { - _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])] - .prescriptionsList - .add(element); + _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])].prescriptionsList.add(element); } else { - _prescriptionsOrderListClinic - .add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element)); + _prescriptionsOrderListClinic.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element)); } /// PrescriptionsList list sort via hospital @@ -69,23 +75,25 @@ class PrescriptionsViewModel extends BaseViewModel { .toList(); if (prescriptionsByHospital.length != 0) { - _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])] - .prescriptionsList - .add(element); + _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])].prescriptionsList.add(element); } else { _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element)); } }); } - _getPrescriptionsOrders() async { - await _prescriptionsService.getPrescriptionsOrders(); - if (_prescriptionsService.hasError) { - error = _prescriptionsService.error; - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Idle); - } + getPrescriptionsOrders({bool showLoading = false}) async { + setState(ViewState.Busy); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + // await _prescriptionsService.getPrescriptionsOrders(); + await _prescriptionsService.getPrescriptionsOrdersRC(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + }); } setFilterType(FilterType filterType) { @@ -104,17 +112,9 @@ class PrescriptionsViewModel extends BaseViewModel { } } - sendPrescriptionEmail( - {String appointmentDate, - int patientID, - String clinicName, - String doctorName, - int doctorID, - String mes, - int projectID}) async { + sendPrescriptionEmail({String appointmentDate, int patientID, String clinicName, String doctorName, int doctorID, String mes, int projectID}) async { setState(ViewState.BusyLocal); - await _prescriptionsService.sendPrescriptionEmail( - appointmentDate, patientID, clinicName, doctorName, doctorID, projectID); + await _prescriptionsService.sendPrescriptionEmail(appointmentDate, patientID, clinicName, doctorName, doctorID, projectID); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.ErrorLocal); @@ -136,8 +136,6 @@ class PrescriptionsViewModel extends BaseViewModel { } } - List get prescriptionReportEnhList => _prescriptionsService.prescriptionReportEnhList; - getPrescriptionReportEnh({PrescriptionsOrder prescriptionsOrder}) async { setState(ViewState.Busy); await _prescriptionsService.getPrescriptionReportEnh(prescriptionsOrder: prescriptionsOrder); @@ -149,9 +147,21 @@ class PrescriptionsViewModel extends BaseViewModel { } } + getPrescriptionReportDetailsRC() async { + setState(ViewState.Busy); + await _prescriptionsService.getPrescriptionsInfoRC(4, 2001273); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + Future updatePressOrder({@required int presOrderID}) async { setState(ViewState.Busy); - await _prescriptionsService.updatePressOrder(presOrderID: presOrderID); + // await _prescriptionsService.updatePressOrder(presOrderID: presOrderID); + await _prescriptionsService.updatePressOrderRC(presOrderID: presOrderID); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/medical/reports_monthly_view_model.dart b/lib/core/viewModels/medical/reports_monthly_view_model.dart index 15ac9219..a9117172 100644 --- a/lib/core/viewModels/medical/reports_monthly_view_model.dart +++ b/lib/core/viewModels/medical/reports_monthly_view_model.dart @@ -1,9 +1,7 @@ -import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import '../../../core/enum/reportfilter_type.dart'; import '../../../core/enum/viewstate.dart'; -import '../../../core/model/reports/Reports.dart'; import '../../../core/service/medical/reports_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/medical/weight_pressure_view_model.dart b/lib/core/viewModels/medical/weight_pressure_view_model.dart index 4a01bd3b..11684472 100644 --- a/lib/core/viewModels/medical/weight_pressure_view_model.dart +++ b/lib/core/viewModels/medical/weight_pressure_view_model.dart @@ -1,14 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; -import 'package:diplomaticquarterapp/core/service/medical/BloodPressureService.dart'; -import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart'; import 'package:diplomaticquarterapp/core/service/medical/WeightPressureService.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:charts_flutter/flutter.dart' as charts; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import '../../../core/viewModels/base_view_model.dart'; diff --git a/lib/core/viewModels/notifications_view_model.dart b/lib/core/viewModels/notifications_view_model.dart index ac09e3b2..80e89edb 100644 --- a/lib/core/viewModels/notifications_view_model.dart +++ b/lib/core/viewModels/notifications_view_model.dart @@ -1,40 +1,48 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/mark_message_as_read_request_model.dart'; import 'package:diplomaticquarterapp/core/service/notifications_service.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class NotificationViewModel extends BaseViewModel { NotificationService _notificationService = locator(); + ToDoCountProviderModel model = Provider.of(AppGlobal.context); - List get notifications => - _notificationService.notificationsList; + List get notifications => _notificationService.notificationsList; - Future getNotifications( - GetNotificationsRequestModel getNotificationsRequestModel, BuildContext context) async { - if(getNotificationsRequestModel.currentPage == 0) - setState(ViewState.Busy); + Future getNotifications(GetNotificationsRequestModel getNotificationsRequestModel, BuildContext context) async { + if (getNotificationsRequestModel.currentPage == 0) setState(ViewState.Busy); - await _notificationService - .getAllNotifications(getNotificationsRequestModel); + await _notificationService.getAllNotifications(getNotificationsRequestModel); if (_notificationService.hasError) { error = _notificationService.error; - setState(ViewState.Error); + setState(ViewState.Error); } else { - setState(ViewState.Idle); + setState(ViewState.Idle); } } Future markAsRead(id) async { // setState(ViewState.Busy); - MarkMessageAsReadRequestModel markMessageAsReadRequestModel = - new MarkMessageAsReadRequestModel(notificationPoolID: id); + MarkMessageAsReadRequestModel markMessageAsReadRequestModel = new MarkMessageAsReadRequestModel(notificationPoolID: id); + final authService = new AuthProvider(); await _notificationService.markAsRead(markMessageAsReadRequestModel); - setState(ViewState.Idle); + await authService.getDashboard().then((value) { + var notificationCount = ''; + notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + model.setState(model.count, true, notificationCount); + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + + }); + setState(ViewState.Idle); } -} \ No newline at end of file +} diff --git a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart index 1029ed4d..af750eab 100644 --- a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart +++ b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart @@ -1,13 +1,11 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; -import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:flutter/cupertino.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; class OfferCategoriesViewModel extends BaseViewModel{ OffersAndPackagesServices service = locator(); @@ -18,12 +16,14 @@ class OfferCategoriesViewModel extends BaseViewModel{ class PackagesViewModel extends BaseViewModel { OffersAndPackagesServices service = locator(); + List get categoryList => service.categoryList; List get productList => service.productList; List get latestOffersList => service.latestOffersList; List get bestSellerList => service.bestSellerList; List get bannersList => service.bannersList; List get cartItemList => service.cartItemList; + List get hospitals => service.hospitals; String _cartItemCount = ""; diff --git a/lib/core/viewModels/pharmacies_view_model.dart b/lib/core/viewModels/pharmacies_view_model.dart index b9e162fc..b14da6a4 100644 --- a/lib/core/viewModels/pharmacies_view_model.dart +++ b/lib/core/viewModels/pharmacies_view_model.dart @@ -1,10 +1,11 @@ -import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; -import '../../locator.dart'; -import 'base_view_model.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart'; +import '../../locator.dart'; +import 'base_view_model.dart'; + class PharmacyViewModel extends BaseViewModel { bool isFinished = true; bool hasError = false; diff --git a/lib/core/viewModels/pharmacyModule/MostViewedViewModel.dart b/lib/core/viewModels/pharmacyModule/MostViewedViewModel.dart new file mode 100644 index 00000000..a0f51038 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/MostViewedViewModel.dart @@ -0,0 +1,23 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +class MostViewedViewModel extends BaseViewModel { + PharmacyModuleService _pharmacyService = locator(); + + List get mostViewedProducts => + _pharmacyService.mostViewedProducts; + + getMostViewedProducts() async { + setState(ViewState.BusyLocal); + await _pharmacyService.getMostViewedProducts(); + // if (_pharmacyService.hasError) { + // error = _pharmacyService.error; + // setState(ViewState.Error); + // } else { + setState(ViewState.Idle); + // } + } +} diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index 4dd9ad26..e9f2a3d4 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; @@ -9,8 +8,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -20,19 +17,17 @@ class OrderPreviewViewModel extends BaseViewModel { List get addresses => _orderService.addresses; - LacumAccountInformation get lacumInformation => - _orderService.lacumInformation; + LacumAccountInformation get lacumInformation => _orderService.lacumInformation; List get orderListModel => _orderService.orderList; - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); ShoppingCartResponse cartResponse = ShoppingCartResponse(); PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); double totalAdditionalShippingCharge = 0; - setShoppingCartResponse(ShoppingCartResponse cart){ + setShoppingCartResponse(ShoppingCartResponse cart) { cartResponse = cart; notifyListeners(); } @@ -72,27 +67,27 @@ class OrderPreviewViewModel extends BaseViewModel { } } - Future changeProductQuantity( - ShoppingCart product) async { - setState(ViewState.Busy); + Future changeProductQuantity(ShoppingCart product) async { + setState(ViewState.BusyLocal); var resp = await _orderService.changeProductQuantity(product.id, product); - var object = _handleGetShoppingCartResponse(resp); + if (_orderService.hasError) { error = _orderService.error; setState(ViewState.ErrorLocal); } else { + var object = _handleGetShoppingCartResponse(resp); setState(ViewState.Idle); } - return object; + // return object; } Future deleteProduct(ShoppingCart product) async { - setState(ViewState.Busy); + setState(ViewState.BusyLocal); var resp = await _orderService.deleteProduct(product.id); var object = _handleGetShoppingCartResponse(resp); if (_orderService.hasError) { error = _orderService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } @@ -113,13 +108,13 @@ class OrderPreviewViewModel extends BaseViewModel { } ShoppingCartResponse _handleGetShoppingCartResponse(Map res) { + cartResponse.totalAmount = 0.0; totalAdditionalShippingCharge = 0; if (res == null) { error = "response is null"; setState(ViewState.Error); return null; } - print(res); cartResponse.itemCount = res["item_count"]; cartResponse.quantityCount = res["quantity_count"]; cartResponse.subtotal = res["subtotal"]; @@ -127,12 +122,19 @@ class OrderPreviewViewModel extends BaseViewModel { cartResponse.subtotalVatAmount = res["subtotal_vat_amount"]; cartResponse.subtotalVatRate = res["subtotal_vat_rate"]; cartResponse.shoppingCarts = List(); + + if (paymentCheckoutData.shippingOption != null) { + totalAdditionalShippingCharge = paymentCheckoutData.shippingOption.rate; + cartResponse.subtotalVatAmount += paymentCheckoutData.shippingOption.rateVat; + cartResponse.totalAmount += (paymentCheckoutData.shippingOption.rate + paymentCheckoutData.shippingOption.rateVat); + } + res["shopping_carts"].forEach((item) { ShoppingCart shoppingCart = ShoppingCart.fromJson(item); cartResponse.shoppingCarts.add(shoppingCart); - totalAdditionalShippingCharge += - shoppingCart.product.additionalShippingCharge; + totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; }); + if (paymentCheckoutData.shippingOption != null) cartResponse.totalAmount = (cartResponse.subtotalWithVat + totalAdditionalShippingCharge + paymentCheckoutData.shippingOption.rateVat); return cartResponse; } @@ -163,28 +165,27 @@ class OrderPreviewViewModel extends BaseViewModel { return _orderService.getPaymentOptionName(paymentOption); } - getInformationsByAddress() async { - await getLacumAccountInformation(); + getInformationsByAddress(String identificationNo) async { await getShippingOption(); + await getLacumAccountInformation(identificationNo); } - getLacumAccountInformation() async { + getLacumAccountInformation(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getLacumAccountInformation(); + await _orderService.getLacumAccountInformation(identificationNo); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); } else { - getLacumGroupData(); + if (_orderService.lacumInformation.yahalaAccountNo != 0) getLacumGroupData(identificationNo); } } - Future getLacumGroupData() async { + Future getLacumGroupData(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getLacumGroupInformation(); + await _orderService.getLacumGroupInformation(identificationNo); paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; - paymentCheckoutData.usedLakumPoints = paymentCheckoutData - .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; + paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); @@ -195,9 +196,7 @@ class OrderPreviewViewModel extends BaseViewModel { getShippingOption() async { setState(ViewState.Busy); - await _orderService - .getShippingOption(paymentCheckoutData.address) - .then((res) { + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); setState(ViewState.Idle); }); @@ -213,8 +212,7 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Busy); await pharmacyModuleViewModel.generatePharmacyToken(); - await _orderService.makeOrder( - paymentCheckoutData, cartResponse.shoppingCarts); + await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.ErrorLocal); @@ -235,4 +233,4 @@ class OrderPreviewViewModel extends BaseViewModel { } } -enum PaymentOption { meda, sadad, visa, mastercard, installments } +enum PaymentOption { meda, sadad, visa, mastercard, installments, applepay } diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 485c92fb..b6420c9c 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -2,18 +2,19 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; + import '../../../locator.dart'; import '../base_view_model.dart'; class PharmacyAddressesViewModel extends BaseViewModel { - PharmacyAddressService _pharmacyAddressService = - locator(); + PharmacyAddressService _pharmacyAddressService = locator(); - List get addresses => _pharmacyAddressService.addresses; + List get addresses => _pharmacyAddressService.addresses; int get selectedAddressIndex => _pharmacyAddressService.selectedAddressIndex; @@ -34,24 +35,13 @@ class PharmacyAddressesViewModel extends BaseViewModel { } } -/* Future getCountries(String countryName) async { + Future addEditAddress(PickResult value, AddressInfo editedAddress) async { setState(ViewState.Busy); - await _pharmacyAddressService.getCountries(countryName); - if (_pharmacyAddressService.hasError) { - error = _pharmacyAddressService.error; - // setState(ViewState.Error); - } else { - // setState(ViewState.Idle); - } - }*/ - Future addEditAddress(PickResult value, Addresses editedAddress) async { - setState(ViewState.Busy); - - Addresses sendingAddress; + AddressInfo sendingAddress; if (editedAddress == null) { - sendingAddress = Addresses(); + sendingAddress = AddressInfo(); sendingAddress.id = "0"; sendingAddress.firstName = user.firstName; sendingAddress.lastName = user.lastName; @@ -87,20 +77,24 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.createdOnUtc = DateTime.now().toString(); if (editedAddress == null) { + + ///TODO Fatima* await _pharmacyAddressService.addCustomerAddress(sendingAddress); + } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress); } if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; + Utils.showErrorToast(error); setState(ViewState.Error); } else { setState(ViewState.Idle); } } - Future deleteAddresses(Addresses sendingAddress) async { + Future deleteAddresses(AddressInfo sendingAddress) async { setState(ViewState.Busy); await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); if (_pharmacyAddressService.hasError) { @@ -111,7 +105,7 @@ class PharmacyAddressesViewModel extends BaseViewModel { } } - Future saveSelectedAddressLocally(Addresses selectedAddress) async { + Future saveSelectedAddressLocally(AddressInfo selectedAddress) async { await sharedPref.setObject(PHARMACY_SELECTED_ADDRESS, selectedAddress); } } diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 86a320e6..ba71781f 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -1,5 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; @@ -14,7 +14,8 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); - if(prescriptionsList.isNotEmpty){ + prescriptionsList.clear(); + if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); if (_prescriptionService.hasError) { diff --git a/lib/core/viewModels/pharmacyModule/brand_view_model.dart b/lib/core/viewModels/pharmacyModule/brand_view_model.dart index c981b2b3..6c2a00fc 100644 --- a/lib/core/viewModels/pharmacyModule/brand_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/brand_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/models/pharmacy/brandModel.dart'; @@ -23,6 +24,7 @@ class BrandsViewModel extends BaseViewModel{ Future getBrandsData() async { hasError = false; setState(ViewState.Busy); + await _brandsService.getBrands(); if (_brandsService.hasError) { error = _brandsService.error; diff --git a/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart index f2ed5913..49e8df6c 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-registration-service.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-transfer-service.dart'; import '../../../locator.dart'; import 'lacum-viewmodel.dart'; diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart index 1ee1a41c..c03e8e87 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -1,11 +1,11 @@ +import 'dart:async'; +import 'dart:convert' as convert; import 'dart:typed_data'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-service.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'dart:async'; -import 'dart:convert' as convert; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index 5b1c67f2..fe5be016 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -4,14 +4,15 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformati import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; + import '../../../locator.dart'; import '../base_view_model.dart'; @@ -37,7 +38,6 @@ class OrderModelViewModel extends BaseViewModel { Future getOrder(customerId, pageID) async { - print("this is customer id" + customerId); setState(ViewState.Busy); await _orderService.getOrder(customerId, pageID); if (_orderService.hasError) { @@ -74,13 +74,12 @@ class OrderModelViewModel extends BaseViewModel { } Future getCanceledOrder(order, context) async { - print("this is order id" + order); setState(ViewState.Busy); dynamic res; await _cancelOrderService.getCanceledOrder(order).then((value) { res = value['success']['SuccessEndUserMsg']; - print(value['success']['SuccessEndUserMsg']); - AppToast.showSuccessToast(message: "Request Sent Successfully"); + // AppToast.showSuccessToast(message: "Request Sent Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); // Navigator.pop(context); }); if (_cancelOrderService.hasError) { @@ -98,7 +97,7 @@ class OrderModelViewModel extends BaseViewModel { return res; } - Future makeReview(PharmacyProduct product, double rating, String reviewText) async { + Future makeReview(PharmacyProduct product, double rating, String reviewText, context) async { setState(ViewState.Busy); await _orderDetailsService.makeReview(product, rating, reviewText); if (_orderDetailsService.hasError) { @@ -107,8 +106,9 @@ class OrderModelViewModel extends BaseViewModel { AppToast.showErrorToast(message: error); } else { setState(ViewState.Idle); - AppToast.showSuccessToast( - message: "Your review has been Submitted successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).submitReview); + // AppToast.showSuccessToast( + // message: "Your review has been Submitted successfully"); } } diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index facccf1e..27fe3234 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -1,16 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; //import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; @@ -20,13 +16,11 @@ import '../../../locator.dart'; class PharmacyModuleViewModel extends BaseViewModel { PharmacyModuleService _pharmacyService = locator(); - RecommendedProductService _recommendedProductService = - locator(); + RecommendedProductService _recommendedProductService = locator(); List get bannerList => _pharmacyService.bannerItems; - List get recommendedProductList => - _recommendedProductService.recommendedList; + List get recommendedProductList => _recommendedProductService.recommendedList; Future generatePharmacyToken() async { setState(ViewState.Busy); @@ -40,8 +34,6 @@ class PharmacyModuleViewModel extends BaseViewModel { } Future verifyCustomer() async { - // if (authenticatedUserObject.isLogin) await generatePharmacyToken(); - var data = await sharedPref.getObject(USER_PROFILE); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); @@ -70,11 +62,9 @@ class PharmacyModuleViewModel extends BaseViewModel { Future getBannerList() async { if (bannerList.isEmpty) { - GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); await _pharmacyService.getBannerListList(); - GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_pharmacyService.hasError) { error = _pharmacyService.error; setState(ViewState.Error); @@ -83,9 +73,15 @@ class PharmacyModuleViewModel extends BaseViewModel { } } - List getBannerImagesUrl() { + List getBannerImagesUrl(ProjectViewModel projectViewModel) { List images = List(); images.add('assets/images/pharmacy_module/pharmacy_logo_green.png'); + + if (projectViewModel.isArabic) + images.add('assets/images/pharmacy_module/offers_banner_ar.png'); + else + images.add('assets/images/pharmacy_module/offers_banner.png'); + _pharmacyService.bannerItems.forEach((element) { images.add(element.src); }); diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 98596ee0..df895e28 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -1,21 +1,20 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../locator.dart'; -class ProductDetailViewModel extends BaseViewModel{ +class ProductDetailViewModel extends BaseViewModel { ProductDetailService _productDetailService = locator(); List get productDetailService => _productDetailService.productDetailList; @@ -28,6 +27,13 @@ class ProductDetailViewModel extends BaseViewModel{ bool hasError = false; + num get stockQuantity => _productDetailService.stockQuantity; + + String get stockAvailability => _productDetailService.stockAvailability; + + String get stockAvailabilityn => _productDetailService.stockAvailabilityn; + + bool get isStockAvailable => _productDetailService.isStockAvailable; Future getProductReviewsData(productID) async { hasError = false; @@ -40,10 +46,10 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - Future getProductLocationData() async { + Future getProductLocationData(String productSKU) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.getProductAvailabiltyDetail(); + await _productDetailService.getProductAvailabiltyDetail(productSKU); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -51,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - Future notifyMe(customerId, itemID) async { + Future notifyMe(customerId, itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.notifyMe(customerId, itemID); + await _productDetailService.notifyMe(customerId, itemID, context); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -62,18 +68,17 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - Future addToCartData(quantity, itemID) async { + Future addToCartData(quantity, itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - var resp = await _productDetailService.addToCart(quantity, itemID); + var resp = await _productDetailService.addToCart(quantity, itemID, context); ShoppingCartResponse object = _handleGetShoppingCartResponse(resp); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); - Provider.of(locator().navigatorKey.currentContext, listen: false) - .setShoppingCartResponse( object); + Provider.of(locator().navigatorKey.currentContext, listen: false).setShoppingCartResponse(object); } } @@ -100,14 +105,12 @@ class ProductDetailViewModel extends BaseViewModel{ return cartResponse; } - Future addToWishlistData(itemID) async { + Future addToWishlistData(itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); - await _productDetailService.addToWishlist(itemID); - GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); + await _productDetailService.addToWishlist(itemID, context); + GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -127,15 +130,12 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - - Future deleteWishlistData(itemID) async { + Future deleteWishlistData(itemID, context) async { hasError = false; setState(ViewState.BusyLocal); - GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); - await _productDetailService.deleteItemFromWishlist(itemID); - GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); + await _productDetailService.deleteItemFromWishlist(itemID, context); + GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -144,7 +144,6 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - Future productSpecificationData(itemID) async { hasError = false; setState(ViewState.Busy); @@ -156,10 +155,7 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } - clearReview(){ - + clearReview() { productDetailService.clear(); - } - -} \ No newline at end of file +} diff --git a/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart index 6a5bd476..a91b2c54 100644 --- a/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart @@ -1,7 +1,8 @@ +import 'dart:async'; + import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/terms-condition-service.dart'; -import 'dart:async'; import '../../../locator.dart'; import '../base_view_model.dart'; diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index 4b5687fc..fcae18d2 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -1,36 +1,47 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart'; -import 'package:diplomaticquarterapp/core/model/search_products_model.dart'; - import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; import 'base_view_model.dart'; class PharmacyCategoriseViewModel extends BaseViewModel { bool hasError = false; - PharmacyCategoriseService _pharmacyCategoriseService = locator(); - List get categorise => _pharmacyCategoriseService.categoriseList; + int firstSubsetIndex = 0; + int inPatientPageSize = 20; + int lastSubsetIndex = 20; + + List filteredInPatientItems = List(); + List filteredMyInPatientItems = List(); + + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); + + List get categorise => + _pharmacyCategoriseService.categoriseList; - List get categoriseParent => _pharmacyCategoriseService.parentCategoriseList; + List get categoriseParent => + _pharmacyCategoriseService.parentCategoriseList; - List get parentProducts => _pharmacyCategoriseService.parentProductsList; + List get parentProducts => + _pharmacyCategoriseService.parentProductsList; - List get subCategorise => _pharmacyCategoriseService.subCategoriseList; + List get subCategorise => + _pharmacyCategoriseService.subCategoriseList; - List get subProducts => _pharmacyCategoriseService.subProductsList; + List get subProducts => + _pharmacyCategoriseService.subProductsList; - List get finalProducts => _pharmacyCategoriseService.finalProducts; - List get brandsList => _pharmacyCategoriseService.brandsList; + List get finalProducts => + _pharmacyCategoriseService.finalProducts; + List get brandsList => + _pharmacyCategoriseService.brandsList; List get searchList => _pharmacyCategoriseService.searchList; @@ -88,29 +99,37 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getCategoriseParent({String i}) async { + Future getCategoriseParent( + {String i, int pageIndex, bool isLoading, BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); + // GifLoaderDialogUtils.showMyDialog(context); await _pharmacyCategoriseService.getCategoriseParent(id: i); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else - await getParentProducts(i: i); - await getBrands(id: i); + await getBrands(id: i); + await getParentProducts( + i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); + // GifLoaderDialogUtils.showMyDialog(context); } - Future getParentProducts({String i}) async { + Future getParentProducts( + {String i, int pageIndex, bool isLoading, BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); - await _pharmacyCategoriseService.getParentProducts(id: i); + setState(ViewState.BusyLocal); + //GifLoaderDialogUtils.showMyDialog(context); + await _pharmacyCategoriseService.getParentProducts( + id: i, pageNumber: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + //GifLoaderDialogUtils.hideDialog(context); } Future getSubCategorise({String i}) async { @@ -149,11 +168,13 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getFilteredProducts({String categoryId, String brandId, String min, String max}) async { + Future getFilteredProducts( + {String categoryId, String brandId, String min, String max}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getFilteredProducts(categoryId: categoryId, brandId: brandId, max: max, min: min); + await _pharmacyCategoriseService.getFilteredProducts( + categoryId: categoryId, brandId: brandId, max: max, min: min); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); @@ -161,7 +182,8 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getFilteredSubProducts({String categoryId, String brandId, String min, String max}) async { + Future getFilteredSubProducts( + {String categoryId, String brandId, String min, String max}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); @@ -228,4 +250,27 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + addOnFilteredList() { + if (lastSubsetIndex < parentProducts.length) { + firstSubsetIndex = firstSubsetIndex + + (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 + ? parentProducts.length - lastSubsetIndex + : inPatientPageSize - 1); + lastSubsetIndex = lastSubsetIndex + + (parentProducts.length - lastSubsetIndex < inPatientPageSize - 1 + ? parentProducts.length - lastSubsetIndex + : inPatientPageSize - 1); + filteredInPatientItems + .addAll(parentProducts.sublist(firstSubsetIndex, lastSubsetIndex)); + setState(ViewState.Idle); + } + } + + removeOnFilteredList() { + if (lastSubsetIndex - inPatientPageSize - 1 > 0) { + filteredInPatientItems.removeAt(lastSubsetIndex - inPatientPageSize - 1); + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 2e6d1f29..ab2f931b 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -3,9 +3,7 @@ import 'dart:async'; import 'package:connectivity/connectivity.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; -import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/core/viewModels/qr_view_model.dart b/lib/core/viewModels/qr_view_model.dart index 9833d6c8..a4a08e3f 100644 --- a/lib/core/viewModels/qr_view_model.dart +++ b/lib/core/viewModels/qr_view_model.dart @@ -1,4 +1,5 @@ import 'dart:convert'; + import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; diff --git a/lib/core/viewModels/vaccine_view_model.dart b/lib/core/viewModels/vaccine_view_model.dart index 37b57da4..895b73a5 100644 --- a/lib/core/viewModels/vaccine_view_model.dart +++ b/lib/core/viewModels/vaccine_view_model.dart @@ -1,11 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart'; import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_item.dart'; +import 'package:diplomaticquarterapp/core/service/vaccine_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'base_view_model.dart'; import '../../locator.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart'; -import 'package:diplomaticquarterapp/core/service/vaccine_service.dart'; +import 'base_view_model.dart'; class VaccineViewModel extends BaseViewModel { bool hasError = false; diff --git a/lib/core/viewModels/weather/weather_view_model.dart b/lib/core/viewModels/weather/weather_view_model.dart index bb201843..f95bf0fd 100644 --- a/lib/core/viewModels/weather/weather_view_model.dart +++ b/lib/core/viewModels/weather/weather_view_model.dart @@ -1,11 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; - -import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; import 'package:diplomaticquarterapp/core/service/weather_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import '../../../locator.dart'; diff --git a/lib/extensions/list_extension.dart b/lib/extensions/list_extension.dart new file mode 100644 index 00000000..ef56ff07 --- /dev/null +++ b/lib/extensions/list_extension.dart @@ -0,0 +1,8 @@ +extension Unique on List { + List unique([Id Function(E element) id, bool inplace = true]) { + final ids = Set(); + var list = inplace ? this : List.from(this); + list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id)); + return list; + } +} \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart new file mode 100644 index 00000000..e1700bc5 --- /dev/null +++ b/lib/extensions/string_extensions.dart @@ -0,0 +1,6 @@ +extension CapExtension on String { + String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allInCaps => this.toUpperCase(); + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; +} diff --git a/lib/generated/json/OfferProductsResponseModel_helper.dart b/lib/generated/json/OfferProductsResponseModel_helper.dart index d180af67..ca402fc0 100644 --- a/lib/generated/json/OfferProductsResponseModel_helper.dart +++ b/lib/generated/json/OfferProductsResponseModel_helper.dart @@ -313,6 +313,12 @@ offerProductsResponseModelFromJson(PackagesResponseModel data, Map(); data.storeIds.addAll(json['store_ids']); } + + if (json['store_names'] != null) { + data.storeNames = new List(); + data.storeNames.addAll(json['store_names']); + } + if (json['manufacturer_ids'] != null) { data.manufacturerIds = json['manufacturer_ids']?.map((v) => v?.toInt())?.toList()?.cast(); } diff --git a/lib/generated/json/base/json_convert_content.dart b/lib/generated/json/base/json_convert_content.dart index ae4eadeb..1c785ef1 100644 --- a/lib/generated/json/base/json_convert_content.dart +++ b/lib/generated/json/base/json_convert_content.dart @@ -2,15 +2,15 @@ // ignore_for_file: camel_case_types // ignore_for_file: prefer_single_quotes +import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; // This file is automatically generated. DO NOT EDIT, all your changes would be lost. import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; -import 'package:diplomaticquarterapp/generated/json/OfferCategoriesResponseModel_helper.dart'; -import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; -import 'package:diplomaticquarterapp/generated/json/log_geo_zone_response_model_entity_helper.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; -import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper.dart'; -import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; import 'package:diplomaticquarterapp/generated/json/GeoZonesResponseModel_helper.dart'; +import 'package:diplomaticquarterapp/generated/json/OfferCategoriesResponseModel_helper.dart'; +import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper.dart'; +import 'package:diplomaticquarterapp/generated/json/log_geo_zone_response_model_entity_helper.dart'; class JsonConvert { T fromJson(Map json) { diff --git a/lib/locator.dart b/lib/locator.dart index 08e0a2ea..c0a8bd51 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -3,22 +3,23 @@ import 'package:diplomaticquarterapp/core/service/ancillary_orders_service.dart' import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/MostViewedViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/product_categories_view_model.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; // import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; // import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:get_it/get_it.dart'; @@ -47,6 +48,7 @@ import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/geofencing/GeofencingServices.dart'; import 'core/service/hospital_service.dart'; +import 'core/service/insurance_service.dart'; import 'core/service/medical/ActiveMedicationsService.dart'; import 'core/service/medical/AllergiesService.dart'; import 'core/service/medical/BloodPressureService.dart'; @@ -62,25 +64,25 @@ import 'core/service/medical/my_doctor_service.dart'; import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; +import 'core/service/medical/reports_service.dart'; import 'core/service/medical/vital_sign_service.dart'; +import 'core/service/notifications_service.dart'; +import 'core/service/offers_service.dart'; import 'core/service/packages_offers/PackagesOffersServices.dart'; import 'core/service/parmacyModule/lacum-registration-service.dart'; import 'core/service/parmacyModule/lacum-service.dart'; import 'core/service/parmacyModule/lacum-transfer-service.dart'; import 'core/service/parmacyModule/order-preview-service.dart'; -import 'core/service/notifications_service.dart'; +import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/parmacyModule/terms-condition-service.dart'; +import 'core/service/pharmacies_service.dart'; +import 'core/service/pharmacy_categorise_service.dart'; import 'core/service/privilege_service.dart'; import 'core/service/termsConditionsService.dart'; +import 'core/service/vaccine_service.dart'; import 'core/service/weather_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'core/service/parmacyModule/parmacy_module_service.dart'; - -import 'core/service/offers_service.dart'; -import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; -import 'core/viewModels/er/EdOnlineViewModel.dart'; -import 'core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'core/viewModels/TermsConditionsViewModel.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; @@ -91,63 +93,57 @@ import 'core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'core/viewModels/contactus/findus_view_model.dart'; import 'core/viewModels/contactus/livechat_view_model.dart'; +import 'core/viewModels/er/EdOnlineViewModel.dart'; import 'core/viewModels/er/am_request_view_model.dart'; import 'core/viewModels/er/near_hospital_view_model.dart'; +import 'core/viewModels/er/rrt-view-model.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; -import 'core/service/medical/reports_service.dart'; import 'core/viewModels/hospital_view_model.dart'; +import 'core/viewModels/insurance_card_View_model.dart'; import 'core/viewModels/medical/ActiveMedicationsViewModel.dart'; import 'core/viewModels/medical/AllergiesViewModel.dart'; import 'core/viewModels/medical/EyeViewModel.dart'; +import 'core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'core/viewModels/medical/ask_doctor_view_model.dart'; import 'core/viewModels/medical/blood_pressure_view_model.dart'; +import 'core/viewModels/medical/blood_sugar_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; import 'core/viewModels/medical/medical_view_model.dart'; import 'core/viewModels/medical/my_balance_view_model.dart'; import 'core/viewModels/medical/my_doctor_view_model.dart'; -import 'core/viewModels/medical/blood_sugar_view_model.dart'; import 'core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/medical/radiology_view_model.dart'; import 'core/viewModels/medical/reports_monthly_view_model.dart'; -import 'core/viewModels/medical/vital_sign_view_model.dart'; import 'core/viewModels/medical/reports_view_model.dart'; +import 'core/viewModels/medical/vital_sign_view_model.dart'; import 'core/viewModels/medical/weight_pressure_view_model.dart'; import 'core/viewModels/notifications_view_model.dart'; import 'core/viewModels/offers_Categorise_view_model.dart'; import 'core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'core/viewModels/pharmacies_view_model.dart'; -import 'core/service/pharmacies_service.dart'; -import 'core/service/insurance_service.dart'; -import 'core/viewModels/insurance_card_View_model.dart'; +import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'core/viewModels/pharmacyModule/BestSellerViewModel.dart'; import 'core/viewModels/pharmacyModule/BrandViewModel.dart'; import 'core/viewModels/pharmacyModule/LastVisitedViewModel.dart'; import 'core/viewModels/pharmacyModule/PrescriptionViewModel.dart'; import 'core/viewModels/pharmacyModule/brand_view_model.dart'; -import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; -import 'core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'core/viewModels/pharmacyModule/review_view_model.dart'; -import 'core/viewModels/pharmacyModule/wishlist_view_model.dart'; -import 'core/viewModels/qr_view_model.dart'; -import 'core/viewModels/er/rrt-view-model.dart'; -import 'core/viewModels/vaccine_view_model.dart'; -import 'core/service/vaccine_service.dart'; -import 'core/viewModels/weather/weather_view_model.dart'; -import 'services/pharmacy_services/brands_service.dart'; -import 'services/pharmacy_services/product_detail_service.dart'; -import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'core/viewModels/pharmacyModule/lacum-registration-viewModel.dart'; import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; import 'core/viewModels/pharmacyModule/lacum-viewmodel.dart'; import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'core/viewModels/pharmacyModule/review_view_model.dart'; import 'core/viewModels/pharmacyModule/tems-condition-viewmodel.dart'; +import 'core/viewModels/pharmacyModule/wishlist_view_model.dart'; import 'core/viewModels/pharmacy_categorise_view_model.dart'; import 'core/viewModels/qr_view_model.dart'; import 'core/viewModels/vaccine_view_model.dart'; -import 'core/service/vaccine_service.dart'; +import 'core/viewModels/weather/weather_view_model.dart'; +import 'services/pharmacy_services/brands_service.dart'; import 'services/pharmacy_services/orderDetails_service.dart'; import 'services/pharmacy_services/pharmacyAddress_service.dart'; +import 'services/pharmacy_services/product_detail_service.dart'; GetIt locator = GetIt.instance; @@ -310,6 +306,7 @@ void setupLocator() { locator.registerFactory(() => BrandViewModel()); locator.registerFactory(() => BestSellerViewModel()); locator.registerFactory(() => LastVisitedViewModel()); + locator.registerFactory(() => MostViewedViewModel()); // Offer And Packages //---------------------- diff --git a/lib/main.dart b/lib/main.dart index 12deb064..0dd18a2d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,24 +1,27 @@ -import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; -import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:in_app_update/in_app_update.dart'; import 'package:provider/provider.dart'; + import 'config/size_config.dart'; import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; -import 'package:firebase_core/firebase_core.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -34,11 +37,27 @@ class MyApp extends StatefulWidget { } class _MyApp extends State { + AppUpdateInfo _updateInfo; + + Future checkForUpdate() async { + InAppUpdate.checkForUpdate().then((info) { + if (info.updateAvailable) { + InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString())); + } + }).catchError((e) { + print(e.toString()); + }); + } + @override void initState() { // ProjectViewModel projectProvider; // projectProvider = Provider.of(context); // var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans'; + + // Re-enable once going live + // if (Platform.isAndroid) checkForUpdate(); + ThemeNotifier(defaultTheme()); super.initState(); } @@ -46,11 +65,15 @@ class _MyApp extends State { @override Widget build(BuildContext context) { PlatformBridge.init(context); + LocalNotification.init(onNotificationClick: (payload) { - LocalNotification.getInstance() - .showNow(title: "Payload", subtitle: payload, payload: payload); + LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); }); + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); // final themeNotifier = Provider.of(context); precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( @@ -66,27 +89,27 @@ class _MyApp extends State { ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), - ChangeNotifierProvider( - create: (context) => ToDoCountProviderModel()), - ChangeNotifierProvider( - create: (context) => SearchProvider()), + ChangeNotifierProvider( + create: (context) => DashboardViewModel(), + ), + ChangeNotifierProvider(create: (context) => ToDoCountProviderModel()), + ChangeNotifierProvider(create: (context) => SearchProvider()), ChangeNotifierProvider.value( value: SearchProvider(), ), - ChangeNotifierProvider( - create: (context) => ThemeNotifier(defaultTheme())), + ChangeNotifierProvider(create: (context) => ThemeNotifier(defaultTheme())), StreamProvider.value( value: RobotProvider().intStream(), initialData: RobotProvider().setValue({}), ), - ChangeNotifierProvider( - create: (context) => CompareList()), - ChangeNotifierProvider( - create: (context) => OrderPreviewViewModel()), + ChangeNotifierProvider(create: (context) => CompareList()), + ChangeNotifierProvider(create: (context) => OrderPreviewViewModel()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( - navigatorObservers: [GAnalytics.shared.navObserver()], + // navigatorObservers: [ + // GAnalytics.shared.navObserver() + // ], navigatorKey: locator().navigatorKey, showSemanticsDebugger: false, title: 'Diplomatic Quarter App', @@ -146,6 +169,7 @@ class _MyApp extends State { // ), // ), initialRoute: SPLASH, + // initialRoute: OPENTOK_CALL_PAGE, // initialRoute: PACKAGES_OFFERS, // initialRoute: PACKAGES_ORDER_COMPLETED, routes: routes, diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index 045f759e..a79767c5 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -39,6 +39,7 @@ class AppoitmentAllHistoryResultList { String doctorImageURL; String doctorNameObj; int doctorRate; + dynamic decimalDoctorRate; List doctorSpeciality; String doctorTitle; int gender; @@ -108,6 +109,7 @@ class AppoitmentAllHistoryResultList { this.doctorImageURL, this.doctorNameObj, this.doctorRate, + this.decimalDoctorRate, this.doctorSpeciality, this.doctorTitle, this.gender, @@ -176,6 +178,7 @@ class AppoitmentAllHistoryResultList { doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; doctorRate = json['DoctorRate']; + decimalDoctorRate = json['DecimalDoctorRate']; doctorSpeciality = json['DoctorSpeciality'] != null ? json['DoctorSpeciality'].cast() : ["null"]; @@ -250,6 +253,7 @@ class AppoitmentAllHistoryResultList { data['DoctorImageURL'] = this.doctorImageURL; data['DoctorNameObj'] = this.doctorNameObj; data['DoctorRate'] = this.doctorRate; + data['DecimalDoctorRate'] = this.decimalDoctorRate; data['DoctorSpeciality'] = this.doctorSpeciality; data['DoctorTitle'] = this.doctorTitle; data['Gender'] = this.gender; diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index a038aaf4..0da1a273 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -21,6 +21,7 @@ class DoctorList { bool isDoctorAllowVedioCall; bool isDoctorDummy; bool isLiveCare; + bool isLiveCareClinic; bool isDoctorHasPrePostImages; String latitude; String longitude; @@ -39,6 +40,7 @@ class DoctorList { String setupID; List speciality; dynamic workingHours; + dynamic decimalDoctorRate; DoctorList( {this.clinicID, @@ -63,6 +65,7 @@ class DoctorList { this.isDoctorAllowVedioCall, this.isDoctorDummy, this.isLiveCare, + this.isLiveCareClinic, this.isDoctorHasPrePostImages, this.latitude, this.longitude, @@ -80,7 +83,8 @@ class DoctorList { this.serviceID, this.setupID, this.speciality, - this.workingHours}); + this.workingHours, + this.decimalDoctorRate}); DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; @@ -105,6 +109,7 @@ class DoctorList { isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; isDoctorDummy = json['IsDoctorDummy']; isLiveCare = json['IsLiveCare']; + isLiveCareClinic = json['IsLiveCareClinic']; isDoctorHasPrePostImages = json['IsDoctorHasPrePostImages']; latitude = json['Latitude']; longitude = json['Longitude']; @@ -124,6 +129,7 @@ class DoctorList { if (json.containsKey('Speciality') && json['Speciality']!=null) speciality = json['Speciality'].cast(); workingHours = json['WorkingHours']; + decimalDoctorRate = json['DecimalDoctorRate']; } Map toJson() { @@ -150,6 +156,7 @@ class DoctorList { data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; data['IsDoctorDummy'] = this.isDoctorDummy; data['IsLiveCare'] = this.isLiveCare; + data['IsLiveCareClinic'] = this.isLiveCareClinic; data['IsDoctorHasPrePostImages'] = this.isDoctorHasPrePostImages; data['Latitude'] = this.latitude; data['Longitude'] = this.longitude; @@ -168,6 +175,7 @@ class DoctorList { data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; data['WorkingHours'] = this.workingHours; + data['DecimalDoctorRate'] = this.decimalDoctorRate; return data; } } diff --git a/lib/models/Appointments/DoctorProfile.dart b/lib/models/Appointments/DoctorProfile.dart index 9b2bc8e9..f96eb4d6 100644 --- a/lib/models/Appointments/DoctorProfile.dart +++ b/lib/models/Appointments/DoctorProfile.dart @@ -1,46 +1,47 @@ class DoctorProfileList { - int doctorID; + num doctorID; String doctorName; - Null doctorNameN; - int clinicID; + dynamic doctorNameN; + num clinicID; String clinicDescription; - Null clinicDescriptionN; - Null licenseExpiry; - int employmentType; - Null setupID; - int projectID; + dynamic clinicDescriptionN; + dynamic licenseExpiry; + num employmentType; + dynamic setupID; + num projectID; String projectName; String nationalityID; String nationalityName; - Null nationalityNameN; - int gender; + dynamic nationalityNameN; + num gender; String genderDescription; - Null genderDescriptionN; - Null doctorTitle; - Null projectNameN; + dynamic genderDescriptionN; + dynamic doctorTitle; + dynamic projectNameN; bool isAllowWaitList; String titleDescription; - Null titleDescriptionN; - Null isRegistered; - Null isDoctorDummy; + dynamic titleDescriptionN; + dynamic isRegistered; + dynamic isDoctorDummy; bool isActive; bool isDoctorHasPrePostImages; - Null isDoctorAppointmentDisplayed; + dynamic isDoctorAppointmentDisplayed; bool doctorClinicActive; - Null isbookingAllowed; + dynamic isbookingAllowed; String doctorCases; - Null doctorPicture; + dynamic doctorPicture; String doctorProfileInfo; List specialty; - int actualDoctorRate; + num actualDoctorRate; String doctorImageURL; - int doctorRate; + num doctorRate; + num decimalDoctorRate; String doctorTitleForProfile; bool isAppointmentAllowed; String nationalityFlagURL; - int noOfPatientsRate; + num noOfPatientsRate; String qR; - int serviceID; + num serviceID; DoctorProfileList( {this.doctorID, @@ -79,6 +80,7 @@ class DoctorProfileList { this.actualDoctorRate, this.doctorImageURL, this.doctorRate, + this.decimalDoctorRate, this.doctorTitleForProfile, this.isAppointmentAllowed, this.nationalityFlagURL, @@ -123,6 +125,7 @@ class DoctorProfileList { actualDoctorRate = json['ActualDoctorRate']; doctorImageURL = json['DoctorImageURL']; doctorRate = json['DoctorRate']; + decimalDoctorRate = json['DecimalDoctorRate']; doctorTitleForProfile = json['DoctorTitleForProfile']; isAppointmentAllowed = json['IsAppointmentAllowed']; nationalityFlagURL = json['NationalityFlagURL']; @@ -169,6 +172,7 @@ class DoctorProfileList { data['ActualDoctorRate'] = this.actualDoctorRate; data['DoctorImageURL'] = this.doctorImageURL; data['DoctorRate'] = this.doctorRate; + data['DecimalDoctorRate'] = this.decimalDoctorRate; data['DoctorTitleForProfile'] = this.doctorTitleForProfile; data['IsAppointmentAllowed'] = this.isAppointmentAllowed; data['NationalityFlagURL'] = this.nationalityFlagURL; diff --git a/lib/models/Appointments/DoctorRateDetails.dart b/lib/models/Appointments/DoctorRateDetails.dart index b29a5db9..58668856 100644 --- a/lib/models/Appointments/DoctorRateDetails.dart +++ b/lib/models/Appointments/DoctorRateDetails.dart @@ -4,13 +4,15 @@ class DoctorRateDetails { dynamic clinicID; dynamic rate; dynamic patientNumber; + dynamic ratio; DoctorRateDetails( {this.doctorID, this.projectID, this.clinicID, this.rate, - this.patientNumber}); + this.patientNumber, + this.ratio}); DoctorRateDetails.fromJson(Map json) { doctorID = json['DoctorID']; @@ -18,6 +20,7 @@ class DoctorRateDetails { clinicID = json['ClinicID']; rate = json['Rate']; patientNumber = json['PatientNumber']; + ratio = json['Ratio']; } Map toJson() { @@ -27,6 +30,7 @@ class DoctorRateDetails { data['ClinicID'] = this.clinicID; data['Rate'] = this.rate; data['PatientNumber'] = this.patientNumber; + data['Ratio'] = this.ratio; return data; } } diff --git a/lib/models/Appointments/laser_body_parts.dart b/lib/models/Appointments/laser_body_parts.dart new file mode 100644 index 00000000..99896868 --- /dev/null +++ b/lib/models/Appointments/laser_body_parts.dart @@ -0,0 +1,64 @@ +class LaserBodyPart { + int id; + int category; + String bodyPart; + bool fullBoadyPart; + bool isRetouch; + String timeDuration; + String bodyPartN; + bool isActive; + String mappingCode; + int procedureID; + int orderNum; + String categoryName; + String categoryNameN; + + LaserBodyPart( + {this.id, + this.category, + this.bodyPart, + this.fullBoadyPart, + this.isRetouch, + this.timeDuration, + this.bodyPartN, + this.isActive, + this.mappingCode, + this.procedureID, + this.orderNum, + this.categoryName, + this.categoryNameN}); + + LaserBodyPart.fromJson(Map json) { + id = json['Id']; + category = json['Category']; + bodyPart = json['BodyPart']; + fullBoadyPart = json['FullBoadyPart']; + isRetouch = json['IsRetouch']; + timeDuration = json['TimeDuration']; + bodyPartN = json['BodyPartN']; + isActive = json['IsActive']; + mappingCode = json['MappingCode']; + procedureID = json['ProcedureID']; + orderNum = json['OrderNum']; + categoryName = json['CategoryName']; + categoryNameN = json['CategoryNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['Category'] = this.category; + data['BodyPart'] = this.bodyPart; + data['FullBoadyPart'] = this.fullBoadyPart; + data['IsRetouch'] = this.isRetouch; + data['TimeDuration'] = this.timeDuration; + data['BodyPartN'] = this.bodyPartN; + data['IsActive'] = this.isActive; + data['MappingCode'] = this.mappingCode; + data['ProcedureID'] = this.procedureID; + data['OrderNum'] = this.orderNum; + data['CategoryName'] = this.categoryName; + data['CategoryNameN'] = this.categoryNameN; + return data; + } +} diff --git a/lib/models/Appointments/toDoCountProviderModel.dart b/lib/models/Appointments/toDoCountProviderModel.dart index e44a0ebb..3363471f 100644 --- a/lib/models/Appointments/toDoCountProviderModel.dart +++ b/lib/models/Appointments/toDoCountProviderModel.dart @@ -2,15 +2,19 @@ import 'package:flutter/cupertino.dart'; class ToDoCountProviderModel with ChangeNotifier { int _count; + String _notificationsCount; bool _isShowBadge = false; int get count => _count == null ? 0 : _count; + String get notificationsCount => _notificationsCount == null ? "0" : _notificationsCount; + bool get isShowBadge => _isShowBadge; - void setState(int count, bool isShowBadge) { + void setState(int count, bool isShowBadge, String notifCount) { _count = count; _isShowBadge = isShowBadge; + _notificationsCount = notifCount; notifyListeners(); } -} +} \ No newline at end of file diff --git a/lib/models/Authentication/check_activation_code_request.dart b/lib/models/Authentication/check_activation_code_request.dart index af139ba5..f6509f3b 100644 --- a/lib/models/Authentication/check_activation_code_request.dart +++ b/lib/models/Authentication/check_activation_code_request.dart @@ -23,31 +23,33 @@ class CheckActivationCodeReq { bool isDentalAllowedBackend; int deviceTypeID; bool forRegisteration; - CheckActivationCodeReq( - {this.patientMobileNumber, - this.mobileNo, - this.deviceToken, - this.projectOutSA, - this.loginType, - this.zipCode, - this.isRegister, - this.logInTokenID, - this.searchType, - this.patientID, - this.nationalID, - this.patientIdentificationID, - this.activationCode, - this.isSilentLogin, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.forRegisteration}); + + CheckActivationCodeReq({ + this.patientMobileNumber, + this.mobileNo, + this.deviceToken, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.activationCode, + this.isSilentLogin, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.forRegisteration, + }); CheckActivationCodeReq.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -102,6 +104,7 @@ class CheckActivationCodeReq { data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; data['ForRegisteration'] = this.forRegisteration; + return data; } } diff --git a/lib/models/Authentication/check_activation_code_request_register.dart b/lib/models/Authentication/check_activation_code_request_register.dart new file mode 100644 index 00000000..c727c647 --- /dev/null +++ b/lib/models/Authentication/check_activation_code_request_register.dart @@ -0,0 +1,120 @@ +class CheckActivationCodeRegisterReq { + int patientMobileNumber; + String mobileNo; + String deviceToken; + bool projectOutSA; + int loginType; + String zipCode; + bool isRegister; + String logInTokenID; + int searchType; + int patientID; + String nationalID; + String patientIdentificationID; + String activationCode; + bool isSilentLogin; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + bool forRegisteration; + String dob; + int isHijri; + String healthId; + CheckActivationCodeRegisterReq({ + this.patientMobileNumber, + this.mobileNo, + this.deviceToken, + this.projectOutSA, + this.loginType, + this.zipCode, + this.isRegister, + this.logInTokenID, + this.searchType, + this.patientID, + this.nationalID, + this.patientIdentificationID, + this.activationCode, + this.isSilentLogin, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.forRegisteration, + this.dob, + this.isHijri, + this.healthId, + }); + + CheckActivationCodeRegisterReq.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + mobileNo = json['MobileNo']; + deviceToken = json['DeviceToken']; + projectOutSA = json['ProjectOutSA']; + loginType = json['LoginType']; + zipCode = json['ZipCode']; + isRegister = json['isRegister']; + logInTokenID = json['LogInTokenID']; + searchType = json['SearchType']; + patientID = json['PatientID']; + nationalID = json['NationalID']; + patientIdentificationID = json['PatientIdentificationID']; + activationCode = json['activationCode']; + isSilentLogin = json['IsSilentLogin']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + forRegisteration = json['ForRegisteration']; + dob = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['MobileNo'] = this.mobileNo; + data['DeviceToken'] = this.deviceToken; + data['ProjectOutSA'] = this.projectOutSA; + data['LoginType'] = this.loginType; + data['ZipCode'] = this.zipCode; + data['isRegister'] = this.isRegister; + data['LogInTokenID'] = this.logInTokenID; + data['SearchType'] = this.searchType; + data['PatientID'] = this.patientID; + data['NationalID'] = this.nationalID; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['activationCode'] = this.activationCode; + data['IsSilentLogin'] = this.isSilentLogin; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['ForRegisteration'] = this.forRegisteration; + data['DOB'] = dob; + data['IsHijri'] = isHijri; + data['HealthId'] = healthId; + return data; + } +} diff --git a/lib/models/Authentication/checkpatient_for_registration.dart b/lib/models/Authentication/checkpatient_for_registration.dart index 420b4adb..def8925f 100644 --- a/lib/models/Authentication/checkpatient_for_registration.dart +++ b/lib/models/Authentication/checkpatient_for_registration.dart @@ -14,6 +14,8 @@ class CheckPatientForRegistration { String tokenID; int patientID; bool isRegister; + String dob; + int isHijri; CheckPatientForRegistration( {this.patientIdentificationID, @@ -30,7 +32,9 @@ class CheckPatientForRegistration { this.deviceTypeID, this.tokenID, this.patientID, - this.isRegister}); + this.isRegister, + this.dob, + this.isHijri}); CheckPatientForRegistration.fromJson(Map json) { patientIdentificationID = json['PatientIdentificationID']; @@ -48,6 +52,8 @@ class CheckPatientForRegistration { tokenID = json['TokenID']; patientID = json['PatientID']; isRegister = json['isRegister']; + dob = json['DOB']; + isHijri = json['IsHijri']; } Map toJson() { @@ -67,6 +73,8 @@ class CheckPatientForRegistration { data['TokenID'] = this.tokenID; data['PatientID'] = this.patientID; data['isRegister'] = this.isRegister; + data['DOB'] = dob; + data['IsHijri'] = isHijri; return data; } } diff --git a/lib/models/Authentication/register_user_requet.dart b/lib/models/Authentication/register_user_requet.dart index 12e59d0a..63cb9e8a 100644 --- a/lib/models/Authentication/register_user_requet.dart +++ b/lib/models/Authentication/register_user_requet.dart @@ -1,7 +1,7 @@ class RegisterUserRequest { Patientobject patientobject; String patientIdentificationID; - int patientMobileNumber; + dynamic patientMobileNumber; String logInTokenID; double versionID; int channel; @@ -12,7 +12,10 @@ class RegisterUserRequest { Null sessionID; bool isDentalAllowedBackend; int deviceTypeID; - + String dob; + int isHijri; + String healthId; + String zipCode; RegisterUserRequest( {this.patientobject, this.patientIdentificationID, @@ -26,12 +29,14 @@ class RegisterUserRequest { this.patientOutSA, this.sessionID, this.isDentalAllowedBackend, - this.deviceTypeID}); + this.deviceTypeID, + this.dob, + this.isHijri, + this.healthId, + this.zipCode}); RegisterUserRequest.fromJson(Map json) { - patientobject = json['Patientobject'] != null - ? new Patientobject.fromJson(json['Patientobject']) - : null; + patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null; patientIdentificationID = json['PatientIdentificationID']; patientMobileNumber = json['PatientMobileNumber']; logInTokenID = json['LogInTokenID']; @@ -44,6 +49,10 @@ class RegisterUserRequest { sessionID = json['SessionID']; isDentalAllowedBackend = json['isDentalAllowedBackend']; deviceTypeID = json['DeviceTypeID']; + dob = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + zipCode = json['ZipCode']; } Map toJson() { @@ -63,6 +72,10 @@ class RegisterUserRequest { data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; + data['DOB'] = this.dob; + data['IsHijri'] = this.isHijri; + data['HealthId'] = this.healthId; + data['ZipCode'] = this.zipCode; return data; } } @@ -71,7 +84,7 @@ class Patientobject { bool tempValue; int patientIdentificationType; String patientIdentificationNo; - int mobileNumber; + dynamic mobileNumber; int patientOutSA; String firstName; String middleName; diff --git a/lib/models/Authentication/send_activation_request.dart b/lib/models/Authentication/send_activation_request.dart index f9b386c6..867d2d95 100644 --- a/lib/models/Authentication/send_activation_request.dart +++ b/lib/models/Authentication/send_activation_request.dart @@ -22,6 +22,12 @@ class SendActivationRequest { bool isDentalAllowedBackend; int deviceTypeID; String sMSSignature; + String dob; + int isHijri; + String healthId; + int responseID; + int status; + SendActivationRequest( {this.patientMobileNumber, this.mobileNo, @@ -45,7 +51,12 @@ class SendActivationRequest { this.sessionID, this.isDentalAllowedBackend, this.deviceTypeID, - this.sMSSignature}); + this.sMSSignature, + this.dob, + this.isHijri, + this.healthId, + this.responseID, + this.status}); SendActivationRequest.fromJson(Map json) { patientMobileNumber = json['PatientMobileNumber']; @@ -71,6 +82,11 @@ class SendActivationRequest { isDentalAllowedBackend = json['isDentalAllowedBackend']; deviceTypeID = json['DeviceTypeID']; sMSSignature = json['SMSSignature']; + dob = json['DOB']; + isHijri = json['IsHijri']; + healthId = json['HealthId']; + responseID = json['ReponseID']; + status = json['Status']; } Map toJson() { @@ -98,6 +114,11 @@ class SendActivationRequest { data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; data['SMSSignature'] = sMSSignature; + data['DOB'] = dob; + data['IsHijri'] = isHijri; + data['HealthId'] = healthId; + data['ResponseID'] = responseID; + data['Status'] = status; return data; } } diff --git a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart index 750cf0be..e6e702eb 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart @@ -25,7 +25,7 @@ class GetAllSharedRecordsByStatusResponse { dynamic successMsgN; dynamic doctorInformationList; List getAllPendingRecordsList; - List getAllSharedRecordsByStatusList = List(); + List getAllSharedRecordsByStatusList = []; List getResponseFileList; bool isHMGPatient; bool isLoginSuccessfully; @@ -92,7 +92,7 @@ class GetAllSharedRecordsByStatusResponse { this.successMsgN, this.doctorInformationList, this.getAllPendingRecordsList, - this.getAllSharedRecordsByStatusList , + this.getAllSharedRecordsByStatusList, this.getResponseFileList, this.isHMGPatient, this.isLoginSuccessfully, @@ -164,16 +164,14 @@ class GetAllSharedRecordsByStatusResponse { if (json['GetAllPendingRecordsList'] != null) { getAllSharedRecordsByStatusList = new List(); json['GetAllPendingRecordsList'].forEach((v) { - getAllSharedRecordsByStatusList - .add(new GetAllSharedRecordsByStatusList.fromJson(v)); + getAllSharedRecordsByStatusList.add(new GetAllSharedRecordsByStatusList.fromJson(v)); }); } if (json['GetAllSharedRecordsByStatusList'] != null) { getAllSharedRecordsByStatusList = new List(); json['GetAllSharedRecordsByStatusList'].forEach((v) { - getAllSharedRecordsByStatusList - .add(new GetAllSharedRecordsByStatusList.fromJson(v)); + getAllSharedRecordsByStatusList.add(new GetAllSharedRecordsByStatusList.fromJson(v)); }); } getResponseFileList = json['GetResponseFileList']; @@ -214,10 +212,9 @@ class GetAllSharedRecordsByStatusResponse { memberList = json['memberList']; message = json['message']; statusCode = json['statusCode']; - }catch (e){ - var asd =""; + } catch (e) { + var asd = ""; print(e); - } } @@ -250,8 +247,7 @@ class GetAllSharedRecordsByStatusResponse { data['DoctorInformation_List'] = this.doctorInformationList; data['GetAllPendingRecordsList'] = this.getAllPendingRecordsList; if (this.getAllSharedRecordsByStatusList != null) { - data['GetAllSharedRecordsByStatusList'] = - this.getAllSharedRecordsByStatusList.map((v) => v.toJson()).toList(); + data['GetAllSharedRecordsByStatusList'] = this.getAllSharedRecordsByStatusList.map((v) => v.toJson()).toList(); } data['GetResponseFileList'] = this.getResponseFileList; data['IsHMGPatient'] = this.isHMGPatient; @@ -299,13 +295,21 @@ class GetAllSharedRecordsByStatusList { int iD; int patientID; int responseID; + dynamic relationshipID; + dynamic relationship; + dynamic relationshipN; int regionID; int status; dynamic isActive; String editedOn; String createdOn; + int age; String emaiLAddress; + int gender; + String genderDescription; + String genderImage; String mobileNumber; + int patientDataVerified; String patientIdenficationNumber; String patientName; String statusDescription; @@ -314,13 +318,21 @@ class GetAllSharedRecordsByStatusList { {this.iD, this.patientID, this.responseID, + this.relationshipID, + this.relationship, + this.relationshipN, this.regionID, this.status, this.isActive, this.editedOn, this.createdOn, + this.age, this.emaiLAddress, + this.gender, + this.genderDescription, + this.genderImage, this.mobileNumber, + this.patientDataVerified, this.patientIdenficationNumber, this.patientName, this.statusDescription}); @@ -329,13 +341,21 @@ class GetAllSharedRecordsByStatusList { iD = json['ID']; patientID = json['PatientID']; responseID = json['ResponseID']; + relationshipID = json['RelationshipID']; + relationship = json['Relationship']; + relationshipN = json['RelationshipN']; regionID = json['RegionID']; status = json['Status']; isActive = json['IsActive']; editedOn = json['EditedOn']; createdOn = json['CreatedOn']; + age = json['Age']; emaiLAddress = json['EmaiLAddress']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + genderImage = json['GenderImage']; mobileNumber = json['MobileNumber']; + patientDataVerified = json['PatientDataVerified']; patientIdenficationNumber = json['PatientIdenficationNumber']; patientName = json['PatientName']; statusDescription = json['StatusDescription']; @@ -346,13 +366,21 @@ class GetAllSharedRecordsByStatusList { data['ID'] = this.iD; data['PatientID'] = this.patientID; data['ResponseID'] = this.responseID; + data['RelationshipID'] = this.relationshipID; + data['Relationship'] = this.relationship; + data['RelationshipN'] = this.relationshipN; data['RegionID'] = this.regionID; data['Status'] = this.status; data['IsActive'] = this.isActive; data['EditedOn'] = this.editedOn; data['CreatedOn'] = this.createdOn; + data['Age'] = this.age; data['EmaiLAddress'] = this.emaiLAddress; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['GenderImage'] = this.genderImage; data['MobileNumber'] = this.mobileNumber; + data['PatientDataVerified'] = this.patientDataVerified; data['PatientIdenficationNumber'] = this.patientIdenficationNumber; data['PatientName'] = this.patientName; data['StatusDescription'] = this.statusDescription; diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart new file mode 100644 index 00000000..ab1bd2cc --- /dev/null +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -0,0 +1,152 @@ +class ApplePayInsertRequest { + String clientRequestID; + int clinicID; + String currency; + String customerEmail; + int customerID; + String customerName; + String deviceToken; + int doctorID; + String projectID; + String serviceID; + int channelID; + int patientID; + int patientTypeID; + int patientOutSA; + dynamic appointmentDate; + int appointmentNo; + String orderDescription; + String liveServiceID; + String latitude; + String longitude; + String amount; + String isSchedule; + String language; + int userName; + String responseContinueURL; + String backClickUrl; + String paymentOption; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + ApplePayInsertRequest( + {this.clientRequestID, + this.clinicID, + this.currency, + this.customerEmail, + this.customerID, + this.customerName, + this.deviceToken, + this.doctorID, + this.projectID, + this.serviceID, + this.channelID, + this.patientID, + this.patientTypeID, + this.patientOutSA, + this.appointmentDate, + this.appointmentNo, + this.orderDescription, + this.liveServiceID, + this.latitude, + this.longitude, + this.amount, + this.isSchedule, + this.language, + this.userName, + this.responseContinueURL, + this.backClickUrl, + this.paymentOption, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + ApplePayInsertRequest.fromJson(Map json) { + clientRequestID = json['ClientRequestID']; + clinicID = json['ClinicID']; + currency = json['Currency']; + customerEmail = json['CustomerEmail']; + customerID = json['CustomerID']; + customerName = json['CustomerName']; + deviceToken = json['DeviceToken']; + doctorID = json['DoctorID']; + projectID = json['ProjectID']; + serviceID = json['Service_ID']; + channelID = json['Channel_ID']; + patientID = json['PatientID']; + patientTypeID = json['PatientTypeID']; + patientOutSA = json['PatientOutSA']; + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + orderDescription = json['OrderDescription']; + liveServiceID = json['Live_ServiceID']; + latitude = json['Latitude']; + longitude = json['Longitude']; + amount = json['Amount']; + isSchedule = json['IsSchedule']; + language = json['Language']; + userName = json['userName']; + responseContinueURL = json['ResponseContinueURL']; + backClickUrl = json['BackClickUrl']; + paymentOption = json['PaymentOption']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['ClientRequestID'] = this.clientRequestID; + data['ClinicID'] = this.clinicID; + data['Currency'] = this.currency; + data['CustomerEmail'] = this.customerEmail; + data['CustomerID'] = this.customerID; + data['CustomerName'] = this.customerName; + data['DeviceToken'] = this.deviceToken; + data['DoctorID'] = this.doctorID; + data['ProjectID'] = this.projectID; + data['Service_ID'] = this.serviceID; + data['Channel_ID'] = this.channelID; + data['PatientID'] = this.patientID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientOutSA'] = this.patientOutSA; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['OrderDescription'] = this.orderDescription; + data['Live_ServiceID'] = this.liveServiceID; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['Amount'] = this.amount; + data['IsSchedule'] = this.isSchedule; + data['Language'] = this.language; + data['userName'] = this.userName; + data['ResponseContinueURL'] = this.responseContinueURL; + data['BackClickUrl'] = this.backClickUrl; + data['PaymentOption'] = this.paymentOption; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/models/MyInvoices/DentalInvoiceDetailResponse.dart b/lib/models/MyInvoices/DentalInvoiceDetailResponse.dart index 83ef9f5a..6c6d605a 100644 --- a/lib/models/MyInvoices/DentalInvoiceDetailResponse.dart +++ b/lib/models/MyInvoices/DentalInvoiceDetailResponse.dart @@ -267,27 +267,27 @@ class ListConsultation { dynamic projectID; dynamic doctorID; dynamic grandTotal; - int quantity; - int total; + dynamic quantity; + dynamic total; dynamic discount; - int subTotal; + dynamic subTotal; dynamic invoiceNo; dynamic createdOn; String procedureID; String procedureName; dynamic procedureNameN; dynamic procedurePrice; - int patientShare; + dynamic patientShare; dynamic companyShare; - int totalPatientShare; + dynamic totalPatientShare; dynamic totalCompanyShare; dynamic totalShare; dynamic discountAmount; - int vATPercentage; - int patientVATAmount; + dynamic vATPercentage; + dynamic patientVATAmount; dynamic companyVATAmount; dynamic totalVATAmount; - int price; + dynamic price; dynamic patientID; dynamic patientName; dynamic patientNameN; @@ -316,7 +316,7 @@ class ListConsultation { dynamic totalPatientShareWithQuantity; dynamic legalName; dynamic legalNameN; - int advanceAdjustment; + dynamic advanceAdjustment; ListConsultation( {this.projectID, diff --git a/lib/models/MyInvoices/GetDentalAppointmentsResponse.dart b/lib/models/MyInvoices/GetDentalAppointmentsResponse.dart index a5a43cef..f7294f3c 100644 --- a/lib/models/MyInvoices/GetDentalAppointmentsResponse.dart +++ b/lib/models/MyInvoices/GetDentalAppointmentsResponse.dart @@ -34,10 +34,13 @@ class ListDentalAppointments { int invoiceNo; int status; String arrivedOn; - String doctorName; - dynamic doctorNameN; + dynamic doctorName; + String doctorNameN; String clinicName; + dynamic decimalDoctorRate; String doctorImageURL; + dynamic doctorRate; + int patientNumber; String projectName; ListDentalAppointments( @@ -55,7 +58,10 @@ class ListDentalAppointments { this.doctorName, this.doctorNameN, this.clinicName, + this.decimalDoctorRate, this.doctorImageURL, + this.doctorRate, + this.patientNumber, this.projectName}); ListDentalAppointments.fromJson(Map json) { @@ -73,7 +79,10 @@ class ListDentalAppointments { doctorName = json['DoctorName']; doctorNameN = json['DoctorNameN']; clinicName = json['ClinicName']; + decimalDoctorRate = json['DecimalDoctorRate']; doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + patientNumber = json['PatientNumber']; projectName = json['ProjectName']; } @@ -93,8 +102,12 @@ class ListDentalAppointments { data['DoctorName'] = this.doctorName; data['DoctorNameN'] = this.doctorNameN; data['ClinicName'] = this.clinicName; + data['DecimalDoctorRate'] = this.decimalDoctorRate; data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['PatientNumber'] = this.patientNumber; data['ProjectName'] = this.projectName; return data; } } + diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index f01c3bf8..d681f764 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -1,8 +1,37 @@ class healthData { int MedCategoryID; int MedSubCategoryID; - String Value; - String Notes; String MachineDate; + double Value; int TransactionsListID; -} + String Notes; + + healthData({ + this.MedCategoryID, + this.MedSubCategoryID, + this.MachineDate, + this.Value, + this.TransactionsListID, + this.Notes, + }); + + healthData.fromJson(Map json) { + MedCategoryID = json['MedCategoryID']; + MedSubCategoryID = json['MedSubCategoryID']; + MachineDate = json['MachineDate']; + Value = json['Value']; + TransactionsListID = json['TransactionsListID']; + Notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['MedCategoryID'] = this.MedCategoryID; + data['MedSubCategoryID'] = this.MedSubCategoryID; + data['MachineDate'] = this.MachineDate; + data['Value'] = this.Value; + data['TransactionsListID'] = this.TransactionsListID; + data['Notes'] = this.Notes; + return data; + } +} \ No newline at end of file diff --git a/lib/models/SmartWatch/WeeklyHeartRateResModel.dart b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart new file mode 100644 index 00000000..17dbb563 --- /dev/null +++ b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart @@ -0,0 +1,26 @@ +class WeeklyHeartRateResModel { + num valueAvg; + String machineDate; + int medCategoryID; + int patientID; + + WeeklyHeartRateResModel( + {this.valueAvg, this.machineDate, this.medCategoryID, this.patientID}); + + WeeklyHeartRateResModel.fromJson(Map json) { + num value = json['ValueAvg']; + valueAvg = json['ValueAvg'] != null ? value.toInt() : 0; + machineDate = json['MachineDate']; + medCategoryID = json['MedCategoryID']; + patientID = json['PatientID']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueAvg'] = this.valueAvg; + data['MachineDate'] = this.machineDate; + data['MedCategoryID'] = this.medCategoryID; + data['PatientID'] = this.patientID; + return data; + } +} diff --git a/lib/models/SmartWatch/WeeklyStepsResModel.dart b/lib/models/SmartWatch/WeeklyStepsResModel.dart new file mode 100644 index 00000000..ceae9d3b --- /dev/null +++ b/lib/models/SmartWatch/WeeklyStepsResModel.dart @@ -0,0 +1,42 @@ +class WeeklyStepsResModel { + int iD; + int patientID; + int medCategoryID; + int medSubCategoryID; + num value; + String machineDate; + bool patientOutSA; + dynamic notes; + bool isActive; + String createdOn; + + WeeklyStepsResModel({this.iD, this.patientID, this.medCategoryID, this.medSubCategoryID, this.value, this.machineDate, this.patientOutSA, this.notes, this.isActive, this.createdOn}); + + WeeklyStepsResModel.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + medCategoryID = json['MedCategoryID']; + medSubCategoryID = json['MedSubCategoryID']; + value = json['Value'] != null ? num.tryParse(json['Value']).toInt() : 0; + machineDate = json['MachineDate']; + patientOutSA = json['PatientOutSA']; + notes = json['Notes']; + isActive = json['IsActive']; + createdOn = json['CreatedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['MedCategoryID'] = this.medCategoryID; + data['MedSubCategoryID'] = this.medSubCategoryID; + data['Value'] = this.value; + data['MachineDate'] = this.machineDate; + data['PatientOutSA'] = this.patientOutSA; + data['Notes'] = this.notes; + data['IsActive'] = this.isActive; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/models/SmartWatch/YearlyHeartRateResModel.dart b/lib/models/SmartWatch/YearlyHeartRateResModel.dart new file mode 100644 index 00000000..1d045b19 --- /dev/null +++ b/lib/models/SmartWatch/YearlyHeartRateResModel.dart @@ -0,0 +1,37 @@ +class YearlyHeartRateResModel { + num valueAvg; + int medCategoryID; + int month; + String monthName; + int patientID; + int year; + + YearlyHeartRateResModel( + {this.valueAvg, + this.medCategoryID, + this.month, + this.monthName, + this.patientID, + this.year}); + + YearlyHeartRateResModel.fromJson(Map json) { + num value = json['ValueAvg']; + valueAvg = json['ValueAvg'] != null ? value.toInt() : 0; + medCategoryID = json['MedCategoryID']; + month = json['Month']; + monthName = json['MonthName']; + patientID = json['PatientID']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueAvg'] = this.valueAvg; + data['MedCategoryID'] = this.medCategoryID; + data['Month'] = this.month; + data['MonthName'] = this.monthName; + data['PatientID'] = this.patientID; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/models/SmartWatch/YearlyStepsResModel.dart b/lib/models/SmartWatch/YearlyStepsResModel.dart index 728633d9..c98fff27 100644 --- a/lib/models/SmartWatch/YearlyStepsResModel.dart +++ b/lib/models/SmartWatch/YearlyStepsResModel.dart @@ -1,5 +1,5 @@ class YearlyStepsResModel { - double valueSum; + num valueSum; int medCategoryID; int month; String monthName; @@ -21,6 +21,7 @@ class YearlyStepsResModel { monthName = json['MonthName']; patientID = json['PatientID']; year = json['Year']; + valueSum = valueSum != null ? valueSum.toInt() : valueSum; } Map toJson() { diff --git a/lib/models/gradient_color.dart b/lib/models/gradient_color.dart new file mode 100644 index 00000000..d2a32e8d --- /dev/null +++ b/lib/models/gradient_color.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +class GradientColor { + Color darkColor; + Color lightColor; + + GradientColor(this.darkColor, this.lightColor); +} + +List bannerColor = [ + new GradientColor(Color(0xFFF2B353E), Color(0xFFF71787E)), + new GradientColor(Color(0xFFFD02127), Color(0xFFFEE6161)), + new GradientColor(Colors.blue[700], Colors.blue[400]), + new GradientColor(Colors.yellow[700], Colors.yellow), + new GradientColor(Colors.orange[800], Colors.orange), + new GradientColor(Colors.green[800], Colors.green[500]), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.brown[700], Colors.brown), +]; diff --git a/lib/models/header_model.dart b/lib/models/header_model.dart new file mode 100644 index 00000000..1f4d14fc --- /dev/null +++ b/lib/models/header_model.dart @@ -0,0 +1,19 @@ +class HeaderModel { + String doctorName; + int doctorId; + String doctorImageURL; + List speciality; + String invoiceNo; + String projectName; + DateTime date; + String time; + String nationalityFlagURL; + int doctorRate; + int actualDoctorRate; + int totalReviews; + String decimalDoctorRate; + String email; + + HeaderModel(this.doctorName, this.doctorId, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, + this.actualDoctorRate, this.totalReviews, this.email, {this.decimalDoctorRate = null}); +} diff --git a/lib/models/hmg_services.dart b/lib/models/hmg_services.dart new file mode 100644 index 00000000..c4163bd4 --- /dev/null +++ b/lib/models/hmg_services.dart @@ -0,0 +1,9 @@ +class HmgServices { + int action; + String title; + String subTitle; + String icon; + bool isLogin; + + HmgServices(this.action, this.title, this.subTitle, this.icon,this.isLogin); +} diff --git a/lib/models/pharmacy/locationModel.dart b/lib/models/pharmacy/locationModel.dart index 36ee7350..02d67a09 100644 --- a/lib/models/pharmacy/locationModel.dart +++ b/lib/models/pharmacy/locationModel.dart @@ -52,7 +52,7 @@ class LocationModel { int barcode; dynamic companybarcode; int cityId; - CityName cityName; + String cityName; int distanceInKilometers; String latitude; int locationType; @@ -78,7 +78,7 @@ class LocationModel { barcode: json["Barcode"], companybarcode: json["Companybarcode"], cityId: json["CityID"], - cityName: cityNameValues.map[json["CityName"]], + cityName: json["CityName"], distanceInKilometers: json["DistanceInKilometers"], latitude: json["Latitude"], locationType: json["LocationType"], @@ -105,7 +105,7 @@ class LocationModel { "Barcode": barcode, "Companybarcode": companybarcode, "CityID": cityId, - "CityName": cityNameValues.reverse[cityName], + "CityName": cityName, "DistanceInKilometers": distanceInKilometers, "Latitude": latitude, "LocationType": locationType, diff --git a/lib/models/pharmacy/productDetailModel.dart b/lib/models/pharmacy/productDetailModel.dart index d2e8f010..724f1190 100644 --- a/lib/models/pharmacy/productDetailModel.dart +++ b/lib/models/pharmacy/productDetailModel.dart @@ -1,7 +1,3 @@ -// To parse this JSON data, do -// -// final productDetail = productDetailFromJson(jsonString); - import 'dart:convert'; List productDetailFromJson(String str) => List.from(json.decode(str).map((x) => ProductDetail.fromJson(x))); @@ -16,12 +12,12 @@ class ProductDetail { List reviews; factory ProductDetail.fromJson(Map json) => ProductDetail( - reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), - ); + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + ); Map toJson() => { - "reviews": List.from(reviews.map((x) => x.toJson())), - }; + "reviews": List.from(reviews.map((x) => x.toJson())), + }; } class Review { @@ -62,42 +58,42 @@ class Review { dynamic product; factory Review.fromJson(Map json) => Review( - id: json["id"], - position: json["position"], - reviewId: json["review_id"], - customerId: json["customer_id"], - productId: json["product_id"], - storeId: json["store_id"], - isApproved: json["is_approved"], - title: json["title"], - reviewText: json["review_text"], - replyText: json["reply_text"], - rating: json["rating"], - helpfulYesTotal: json["helpful_yes_total"], - helpfulNoTotal: json["helpful_no_total"], - createdOnUtc: DateTime.parse(json["created_on_utc"]), - customer: Customer.fromJson(json["customer"]), - product: json["product"], - ); + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: json["title"], + reviewText: json["review_text"], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); Map toJson() => { - "id": id, - "position": position, - "review_id": reviewId, - "customer_id": customerId, - "product_id": productId, - "store_id": storeId, - "is_approved": isApproved, - "title": title, - "review_text": reviewText, - "reply_text": replyText, - "rating": rating, - "helpful_yes_total": helpfulYesTotal, - "helpful_no_total": helpfulNoTotal, - "created_on_utc": createdOnUtc.toIso8601String(), - "customer": customer.toJson(), - "product": product, - }; + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc.toIso8601String(), + "customer": customer.toJson(), + "product": product, + }; } class Customer { @@ -164,75 +160,73 @@ class Customer { dynamic registeredInStoreId; factory Customer.fromJson(Map json) => Customer( - fileNumber: json["file_number"], - iqamaNumber: json["iqama_number"], - isOutSa: json["is_out_sa"], - patientType: json["patient_type"], - gender: json["gender"], - birthDate: DateTime.parse(json["birth_date"]), - phone: json["phone"], - countryCode: json["country_code"], - yahalaAccountno: json["yahala_accountno"], - billingAddress: json["billing_address"], - shippingAddress: json["shipping_address"], - id: json["id"], - username: emailValues.map[json["username"]], - email: emailValues.map[json["email"]], - firstName: json["first_name"], - lastName: json["last_name"], - languageId: json["language_id"], - adminComment: json["admin_comment"], - isTaxExempt: json["is_tax_exempt"], - hasShoppingCartItems: json["has_shopping_cart_items"], - active: json["active"], - deleted: json["deleted"], - isSystemAccount: json["is_system_account"], - systemName: json["system_name"], - lastIpAddress: json["last_ip_address"], - createdOnUtc: json["created_on_utc"], - lastLoginDateUtc: json["last_login_date_utc"], - lastActivityDateUtc: json["last_activity_date_utc"], - registeredInStoreId: json["registered_in_store_id"], - ); + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + id: json["id"], + username: emailValues.map[json["username"]], + email: emailValues.map[json["email"]], + firstName: json["first_name"], + lastName: json["last_name"], + languageId: json["language_id"], + adminComment: json["admin_comment"], + isTaxExempt: json["is_tax_exempt"], + hasShoppingCartItems: json["has_shopping_cart_items"], + active: json["active"], + deleted: json["deleted"], + isSystemAccount: json["is_system_account"], + systemName: json["system_name"], + lastIpAddress: json["last_ip_address"], + createdOnUtc: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + ); Map toJson() => { - "file_number": fileNumber, - "iqama_number": iqamaNumber, - "is_out_sa": isOutSa, - "patient_type": patientType, - "gender": gender, - "birth_date": birthDate.toIso8601String(), - "phone": phone, - "country_code": countryCode, - "yahala_accountno": yahalaAccountno, - "billing_address": billingAddress, - "shipping_address": shippingAddress, - "id": id, - "username": emailValues.reverse[username], - "email": emailValues.reverse[email], - "first_name": firstName, - "last_name": lastName, - "language_id": languageId, - "admin_comment": adminComment, - "is_tax_exempt": isTaxExempt, - "has_shopping_cart_items": hasShoppingCartItems, - "active": active, - "deleted": deleted, - "is_system_account": isSystemAccount, - "system_name": systemName, - "last_ip_address": lastIpAddress, - "created_on_utc": createdOnUtc, - "last_login_date_utc": lastLoginDateUtc, - "last_activity_date_utc": lastActivityDateUtc, - "registered_in_store_id": registeredInStoreId, - }; + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "id": id, + "username": emailValues.reverse[username], + "email": emailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + }; } enum Email { STEVE_GATES_NOP_COMMERCE_COM } -final emailValues = EnumValues({ - "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM -}); +final emailValues = EnumValues({"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM}); class EnumValues { Map map; diff --git a/lib/models/rrt/service_price.dart b/lib/models/rrt/service_price.dart index d206c986..998671f7 100644 --- a/lib/models/rrt/service_price.dart +++ b/lib/models/rrt/service_price.dart @@ -1,14 +1,14 @@ class ServicePrice { String currency; - double maxPrice; - double maxTotalPrice; - double maxVAT; - double minPrice; - double minTotalPrice; - double minVAT; - int price; - int totalPrice; - int vat; + dynamic maxPrice; + dynamic maxTotalPrice; + dynamic maxVAT; + dynamic minPrice; + dynamic minTotalPrice; + dynamic minVAT; + dynamic price; + dynamic totalPrice; + dynamic vat; ServicePrice({ this.currency, diff --git a/lib/models/slider_data.dart b/lib/models/slider_data.dart new file mode 100644 index 00000000..6d72fc4f --- /dev/null +++ b/lib/models/slider_data.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +class SliderData{ + String pateintId; + String pateintName; + String dof; + Color darkColor; + Color lightColor; + + SliderData(this.pateintId, this.pateintName, this.dof,this.darkColor,this.lightColor); +} \ No newline at end of file diff --git a/lib/models/vital_sign.dart b/lib/models/vital_sign.dart new file mode 100644 index 00000000..f9587d31 --- /dev/null +++ b/lib/models/vital_sign.dart @@ -0,0 +1,8 @@ +class VitalSign { + final String des; + final String lastVal; + final String unit; + final String icon; + + VitalSign(this.des, this.lastVal, this.unit, this.icon); +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart index 549f90b8..e2685e29 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -10,9 +8,7 @@ class ConfirmCancelOrderDialog extends StatefulWidget { final CMCViewModel model; final Function onTap; - - ConfirmCancelOrderDialog( - {Key key, this.model, this.onTap}); + ConfirmCancelOrderDialog({Key key, this.model, this.onTap}); @override _ConfirmCancelOrderDialogState createState() => _ConfirmCancelOrderDialogState(); @@ -27,11 +23,13 @@ class _ConfirmCancelOrderDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - color: Colors.black, + contentPadding: EdgeInsets.fromLTRB(28.0, 2.0, 28.0, 0.0), + title: Text( + TranslationBase.of(context).confirm, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, ), ), children: [ @@ -39,13 +37,13 @@ class _ConfirmCancelOrderDialogState extends State { children: [ Divider(), Center( - child: Texts( - TranslationBase.of(context).cancelOrderMsg , - color: Colors.grey, + child: Text( + TranslationBase.of(context).cancelOrderMsg, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, letterSpacing: -0.46, color: Colors.grey[600]), ), ), SizedBox( - height: 5.0, + height: 12.0, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -60,9 +58,14 @@ class _ConfirmCancelOrderDialogState extends State { padding: const EdgeInsets.all(8.0), child: Container( child: Center( - child: Texts( + child: Text( TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w700, + letterSpacing: -0.46, + color: Colors.red, + ), ), ), ), @@ -77,28 +80,32 @@ class _ConfirmCancelOrderDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ + onTap: () async { widget.onTap(); Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + child: Text( + TranslationBase.of(context).ok.toUpperCase(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w700, + letterSpacing: -0.46, + ), + )), ), ), ), ], - ) + ), + SizedBox( + height: 5.0, + ), ], ) ], ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart new file mode 100644 index 00000000..6d47c0cf --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart @@ -0,0 +1,109 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:flutter/material.dart'; + +Future showCMCConfirmDialog(BuildContext context, String requestId, {Function onClick}) async { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ConfirmDialog( + requestId, + onClick: onClick, + ), + ], + ), + ); + }, + ); +} + +class ConfirmDialog extends StatelessWidget { + String requestId; + Function onClick; + + ConfirmDialog(this.requestId, {this.onClick}); + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: 40, + height: 40, + margin: EdgeInsets.only(top: 20), + decoration: containerRadius(CustomColors.green, 200,), + child: Icon(Icons.done,color: Colors.white,), + ), + mFlex(1), + IconButton( + icon: Icon( + Icons.close, + ), + onPressed: () { + onClick(); + Navigator.pop(context); + }, + ), + ], + ), + mHeight(12), + Text( + TranslationBase.of(context).RRTRequestSuccess, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), + ), + mHeight(20), + Text( + TranslationBase.of(context).reqId, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey[600], + letterSpacing: -0.46, + ), + ), + Text( + requestId ?? "", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.black, + letterSpacing: -0.46, + ), + ), + mHeight(20), + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + label: TranslationBase.of(context).ok.toUpperCase(), + color: CustomColors.accentColor, + onTap: () async { + onClick(); + Navigator.pop(context); + }, + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index d7bb61ed..41fe54b9 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -1,10 +1,11 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.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/uitl/utils.dart'; @@ -17,14 +18,13 @@ import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; class CMCLocationPage extends StatefulWidget { - final Function(PickResult) onPick; + final Function onPick; final double latitude; final double longitude; final dynamic model; - const CMCLocationPage( - {Key key, this.onPick, this.latitude, this.longitude, this.model}) - : super(key: key); + + const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); @override _CMCLocationPageState createState() => _CMCLocationPageState(); @@ -34,12 +34,14 @@ class _CMCLocationPageState extends State { double latitude = 0; double longitude = 0; bool showCurrentLocation = false; + Function onPick; @override void initState() { + onPick=widget.onPick; latitude = widget.latitude; longitude = widget.longitude; - if(latitude == 0.0 && longitude == 0.0) { + if (latitude == 0.0 && longitude == 0.0) { showCurrentLocation = true; } super.initState(); @@ -48,113 +50,104 @@ class _CMCLocationPageState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return BaseView( - onModelReady: (model) {}, - builder: (_, model, widget) => AppScaffold( - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print( - "state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - print(selectedPlace); - AddNewAddressRequestModel - addNewAddressRequestModel = - new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: selectedPlace - .formattedAddress, - address2: selectedPlace - .formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: - "$latitude,$longitude", - email: "") - ]), - ); - selectedPlace.addressComponents - .forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel - .customer - .addresses[0] - .country = e.longName; - } - if (e.types - .contains("postal_code")) { - addNewAddressRequestModel - .customer - .addresses[0] - .zipPostalCode = e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel - .customer - .addresses[0] - .city = e.longName; - } - }); + return BaseView( + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), + ], + appBarTitle: TranslationBase.of(context).addNewAddress, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - await model.addAddressInfo( - addNewAddressRequestModel: - addNewAddressRequestModel); - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: - "Address Added Successfully"); - } - Navigator.of(context).pop(); - }, - label: TranslationBase.of(context) - .addNewAddress, + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: CustomColors.accentColor, + textColor: Colors.white, + onTap: () async { + print(selectedPlace); + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer( + addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(), + email: "", + ) + ], ), - ], - ), + ); + + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); + + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + onPick(); + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context).addNewAddress, ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + ), + ); } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index f314a9bf..5ef5089c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -1,24 +1,23 @@ 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/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.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/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; import 'new_cmc_step_one_page.dart'; -import 'new_cmc_step_three_page.dart'; -import 'new_cmc_step_tow_page.dart'; class NewCMCPage extends StatefulWidget { NewCMCPage({this.model}); @@ -38,6 +37,8 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; + BuildContext _context; + @override void initState() { super.initState(); @@ -46,20 +47,15 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( price: widget.model.cmcAllServicesList[0].price, serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[0].description, - selectedServiceNameAR: - widget.model.cmcAllServicesList[0].descriptionN, + selectedServiceName: widget.model.cmcAllServicesList[0].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[0].textN, recordID: 1, - totalPrice: widget.model.cmcAllServicesList[0].totalPrice, - vAT: widget.model.cmcAllServicesList[0].vAT); - cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel( - patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); + totalPrice: widget.model.cmcAllServicesList[0].priceTotal, + vAT: widget.model.cmcAllServicesList[0].priceVAT); + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); } - cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel( - patientERCMCInsertServicesList: patientERCMCInsertServicesList != null - ? [patientERCMCInsertServicesList] - : []); + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: patientERCMCInsertServicesList != null ? [patientERCMCInsertServicesList] : []); _controller = new PageController(); @@ -87,321 +83,174 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { + _context = context; ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmCancelOrderDialog( - model: model, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, - editedBy: 3); - await model.updateCmcPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: - TranslationBase.of(context).processDoneSuccessfully); - await model.getCmcAllPresOrders(); - } + 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; + String _statusDisp = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusText : ""; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return Scaffold( body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - if (widget.model.cmcAllOrderDetail.length == 0) - Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, - ), - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.cmcAllOrderDetail.length != 0 - ? FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( + child: Container( + child: widget.model.pendingOrder != null + ? Column( + children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12, top: 12), + child: Container( + decoration: cardRadius(12), + 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( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, width: 1), - borderRadius: - BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model - .cmcAllOrderDetail[0].iD - .toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget - .model - .cmcAllOrderDetail[0] - .descriptionN - : widget - .model - .cmcAllOrderDetail[0] - .description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - widget - .model - .cmcAllOrderDetail[ - 0] - .createdOn)), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .serviceName, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic - ? widget - .model - .cmcAllOrderDetail[0] - .description - .toString() - : widget - .model - .cmcAllOrderDetail[0] - .descriptionN - .toString(), - fontSize: 22, - ), - ], - ), - ), - SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery.of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of( - context) - .cancel - .toUpperCase(), - onTap: () { - showConfirmMessage( - widget.model, - widget.model - .cmcAllOrderDetail[0]); - }, - color: Colors.red[800], - disabled: false, - textColor: Theme.of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 22, + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).hospital + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + widget.model.pendingOrder.projectName.trim().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - ], - ), + ), + ], ), - SizedBox( - height: 22, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + widget.model.pendingOrder.serviceText.trim().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], ), ], ), ), - ) - : NewCMCStepOnePage( - changePageViewIndex: changePageViewIndex, - cMCInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), - NewCMCStepTowPage( - longitude: _longitude, - latitude: _latitude, - changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), - NewCMCStepThreePage( - changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + ), ), - ], + ) + ], + ) + : Container( + color: Colors.red, + child: NewCMCStepOnePage( + changePageViewIndex: changePageViewIndex, + cMCInsertPresOrderRequestModel: cMCInsertPresOrderRequestModel, + model: widget.model, + latitude: _latitude, + longitude: _longitude, ), ), - ], - ), - ), ), ), ); 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 c07b8345..5e2b0498 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 @@ -3,32 +3,39 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens 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/theme/colors.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/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/photo_view_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; +import 'new_cmc_step_tow_page.dart'; + class NewCMCStepOnePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; final Function changePageViewIndex; final CMCViewModel model; - const NewCMCStepOnePage( - {Key key, - this.cMCInsertPresOrderRequestModel, - this.model, - this.changePageViewIndex}) - : super(key: key); + final double latitude; + final double longitude; + + const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex, this.latitude, this.longitude}) : super(key: key); @override _NewCMCStepOnePageState createState() => _NewCMCStepOnePageState(); } class _NewCMCStepOnePageState extends State { + int selectedItem = 0; + @override void initState() { super.initState(); @@ -41,236 +48,138 @@ class _NewCMCStepOnePageState extends State { return AppScaffold( isShowAppBar: false, baseViewModel: widget.model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: Column( - children: [ - FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Texts( - TranslationBase.of(context).selectService, - textAlign: TextAlign.center, - ), - Column( - children: - widget.model.cmcAllServicesList.map((service) { - return Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - child: Column( - children: [ - Row( - children: [ - Radio( - value: service.serviceID, - activeColor: Colors.red[800], - onChanged: (newValue) async { - PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: service.price, - serviceID: service.serviceID - .toString(), - selectedServiceName: - service.description, - selectedServiceNameAR: - service.descriptionN, - recordID: 1, - totalPrice: - service.totalPrice, - vAT: service.vAT); - setState(() { - widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = [ - patientERCMCInsertServicesList - ]; - }); - CMCGetItemsRequestModel - cMCGetItemsRequestModel = - new CMCGetItemsRequestModel( - checkupType: newValue); - await widget.model.getCheckupItems( - cMCGetItemsRequestModel: - cMCGetItemsRequestModel); - }, - groupValue: widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList - .length > - 0 - ? int.parse(widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList[ - 0] - .serviceID) - : 1), - Expanded( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - projectViewModel.isArabic - ? service.descriptionN - : service.description, - fontSize: 15, - ), - ), - ), - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Row( + children: [ + Radio( + value: num.tryParse(widget.model.cmcAllServicesList[index].serviceID), + activeColor: Colors.red[800], + onChanged: (newValue) async { + selectedItem = index; + PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( + price: widget.model.cmcAllServicesList[index].price, + serviceID: widget.model.cmcAllServicesList[index].serviceID, + selectedServiceName: widget.model.cmcAllServicesList[index].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[index].textN, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[index].priceTotal, + vAT: widget.model.cmcAllServicesList[index].priceVAT); + setState(() { + widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; + }); + // CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue); + // await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel); + }, + groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0 + ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID) + : 1), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 10, + right: 10, + top: 20, + bottom: 20, ), - ], - ), - ); - }).toList(), - ), - ], - ), - ), - SizedBox( - height: 30, - ), - Container( - color: Theme.of(context).primaryColor, - width: double.infinity, - child: Column( - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 10, left: 10), - child: Texts( - TranslationBase.of(context).coveredService, - fontWeight: FontWeight.bold, - )) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.model.checkupItems.map((item) { - return Center( - child: FractionallySizedBox( - widthFactor: 1, - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 5, top: 5), - decoration: BoxDecoration( - border: BorderDirectional( - bottom: BorderSide( - style: BorderStyle.solid, - width: 0.5, - color: Colors.grey)), - //borderRadius: , - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - right: 10, left: 10), - child: Texts(item.itemName, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ], - ), - ), - SizedBox( - height: 12, - ), - ], + child: Text( + projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].textN : widget.model.cmcAllServicesList[index].text, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), ), ), - ); - }).toList()), + ), + ], + ); + }, + separatorBuilder: (context, index) { + return mDivider(Colors.grey); + }, + itemCount: widget.model.cmcAllServicesList.length), + Stack( + children: [ + Image.asset( + projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png", + width: double.infinity, + ), + Align( + alignment: Alignment.topRight, + child: Container( + decoration: containerColorRadiusBorder( + Colors.black.withOpacity(0.2), + 1000, + Colors.white, + ), + margin: EdgeInsets.all(12), + child: IconButton( + icon: SvgPicture.asset("assets/images/new/ic_zoom.svg",color: Colors.white,), + padding: EdgeInsets.all(12), + onPressed: () { + showDraggableDialog(context, PhotoViewPage(projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png")); + }, + ), + ), + ), ], ), - ) - ], + ], + ), ), ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).next, - textColor: Theme.of(context).backgroundColor, - color: Colors.grey[800], - onTap: () async { - if (widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList.length != - 0 || - widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList == - null) { - int index = widget.model.cmcAllServicesList.length; - PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: widget - .model.cmcAllServicesList[index - 1].price, - serviceID: widget - .model.cmcAllServicesList[index - 1].serviceID - .toString(), - selectedServiceName: widget.model - .cmcAllServicesList[index - 1].description, - selectedServiceNameAR: widget.model - .cmcAllServicesList[index - 1].descriptionN, - recordID: 1, - totalPrice: widget - .model.cmcAllServicesList[index - 1].totalPrice, - vAT: - widget.model.cmcAllServicesList[index - 1].vAT); + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).next, + () async { + if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) { + // int index = widget.model.cmcAllServicesList.length; + PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( + price: widget.model.cmcAllServicesList[selectedItem].price, + serviceID: widget.model.cmcAllServicesList[selectedItem].serviceID.toString(), + selectedServiceName: widget.model.cmcAllServicesList[selectedItem].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[selectedItem].textN, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[selectedItem].priceTotal, + vAT: widget.model.cmcAllServicesList[selectedItem].priceVAT, + ); - widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = [ - patientERCMCInsertServicesList - ]; - await widget.model.getCustomerInfo(); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(); - } else { - widget.changePageViewIndex(1); - } - } - }, - ), + widget.cMCInsertPresOrderRequestModel.patientID = projectViewModel.user.patientID; + widget.cMCInsertPresOrderRequestModel.patientOutSA = projectViewModel.user.outSA; + + widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; + 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, + ), + ); + // } + } + }, ), - ], - ), + ), + ], ), ); } 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 75699a5c..cc83abdb 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 @@ -2,11 +2,16 @@ 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/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/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_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -15,14 +20,9 @@ import 'package:provider/provider.dart'; class NewCMCStepThreePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; - final Function changePageViewIndex; final CMCViewModel model; - NewCMCStepThreePage( - {Key key, - this.changePageViewIndex, - this.model, - this.cmcInsertPresOrderRequestModel}); + NewCMCStepThreePage({Key key, this.model, this.cmcInsertPresOrderRequestModel}); @override _NewCMCStepThreePageState createState() => _NewCMCStepThreePageState(); @@ -44,15 +44,12 @@ class _NewCMCStepThreePageState extends State { markers.add( Marker( markerId: MarkerId( - widget.cmcInsertPresOrderRequestModel.latitude.hashCode - .toString(), + widget.cmcInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, - widget.cmcInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, - widget.cmcInsertPresOrderRequestModel.longitude), + target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude), zoom: 14.4746, ); } @@ -63,7 +60,15 @@ class _NewCMCStepThreePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowDecPage: false, + isShowAppBar: true, + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), + ], + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, baseViewModel: widget.model, body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -74,79 +79,108 @@ class _NewCMCStepThreePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).orderDetails, - fontWeight: FontWeight.bold, + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).orderSummary, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), ), SizedBox( height: 12, ), Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(12)), - padding: EdgeInsets.all(8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation + " : ", - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 200, - child: GoogleMap( - mapType: MapType.normal, - markers: markers, - initialCameraPosition: _kGooglePlex, - onMapCreated: (GoogleMapController controller) { - _controller.complete(controller); - }, + decoration: cardRadius(12), + child: Container( + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderDetails + " : ", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + color: CustomColors.grey, ), ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).selectedService), - ...List.generate( - widget.cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList.length, - (index) => Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), - Texts( - projectViewModel.isArabic - ? widget - .cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList[index] - .selectedServiceNameAR - : widget - .cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList[index] - .selectedServiceName, - fontSize: 15, - bold: true, + 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, ), - ], + ), ), ), - ) - ], + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).selectedService, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + color: CustomColors.grey, + ), + ), + ...List.generate( + widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList.length, + (index) => Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + projectViewModel.isArabic + ? widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceNameAR + : widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), + ), + ], + ), + ), + ) + ], + ), ), ) ], @@ -156,18 +190,31 @@ class _NewCMCStepThreePageState extends State { bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, + color: Colors.white, child: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: TranslationBase.of(context).confirm, - color: Colors.grey[800], + color: CustomColors.green, onTap: () async { - await widget.model.insertPresPresOrder( - order: widget.cmcInsertPresOrderRequestModel); + GifLoaderDialogUtils.showMyDialog(context); + String requestId = await widget.model.insertCMCOrderRC(order: widget.cmcInsertPresOrderRequestModel); + GifLoaderDialogUtils.hideDialog(context); if (widget.model.state != ViewState.ErrorLocal) { - widget.changePageViewIndex(0); + //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), 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 12e1b622..89d58317 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 @@ -1,41 +1,38 @@ -import 'package:diplomaticquarterapp/config/config.dart'; +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/shared_pref_kay.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/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/location_util.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.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:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'cmc_location_page.dart'; +import 'new_cmc_step_three_page.dart'; class NewCMCStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; final double longitude; final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; - final Function changePageViewIndex; final CMCViewModel model; - const NewCMCStepTowPage( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.cmcInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}) - : super(key: key); + const NewCMCStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.cmcInsertPresOrderRequestModel, this.model}) : super(key: key); @override _NewCMCStepTowPageState createState() => _NewCMCStepTowPageState(); @@ -46,156 +43,245 @@ class _NewCMCStepTowPageState extends State { double longitude = 0; AddressInfo _selectedAddress; bool showCurrentLocation = false; + AppSharedPreferences sharedPref = AppSharedPreferences(); - @override - void initState() { - if (widget.cmcInsertPresOrderRequestModel.latitude == null) { - setLatitudeAndLongitude(); + static CameraPosition cameraPosition = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + + LatLng currentPostion; + + void _getUserLocation() async { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + var lat = await this.sharedPref.getDouble(USER_LAT); + var long = await this.sharedPref.getDouble(USER_LONG); + latitude = lat; + longitude = long; + currentPostion = LatLng(lat, long); + setMap(); } else { - latitude = widget.cmcInsertPresOrderRequestModel.latitude; - longitude = widget.cmcInsertPresOrderRequestModel.longitude; + if (await Permission.location.request().isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } else { + requestPermissions().then( + (value) async { + if (value[Permission.location].isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } + }, + ); + } } + } + + @override + void initState() { super.initState(); + appMap = AppMap( + cameraPosition.toMap(), + onCameraMove: (camera) { + setState(() {}); + _updatePosition(camera); + }, + onMapCreated: () { + print("_getUserLocation"); + _getUserLocation(); + }, + ); } - setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { - if (latLong == null){ - if(widget.model.addressesList.isEmpty) { + setMap() { + setState(() { + cameraPosition = CameraPosition( + target: currentPostion, + zoom: 14.4746, + ); + if (appMap != null) appMap.moveTo(cameraPostion: cameraPosition); + }); + } + Future> requestPermissions() async { + var permissionResults = [ + Permission.location, + Permission.locationAlways, + ].request(); + + return permissionResults; + } + + setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { + print("latLong " + latLong.toString()); + if (latLong == null) { + if (widget.model.addressesList.isEmpty) { setState(() { showCurrentLocation = true; }); } else { - latLong = widget - .model.addressesList[widget.model.addressesList.length - 1].latLong; + latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong; } - } - if(!showCurrentLocation) { + if (!showCurrentLocation) { List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); + print("sssss1 " + latitude.toString()); + print("sssss2 " + longitude.toString()); + currentPostion = LatLng(latitude, longitude); + setMap(); } } + AppMap appMap; + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowDecPage: false, - body: Stack( + isShowAppBar: true, + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), + ], + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + baseViewModel: widget.model, + body: Column( children: [ - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: CMCLocationPage( - latitude: latitude, - longitude: longitude, - ), - ), - ); - }, - label: TranslationBase.of(context) - .addNewAddress, - ), - SizedBox( - height: 10, - ), - SecondaryButton( - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.cmcInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.cmcInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, - ), - ], - )), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - if(widget.model.addressesList.isNotEmpty) - + if (widget.model.addressesList.isNotEmpty) Container( - child: InkWell( - onTap: () => - confirmSelectLocationDialog(widget.model.addressesList), + margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12), + decoration: cardRadius(12), child: Container( - padding: EdgeInsets.all(10), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Theme.of(context).primaryColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Texts( - getAddressName(), - fontSize: 14, - ), + child: InkWell( + onTap: () => confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(8), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, ), - Icon(Icons.arrow_drop_down) - ], + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + getAddressName(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.45, + ), + ), + ), + Icon(Icons.arrow_drop_down) + ], + ), + ), ), + height: 50, + width: double.infinity, ), ), - height: 56, - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - ) + InkWell( + onTap: () async { + bool isNeedToUpdate = false; + await Navigator.of(context).push(new MaterialPageRoute( + builder: (BuildContext context) { + return CMCLocationPage( + latitude: latitude, + longitude: longitude, + onPick: () { + isNeedToUpdate = true; + print("onPickonPick1"); + }, + ); + }, + )); + if (isNeedToUpdate) { + print("onPickonPick2"); + _selectedAddress = new AddressInfo(); + _selectedAddress.address1 = widget.model.addressesList.last.address1; + showCurrentLocation = false; + setLatitudeAndLongitude(); + } + }, + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), + child: Row( + children: [ + Icon(Icons.add_circle_outline_sharp), + mWidth(12), + Text( + TranslationBase.of(context).addNewAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + ], + ), + ), + ), + Expanded( + child: Stack( + alignment: Alignment.center, + children: [ + if (appMap != null) appMap, + Icon( + Icons.place, + color: CustomColors.accentColor, + size: 50, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + child: SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.cmcInsertPresOrderRequestModel.latitude = latitude; + widget.cmcInsertPresOrderRequestModel.longitude = longitude; + }); + // widget.changePageViewIndex(3); + navigateTo( + context, + NewCMCStepThreePage( + cmcInsertPresOrderRequestModel: widget.cmcInsertPresOrderRequestModel, + model: widget.model, + ), + ); + }, + label: TranslationBase.of(context).continues, + ), + ), ], ), ); } + void _updatePosition(CameraPosition _position) { + latitude = _position.target.latitude; + longitude = _position.target.longitude; + } + void confirmSelectLocationDialog(List addresses) { showDialog( context: context, @@ -203,7 +289,9 @@ class _NewCMCStepTowPageState extends State { addresses: addresses, selectedAddress: _selectedAddress, onValueSelected: (value) { + showCurrentLocation = false; setLatitudeAndLongitude(latLong: value.latLong); + setState(() { _selectedAddress = value; }); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index d7ebad6c..42212c40 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -2,12 +2,14 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'NewCMC/new_cmc_page.dart'; import 'orders_log_details_page.dart'; @@ -34,6 +36,7 @@ class _CMCPageState extends State with SingleTickerProviderStateMixin { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { await model.getCmcAllPresOrders(); @@ -42,93 +45,43 @@ class _CMCPageState extends State with SingleTickerProviderStateMixin { isShowAppBar: true, description: TranslationBase.of(context).infoCMC, imagesInfo: [ - ImagesInfo( - imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', - imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png') + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), ], appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context).primaryColor.withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Theme.of(context).primaryColor), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts(TranslationBase.of(context) - .comprehensiveMedicalCheckup), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: - Texts(TranslationBase.of(context).orderLog), - ), - ), - ], - ), - ), - ), - ), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).cmcHeading), Text(TranslationBase.of(context).orderLog)], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - NewCMCPage( - model: model, - ), - OrdersLogDetailsPage( - model: model, - ) - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [NewCMCPage(model: model), OrdersLogDetailsPage(model: model)], + ), + ) + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index ec686e70..48b904aa 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -1,14 +1,19 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_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/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,239 +27,158 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - CMCViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.iD, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); - await model.updateCmcPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); - await model.getCmcAllPresOrders(); - } + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + 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); + } + }); }, )); + return; } return AppScaffold( - isShowAppBar: false, - baseViewModel: model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( + isShowAppBar: false, + baseViewModel: model, + body: model.cmcAllPresOrders.length > 0 ? ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + GetCMCAllOrdersResponseModel order = model.cmcAllPresOrders[index]; + + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return Container( + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + 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( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 50, - ), - Column( + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, - children: model.cmcAllPresOrders.map((order) { - return Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.iD.toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - - projectViewModel.isArabic ? order - .descriptionN : order.description, - fontSize: 22, - ), - ], - ), + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).hospital + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + order.projectName.trim().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic?order. - projectDescription.toString() : - order - .projectDescriptionN - .toString(), - fontSize: 22, - ), - ], - ), - ), - SizedBox( - height: 12, - ), - if (order.status == 1 ||order.status == 2 ) - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of(context).cancel.toUpperCase(), - onTap: () { - showConfirmMessage(model, - order); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 22, - ), - ], + ), + ], + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), ), - ); - }).toList()) - ], + ), + ], + ), + ], + ), ), - ), - ), - ), - ), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 12), + itemCount: model.cmcAllPresOrders.length) : getNoDataWidget(context), ); } } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index fb2b94c6..5d1d5210 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -1,5 +1,8 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; import 'new_e_referral_step_three_page.dart'; @@ -9,18 +12,15 @@ class StartIndexForNewEReferral extends StatefulWidget { StartIndexForNewEReferral(); @override - _StartIndexForNewEReferralState createState() => - _StartIndexForNewEReferralState(); + _StartIndexForNewEReferralState createState() => _StartIndexForNewEReferralState(); } -class _StartIndexForNewEReferralState extends State - with TickerProviderStateMixin { +class _StartIndexForNewEReferralState extends State with TickerProviderStateMixin { PageController _controller; - int _currentIndex = 1; + int _currentIndex = 0; int pageSelected = 2; - CreateEReferralRequestModel createEReferralRequestModel = - new CreateEReferralRequestModel(); + CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel(); @override void initState() { @@ -40,37 +40,139 @@ class _StartIndexForNewEReferralState extends State @override Widget build(BuildContext context) { return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - NewEReferralStepOnePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepTowPage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - NewEReferralStepThreePage( - changePageViewIndex: changePageViewIndex, - createEReferralRequestModel: createEReferralRequestModel, - ), - ], + body: Container( + height: double.infinity, + child: Column( + children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12,right: 12,top: 12), + child: Row( + children: [ + Expanded( + child: showProgress( + title: TranslationBase.of(context).RequesterInfo, + status: _currentIndex == 0 + ? TranslationBase.of(context).inPrgress + : _currentIndex > 0 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green, + ), + ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).patientInfo, + status: _currentIndex == 1 + ? TranslationBase.of(context).inPrgress + : _currentIndex > 1 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: _currentIndex == 1 + ? CustomColors.orange + : _currentIndex > 1 + ? CustomColors.green + : CustomColors.grey2, + ), + ), + showProgress( + title: TranslationBase.of(context).otherInfo, + status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked, + color: _currentIndex == 2 + ? CustomColors.orange + : _currentIndex > 3 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, + ), + ], + ), ), - ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NewEReferralStepOnePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepTowPage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepThreePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + ], + ), + ), + ], ), ), ); } + + Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 26, + height: 26, + decoration: containerRadius(color, 200), + child: Icon( + Icons.done, + color: Colors.white, + size: 16, + ), + ), + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: mDivider(Colors.grey), + )), + ], + ), + mHeight(8), + Text( + title, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.44, + ), + ), + mHeight(2), + Container( + padding: EdgeInsets.all(5), + decoration: containerRadius(color.withOpacity(0.2), 4), + child: Text( + status, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, + ), + ), + ), + ], + ) + ], + ); + } } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 3a58ccb2..25efb016 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart'; @@ -7,21 +8,22 @@ import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -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/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - class NewEReferralStepOnePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; @@ -34,24 +36,19 @@ class NewEReferralStepOnePage extends StatefulWidget { class _NewEReferralStepOnePageState extends State { TextEditingController _nameTextController = TextEditingController(); - TextEditingController _mobileTextController = TextEditingController(); + TextEditingController _requesterRelationTextController = TextEditingController(); + GetAllRelationshipTypeResponseModel _selectedRelation; String email; AuthenticatedUser authenticatedUser; GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); ProjectViewModel projectViewModel; + String mobileNo = ""; // todo create a model for Country // todo use country from the json - dynamic _selectedCountry = { - "name": "Saudi Arabia", - "name_ar": "المملكة العربية السعودية", - "code": "+966", - "countryCode": "SA", - "pattern": "5xxxxxxxx", - "maxLength": 9 - }; + dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; @@ -60,168 +57,185 @@ class _NewEReferralStepOnePageState extends State { super.initState(); } + void showSMSDialog(EReferralViewModel model) { + SMSOTP( + context, + 1, + _selectedCountry['code'] + mobileNo, + (value) { + submit(model, value); + }, + () => { + Navigator.pop(context), + }, + ).displayDialog(context); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - void showSMSDialog() { - showDialog( - context: context, - barrierDismissible: false, - child: EReferralConfirmSMSDialog( - phoneNumber: _selectedCountry['code']+_mobileTextController.text, - onSucces: (){ - Navigator.of(context).pop(); - widget.changePageViewIndex(1); - widget.createEReferralRequestModel.requesterName=_nameTextController.text; - widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; - widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD; - - - } - - - ), - ).then((value) { - print("dialog dismissed"); - print(value); - if (value != null && value) { - } - }); - } return BaseView( - onModelReady: (model) => model.getRelationTypes(), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, + onModelReady: (model) => model.getRelationTypes(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 20, ), - Center( - child: Texts( - TranslationBase.of(context) - .referralRequesterInformation, - textAlign: TextAlign.center, + Text( + TranslationBase.of(context).referralRequesterInformation, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), ), SizedBox( height: 12, ), - NewTextFields( - hintText: TranslationBase - .of(context) - .enterReferralRequesterName, - controller: _nameTextController, - ), + inputWidget(TranslationBase.of(context).enterReferralRequesterName, "", _nameTextController, isInputTypeNum: false), SizedBox( height: 12, ), - InkWell( - onTap: () => confirmSelectCountryTypeDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getCountryName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + _selectedCountry = value; + }); + }), SizedBox( height: 12, ), - MobileNumberTextFiled( - controller: _mobileTextController, - code: _selectedCountry == null - ? "11" - : _selectedCountry["code"], - ), - SizedBox( - height: 12, - ), - Center( - child: Texts( - TranslationBase.of(context).requesterRelationship, - textAlign: TextAlign.center, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), ), - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectRelationTypeDialog( - model.relationTypes), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + child: InkWell( + onTap: () => confirmSelectRelationTypeDialog(model.relationTypes), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getRelationName()), - Icon(Icons.arrow_drop_down) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectRelationship, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getRelationName(), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), ), + SizedBox( + height: 12, + ), + if (_selectedRelation != null && _selectedRelation.iD == 5) + inputWidget(TranslationBase.of(context).requesterRelationship, "", _requesterRelationTextController, isInputTypeNum: false), ], ), ), ), ), - ), - bottomSheet: Container( - height: MediaQuery - .of(context) - .size - .height * 0.1, - width: double.infinity, - padding: EdgeInsets.all(9), - child: SecondaryButton( - textColor: Colors.white, - label: "Next", - onTap: () async { - SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = - SendActivationCodeForEReferralRequestModel( - zipCode: _selectedCountry['code'], - patientMobileNumber: int.parse( - _mobileTextController.text),); - await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); - - showSMSDialog(); - }, - loading: model.state == ViewState.BusyLocal, - disabled: - _nameTextController.text.isEmpty || - _selectedRelation == null || - _mobileTextController.text.isEmpty, + Container( + margin: EdgeInsets.zero, + decoration: cardRadius(0), + child: Container( + // color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12), + width: double.infinity, + child: DefaultButton( + TranslationBase.of(context).next, + (_nameTextController.text.isEmpty || _selectedRelation == null || mobileNo.isEmpty || (_selectedRelation.iD == 5 && _requesterRelationTextController.text.isEmpty)) + ? null + : () async { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = SendActivationCodeForEReferralRequestModel( + zipCode: _selectedCountry['code'], + patientMobileNumber: int.parse(mobileNo), + ); + await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + GifLoaderDialogUtils.hideDialog(context); + showSMSDialog(model); + }); + }, + disabledColor: Colors.grey, + ), + ), ), - ))); - + ], + ), + ), + ), + ); + } + void submit(EReferralViewModel model, code) async { + final activationCode = code; + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel = new CheckActivationCodeForEReferralResponseModel(activationCode: activationCode); + await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: model.error); + showSMSDialog(model); + }); + } else { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + widget.changePageViewIndex(1); + widget.createEReferralRequestModel.requesterName = _nameTextController.text; + widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString() + mobileNo; + widget.createEReferralRequestModel.otherRelationship = _requesterRelationTextController.text; + widget.createEReferralRequestModel.requesterRelationship = _selectedRelation.iD; + } + }); } - void confirmSelectRelationTypeDialog( - List relations) { + void confirmSelectRelationTypeDialog(List relations) { showDialog( context: context, child: SelectRelationTypeDialog( @@ -236,52 +250,116 @@ class _NewEReferralStepOnePageState extends State { ); } - void confirmSelectCountryTypeDialog() { - showDialog( - context: context, - child: SelectCountryDialog( - selectedCountry: _selectedCountry, - onValueSelected: (value) { - setState(() { - _selectedCountry = value; - }); - }, + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), ), ); } + // void confirmSelectCountryTypeDialog() { + // showDialog( + // context: context, + // child: SelectCountryDialog( + // selectedCountry: _selectedCountry, + // onValueSelected: (value) { + // setState(() { + // _selectedCountry = value; + // }); + // }, + // ), + // ); + // } + String getRelationName() { if (_selectedRelation != null) { - if(projectViewModel.isArabic) { + if (projectViewModel.isArabic) { return _selectedRelation.textAr; } return _selectedRelation.textEn; - } - - else - return TranslationBase.of(context).selectRelationship; + } else + return ""; } String getCountryName() { if (_selectedCountry != null) { - if(projectViewModel.isArabic) { + if (projectViewModel.isArabic) { return _selectedCountry["name_ar"]; } return _selectedCountry["name"]; - } - - else + } else return "Country"; } } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({ - Key key, - this.controller, - this.code, this.onChange - }) : super(key: key); - + const MobileNumberTextFiled({Key key, this.controller, this.code, this.onChange}) : super(key: key); final TextEditingController controller; final String code; @@ -291,11 +369,8 @@ class MobileNumberTextFiled extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), color: Colors.white), - child: Row( - textDirection: TextDirection.ltr, - children: [ + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.white), + child: Row(textDirection: TextDirection.ltr, children: [ Expanded( flex: 1, child: Icon( @@ -316,8 +391,7 @@ class MobileNumberTextFiled extends StatelessWidget { controller: controller, onChanged: onChange, keyboardType: TextInputType.phone, - decoration: InputDecoration( - border: InputBorder.none, hintText: '5xxxxxxxx'), + decoration: InputDecoration(border: InputBorder.none, hintText: '5xxxxxxxx'), ), ), ) diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index 3f92823d..439a9ec7 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -1,34 +1,38 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +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/bottom_options/BottomSheet.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../dialogs/select_city_dialog.dart'; -import 'dart:io'; + class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepThreePage( - {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) - : super(key: key); + const NewEReferralStepThreePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); @override - _NewEReferralStepThreePageState createState() => - _NewEReferralStepThreePageState(); + _NewEReferralStepThreePageState createState() => _NewEReferralStepThreePageState(); } class _NewEReferralStepThreePageState extends State { @@ -40,10 +44,15 @@ class _NewEReferralStepThreePageState extends State { List medicalReportImages = []; List insuredPatientImages = []; + List projectsList = []; + bool isPatientInsured = false; AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; + final GlobalKey projectDropdownKey = GlobalKey(); + String projectDropdownValue; + @override void initState() { super.initState(); @@ -52,383 +61,401 @@ class _NewEReferralStepThreePageState extends State { @override Widget build(BuildContext context) { return BaseView( + onModelReady: (model) { + getAllProjects(); + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: false, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Center( - child: Texts( -// TranslationBase.of(context).advancePaymentLabel, - "Other details", - textAlign: TextAlign.center, - ), - ), - SizedBox( - height: 12, - ), - Container( - padding: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 9), - child: Texts( - "Medical Report", - color: Colors.grey, - fontSize: 17, - ), - ), - ], - ), - InkWell( - onTap: () { - ImageOptions.showImageOptions(context, - (String image,File file) { - setState(() { - EReferralAttachment eReferralAttachment = - new EReferralAttachment( - fileName: - 'image ${medicalReportImages.length + 1}.png', - base64String: image); - medicalReportImages - .add(eReferralAttachment); - }); - }, ); - }, - child: Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: Center( - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Icon(Icons.attach_file), - Texts( - 'selected attachment', - variant: 'bodyText', - textAlign: TextAlign.center, - ), - ], - ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Text( + TranslationBase.of(context).otherInfo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).medicalReport, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, ), ), - ), - SizedBox( - height: 12, - ), - ...List.generate( + ...List.generate( medicalReportImages.length, (index) => Container( - margin: EdgeInsets.all(10), - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + padding: EdgeInsets.only(top: 6, bottom: 6), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Icon( - FontAwesomeIcons.paperclip), - SizedBox( - width: 8, - ), - Texts( - medicalReportImages[index] - .fileName, - ), - ], + Texts( + medicalReportImages[index].fileName, ), - InkWell( - onTap: () { - setState(() { - medicalReportImages.remove( - medicalReportImages[ - index]); - }); - }, - child: Icon( - FontAwesomeIcons.trashAlt, - color: Colors.red[300], - )) ], ), - )), - ], - ), - ), - SizedBox( - height: 12, - ), - Container( - padding: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 9), - child: Texts( - "Preferred Branch", - color: Colors.grey, - fontSize: 17, + InkWell( + onTap: () { + setState(() { + medicalReportImages.remove(medicalReportImages[index]); + }); + }, + child: Icon( + Icons.close, + color: Colors.red[300], + )) + ], ), ), - ], - ), - InkWell( - onTap: () => - confirmSelectCityDialog(model.allCities), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts(getRelationName()), - Icon(Icons.arrow_drop_down) - ], + ), + InkWell( + onTap: () { + ImageOptions.showImageOptions( + context, + (String image, File file) { + setState(() { + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image); + medicalReportImages.add(eReferralAttachment); + }); + }, + ); + }, + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 12), + child: Text( + TranslationBase.of(context).selectAttachment, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + decoration: TextDecoration.underline, + color: CustomColors.accentColor, + ), + ), ), ), - ), - ], + ], + ), ), - ), - SizedBox( - height: 12, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( + Icon(Icons.attach_file), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.only(top: 10), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Column( + children: [ + Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + 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).preferredBranch, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + key: projectDropdownKey, + hint: Text(TranslationBase.of(context).selectPreferredBranch), + value: projectDropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString() + "," + item.name.toString(), + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + print(projectDropdownValue); + }); + }, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], + )), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + // decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, children: [ - Row( - children: [ - Checkbox( - value: isPatientInsured, - activeColor: Colors.black38, - onChanged: (bool newValue) { - setState(() { - isPatientInsured = newValue; - }); - }), - Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - "Insured Patient", - fontSize: 17, - ), - ), - ], + Checkbox( + value: isPatientInsured, + activeColor: CustomColors.accentColor, + onChanged: (bool newValue) { + setState(() { + isPatientInsured = newValue; + }); + }), + Padding( + padding: const EdgeInsets.all(5.0), + child: Text( + TranslationBase.of(context).insuredPatientReferral, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600), + ), ), ], ), ], ), + ], + ), + ), + if (isPatientInsured) + SizedBox( + height: 12, + ), + Opacity( + opacity: isPatientInsured ? 1 : 0, + child: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, ), - if (isPatientInsured) - SizedBox( - height: 12, - ), - Opacity( - opacity: isPatientInsured ? 1 : 0, - child: Container( - padding: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), - child: Column( - children: [ - InkWell( - onTap: () { - ImageOptions.showImageOptions(context, - (String image,File file) { - setState(() { - EReferralAttachment - eReferralAttachment = - new EReferralAttachment( - fileName: - 'image ${medicalReportImages.length + 1}.png', - base64String: image); - - insuredPatientImages = [ - eReferralAttachment - ]; - }); - }); - }, - child: Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: Center( - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Icon(Icons.attach_file), - Texts( - 'selected attachment', - variant: 'bodyText', - textAlign: TextAlign.center, - ), - ], - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).medicalReport, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, ), ), - ), - SizedBox( - height: 12, - ), - ...List.generate( + ...List.generate( insuredPatientImages.length, (index) => Container( - margin: EdgeInsets.all(10), - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + padding: EdgeInsets.only(top: 6, bottom: 6), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Icon(FontAwesomeIcons - .paperclip), - SizedBox( - width: 8, - ), - Texts( - 'image ${index + 1}.png', - ), - ], + Texts( + 'image ${index + 1}.png', ), - InkWell( - onTap: () { - setState(() { - insuredPatientImages.remove( - insuredPatientImages[ - index]); - }); - }, - child: Icon( - FontAwesomeIcons.trashAlt, - color: Colors.red[300], - )) ], ), - )), - ], + InkWell( + onTap: () { + setState(() { + insuredPatientImages.remove(insuredPatientImages[index]); + }); + }, + child: Icon( + Icons.close, + color: Colors.red[300], + ), + ) + ], + ), + ), + ), + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, (String image, File file) { + setState(() { + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image); + + insuredPatientImages = [eReferralAttachment]; + }); + }); + }, + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12), + child: Text( + TranslationBase.of(context).selectAttachment, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + decoration: TextDecoration.underline, + color: CustomColors.accentColor, + ), + ), + ), + ), + ], + ), ), - ), + Icon(Icons.attach_file), + ], ), - SizedBox( - height: 12, - ), - ], + ), ), - ), + ], ), ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + color: Theme.of(context).scaffoldBackgroundColor, width: double.infinity, padding: EdgeInsets.all(9), - child: SecondaryButton( - textColor: Colors.white, - label: "Submit", - onTap: () async { - this - .widget - .createEReferralRequestModel - .medicalReportAttachment = medicalReportImages; - this - .widget - .createEReferralRequestModel - .insuranceCardAttachment = - insuredPatientImages.length != 0 - ? insuredPatientImages[0] - : null; - this.widget.createEReferralRequestModel.isInsuredPatient = - isPatientInsured; - // ToDo make the preferred Branch info dynamic - this.widget.createEReferralRequestModel.preferredBranchCode = - 15; - this.widget.createEReferralRequestModel.preferredBranchName = - "Arryan Hospital"; - this.widget.createEReferralRequestModel.otherRelationship = - ""; - - await model - .createEReferral(this.widget.createEReferralRequestModel); - if(model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else{ - AppToast.showSuccessToast(message: "Referral sent successfully"); - - } - }, - loading: model.state == ViewState.BusyLocal, - disabled: medicalReportImages.length == 0, + child: DefaultButton( + TranslationBase.of(context).submit, + medicalReportImages.length == 0 + ? null + : () async { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + this.widget.createEReferralRequestModel.medicalReportAttachment = medicalReportImages; + this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length != 0 ? insuredPatientImages[0] : null; + this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; + // ToDo make the preferred Branch info dynamic + this.widget.createEReferralRequestModel.preferredBranchCode = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? num.tryParse(projectDropdownValue.split(",")[0]) : 0; + this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? projectDropdownValue.split(",")[1] : ""; + // this.widget.createEReferralRequestModel.otherRelationship = ""; + await model.createEReferral(this.widget.createEReferralRequestModel); + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Utils.showErrorToast(model.error); + } else { + GifLoaderDialogUtils.hideDialog(context); + // AppToast.showSuccessToast(message: TranslationBase.of(context).ereferralSaveSuccess); + showCMCConfirmDialog( + context, + model.referralNumber, + onClick: () { + Navigator.pop(context); + }, + ); + } + }); + }, + disabledColor: Colors.grey, + color: Color(0xff359846), ), + + // SecondaryButton( + // textColor: Colors.white, + // label: "Submit", + // onTap: () async { + // this + // .widget + // .createEReferralRequestModel + // .medicalReportAttachment = medicalReportImages; + // this + // .widget + // .createEReferralRequestModel + // .insuranceCardAttachment = + // insuredPatientImages.length != 0 + // ? insuredPatientImages[0] + // : null; + // this.widget.createEReferralRequestModel.isInsuredPatient = + // isPatientInsured; + // // ToDo make the preferred Branch info dynamic + // this.widget.createEReferralRequestModel.preferredBranchCode = + // 15; + // this.widget.createEReferralRequestModel.preferredBranchName = + // "Arryan Hospital"; + // this.widget.createEReferralRequestModel.otherRelationship = + // ""; + // + // await model + // .createEReferral(this.widget.createEReferralRequestModel); + // if(model.state == ViewState.ErrorLocal) { + // Utils.showErrorToast(model.error); + // } else{ + // AppToast.showSuccessToast(message: "Referral sent successfully"); + // } + // }, + // loading: model.state == ViewState.BusyLocal, + // disabled: medicalReportImages.length == 0, + // ), ))); } + void getAllProjects() { + 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; + }); + // isProjectLoaded = true; + } else { + // isProjectLoaded = false; + } + }).catchError((err) { + print(err); + }); + } + void confirmSelectCityDialog(List cities) { showDialog( context: context, diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 5f85fe12..57341838 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -7,18 +7,20 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.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/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../dialogs/select_city_dialog.dart'; - class NewEReferralStepTowPage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; @@ -32,20 +34,14 @@ class NewEReferralStepTowPage extends StatefulWidget { class _NewEReferralStepTowPageState extends State { TextEditingController _patientNameTextController = TextEditingController(); TextEditingController _patientIdentificationTextController = TextEditingController(); - TextEditingController _mobileTextController = TextEditingController(); - GetAllCitiesResponseModel _selectedCity ; + String mobileNo = ""; + GetAllCitiesResponseModel _selectedCity; + GetAllSharedRecordsByStatusList selectedPatientFamily; // todo create a model for Country // todo use country from the json - dynamic _selectedCountry = { - "name": "Saudi Arabia", - "name_ar": "المملكة العربية السعودية", - "code": "+966", - "countryCode": "SA", - "pattern": "5xxxxxxxx", - "maxLength": 9 - }; + dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; @@ -57,152 +53,221 @@ class _NewEReferralStepTowPageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getAllCities(), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - Center( - child: Texts( -// TranslationBase.of(context).advancePaymentLabel, - "Patient information", - textAlign: TextAlign.center, - ), - ), - SizedBox( - height: 12, + onModelReady: (model) => model.getAllCities(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Text( + TranslationBase.of(context).patientInfo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), - NewTextFields( - hintText: "Enter Identification Number", - controller: _patientIdentificationTextController, - keyboardType:TextInputType.number , + ), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).enterIdentificationNumber, "", _patientIdentificationTextController, isInputTypeNum: true), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).patientName, "", _patientNameTextController, isInputTypeNum: false), + SizedBox( + height: 12, + ), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + _selectedCountry = value; + }); + }), + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).patientLocated, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: "Enter Patient Name", - controller: _patientNameTextController, - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectCountryTypeDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getCountryName()), - Icon(Icons.arrow_drop_down) - ], - ), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), ), - SizedBox( - height: 12, - ), - MobileNumberTextFiled( - controller: _mobileTextController, - code: _selectedCountry == null - ? "11" - : _selectedCountry["code"], - ), - SizedBox( - height: 12, - ), - Center( - child: Texts( -// TranslationBase.of(context).advancePaymentLabel, - "Where the patient located", - textAlign: TextAlign.center, + child: InkWell( + onTap: () => confirmSelectCityDialog(model.allCities), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectCity, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getRelationName(), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), + ], ), ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectCityDialog( - model.allCities), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getRelationName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - - SizedBox( - height: 12, - ), - ], - ), + ), + SizedBox( + height: 12, + ), + ], ), ), ), ), - bottomSheet: Container( - height: MediaQuery - .of(context) - .size - .height * 0.1, - width: double.infinity, - padding: EdgeInsets.all(9), - child: SecondaryButton( - textColor: Colors.white, - label: "Next", - onTap: () async { - this.widget.changePageViewIndex(2); - this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text); - this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text; - this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; - this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString(); - this.widget.createEReferralRequestModel.cityName = _selectedCity.description; - - - }, - loading: model.state == ViewState.BusyLocal, - disabled: - _patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty|| - _selectedCity == null || - _mobileTextController.text.isEmpty, + Container( + margin: EdgeInsets.zero, + decoration: cardRadius(0), + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + child: DefaultButton( + TranslationBase.of(context).next, + (_patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty || _selectedCity == null || mobileNo.isEmpty) + ? null + : () { + this.widget.changePageViewIndex(2); + this.widget.createEReferralRequestModel.identificationNo = int.parse(_patientIdentificationTextController.text); + this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text; + this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString() + mobileNo; + this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString(); + this.widget.createEReferralRequestModel.cityName = _selectedCity.description; + }, + disabledColor: Colors.grey, + ), ), - ))); - + ) + ], + ), + ), + ); + } + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } - void confirmSelectCityDialog( - List cities) { + void confirmSelectCityDialog(List cities) { showDialog( context: context, child: SelectCityDialog( @@ -235,7 +300,7 @@ class _NewEReferralStepTowPageState extends State { if (_selectedCity != null) return _selectedCity.description; else - return "Select City" /*TranslationBase.of(context).selectHospital*/; + return TranslationBase.of(context).selectCity /*TranslationBase.of(context).selectHospital*/; } String getCountryName() { @@ -247,12 +312,7 @@ class _NewEReferralStepTowPageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({ - Key key, - this.controller, - this.code - }) : super(key: key); - + const MobileNumberTextFiled({Key key, this.controller, this.code}) : super(key: key); final TextEditingController controller; final String code; @@ -261,8 +321,7 @@ class MobileNumberTextFiled extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.white), child: Row(children: [ Expanded( flex: 1, @@ -283,8 +342,7 @@ class MobileNumberTextFiled extends StatelessWidget { child: TextField( controller: controller, keyboardType: TextInputType.phone, - decoration: InputDecoration( - border: InputBorder.none, hintText: 'Mobile No'), + decoration: InputDecoration(border: InputBorder.none, hintText: TranslationBase.of(context).mobileNumber), ), ), ) diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart index 2fb7e41a..52338edd 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart @@ -10,8 +10,7 @@ class SelectCityDialog extends StatefulWidget { final Function(GetAllCitiesResponseModel) onValueSelected; GetAllCitiesResponseModel selectedCity; - SelectCityDialog( - {Key key, this.cities, this.onValueSelected, this.selectedCity}); + SelectCityDialog({Key key, this.cities, this.onValueSelected, this.selectedCity}); @override _SelectCityDialogState createState() => _SelectCityDialogState(); @@ -26,104 +25,109 @@ class _SelectCityDialogState extends State { @override Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.cities.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, + return Dialog( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedCity = widget.cities[index]; - }); - }, - child: ListTile( - title: Text(widget.cities[index].description), - leading: Radio( - value: widget.cities[index], - groupValue: widget.selectedCity, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedCity = value; - }); - }, - ), - ), + ...List.generate( + widget.cities.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, ), - ) - ], - ), - SizedBox( - height: 5.0, + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedCity = widget.cities[index]; + }); + }, + child: ListTile( + title: Text(widget.cities[index].description), + leading: Radio( + value: widget.cities[index], + groupValue: widget.selectedCity, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedCity = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), ), ], ), ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, ), ), ), ), ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedCity); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedCity); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), ), ), - ], - ) - ], - ) - ], + ), + ], + ) + ], + ), ); } } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart index d58fd29f..8046346f 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart @@ -4,6 +4,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // ignore: must_be_immutable + +// todo 'sikander' remove this file when usage known class SelectCountryDialog extends StatefulWidget { final Function(dynamic) onValueSelected; dynamic selectedCountry; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart deleted file mode 100644 index f4c8d989..00000000 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart +++ /dev/null @@ -1,137 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// ignore: must_be_immutable -class SelectSearchCriteriaDialog extends StatefulWidget { - List searchCriteria = [ - SearchCriteriaModel(name: "Identification Number",nameAr:"رقم المحول",value: 1), - SearchCriteriaModel(name: "Referral Number",nameAr:"رقم المحول",value: 2), - ]; - final Function(SearchCriteriaModel) onValueSelected; - SearchCriteriaModel selectedCriteria; - - SelectSearchCriteriaDialog( - {Key key, this.onValueSelected, this.selectedCriteria}); - - @override - _SelectSearchCriteriaDialogState createState() => _SelectSearchCriteriaDialogState(); -} - -class _SelectSearchCriteriaDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedCriteria = widget.selectedCriteria ?? widget.searchCriteria[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Texts(" Select Search Criteria", fontSize: 20,), - Divider(), - ...List.generate( - widget.searchCriteria.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedCriteria = widget.searchCriteria[index]; - }); - }, - child: ListTile( - title: Text(widget.searchCriteria[index].name), - leading: Radio( - value: widget.searchCriteria[index], - groupValue: widget.selectedCriteria, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedCriteria = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedCriteria); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} - - - - diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart index ba9a123d..f7915c68 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart @@ -333,8 +333,6 @@ class _EReferralConfirmSMSDialogState extends State { if (verifyAccountForm.currentState.validate()) { final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; - - // ToDo call service CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel= new CheckActivationCodeForEReferralResponseModel(activationCode: activationCode); await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index 9007229a..78d3bca3 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -2,8 +2,8 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class EReferralPage extends StatefulWidget { @override @@ -35,9 +36,13 @@ class _EReferralPageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( + onModelReady: (model) => model.getAllCities(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).ereferral, description: TranslationBase.of(context).eReferralInfo, imagesInfo: [ @@ -48,90 +53,46 @@ class _EReferralPageState extends State 'https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png', ) ], - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).newReferral, - textAlign: TextAlign.center, - ), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).searchForReferrals, - textAlign: TextAlign.center, - ), - ), - ), - ], - ), - ), - ), - ), + body: Column( + children: [ + TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: + EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Text(TranslationBase.of(context).newReferral), + Text(TranslationBase.of(context).searchForReferrals), ], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - StartIndexForNewEReferral(), - SearchForReferralsPage() - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + + controller: _tabController, + children: [ + StartIndexForNewEReferral(), + SearchForReferralsPage() + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart new file mode 100644 index 00000000..1baab531 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart @@ -0,0 +1,137 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ReferralDetails extends StatefulWidget { + final SearchEReferralResponseModel referral; + + const ReferralDetails({Key key, @required this.referral}) : super(key: key); + + @override + _ReferralDetailsState createState() => _ReferralDetailsState(); +} + +class _ReferralDetailsState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).ereferral, + body: Column( + children: [ + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(TranslationBase.of(context).ereferral, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).referralStatus), + ), + Expanded( + child: _getNormalText(projectViewModel.isArabic ? widget.referral.statusAr : widget.referral.status, isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[600]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientName), + ), + Expanded( + child: _getNormalText(widget.referral.patientName, isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[600]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).referralNumber), + ), + Expanded( + child: _getNormalText(widget.referral.referralNumber.toString(), isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[600]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).referralDate), + ), + Expanded( + child: _getNormalText(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(widget.referral.referralDate)), isBold: true), + ) + ], + ), + ), + mDivider(Colors.grey[600]), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).hospital), + ), + Expanded( + child: _getNormalText(widget.referral.preferredBranchName ?? "", isBold: true), + ) + ], + ), + ), + ], + ), + ), + )), + ], + )); + } + + _getNormalText(text, {bool isBold = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold ? 14 : 12, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index 906108d4..5751dcfe 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -2,19 +2,27 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/referral_details.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; -import 'New_E_Referral/new_e_referral_step_one_page.dart'; import 'dialogs/select_country_ingo_Dialog.dart'; -import 'dialogs/select_search_criteria_dialog.dart'; class SearchForReferralsPage extends StatefulWidget { SearchForReferralsPage({Key key}); @@ -26,25 +34,36 @@ class SearchForReferralsPage extends StatefulWidget { class _SearchForReferralsPageState extends State { TextEditingController _searchTextController = TextEditingController(); - TextEditingController _mobileTextController = TextEditingController(); + String mobileNo = ""; bool _isSubmitted = false; - dynamic _selectedCountry = { - "name": "Saudi Arabia", - "name_ar": "المملكة العربية السعودية", - "code": "+966", - "countryCode": "SA", - "pattern": "5xxxxxxxx", - "maxLength": 9 - }; + dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; - SearchCriteriaModel selectedCriteria = SearchCriteriaModel( - name: "Identification Number", nameAr: "رقم المحول", value: 1); + SearchCriteriaModel selectedCriteria = SearchCriteriaModel(name: "Identification Number", nameAr: "رقم الهوية", value: 1); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getAllCities(), + onModelReady: (model) async { + if (projectViewModel.isLogin) { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + GifLoaderDialogUtils.showMyDialog(context); + SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel( + patientMobileNumber: (projectViewModel.user.outSA == 0 ? "966" : "971") + projectViewModel.user.mobileNumber.substring(1, projectViewModel.user.mobileNumber.length), + ); + if (selectedCriteria.value == 1) { + searchEReferralRequestModel.identificationNo = _searchTextController.text; + searchEReferralRequestModel.referralNumber = 0; + } else { + searchEReferralRequestModel.referralNumber = int.parse(_searchTextController.text); + searchEReferralRequestModel.identificationNo = projectViewModel.user.patientIdentificationNo; + } + await model.getEReferrals(searchEReferralRequestModel); + GifLoaderDialogUtils.hideDialog(context); + }); + } + }, builder: (_, model, widget) => AppScaffold( isShowAppBar: false, baseViewModel: model, @@ -53,147 +72,156 @@ class _SearchForReferralsPageState extends State { child: Container( margin: EdgeInsets.all(12), child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 77, - ), - InkWell( - onTap: () => selectSearchCriteriaDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getSearchCriteriaName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: selectedCriteria.value == 1 - ? "Enter Patient Identification No" - : "Enter Referral Number", - controller: _searchTextController, - onChanged: (_){ - setState(() { - - }); - }, - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectCountryTypeDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getCountryName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - MobileNumberTextFiled( - controller: _mobileTextController, - onChange: (_){ - setState(() { - - }); - }, - - code: _selectedCountry == null - ? "11" - : _selectedCountry["code"], - ), - SizedBox( - height: 12, - ), - if ((model.state == ViewState.Idle && - model.allReferral.length == 0)) - Text("There's No Referral To deliver"), - if (( - model.state == ViewState.ErrorLocal)) - AppEmbeddedError( error:model.error), - NetworkBaseView( - baseViewModel: model, - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: model.allReferral == null - ? 0 - : model.allReferral.length < 3 - ? model.allReferral.length - : 3, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 0.2), - child: Container( - child: Texts("TODO add referral info"), - ), - ); + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + CommonDropDownView(TranslationBase.of(context).selectSearchCriteria, getSearchCriteriaName(projectViewModel), () { + List searchCriteria = [ + SearchCriteriaModel(name: "Identification Number", nameAr: "رقم الهوية", value: 1), + SearchCriteriaModel(name: "Referral Number", nameAr: "رقم الإحالة", value: 2), + ]; + List list = []; + for (int i = 0; i < searchCriteria.length; i++) { + list.add(RadioSelectionDialogModel(projectViewModel.isArabic ? searchCriteria[i].nameAr : searchCriteria[i].name, searchCriteria[i].value)); + } + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: selectedCriteria.value, + onValueSelected: (index) { + selectedCriteria = searchCriteria[index - 1]; + setState(() {}); }, ), - ), - ], - ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + inputWidget(selectedCriteria.value == 1 ? TranslationBase.of(context).enterIdentificationNumber : TranslationBase.of(context).referralNumber, "", _searchTextController, + isInputTypeNum: true), + SizedBox(height: 12), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + _selectedCountry = value; + }); + }), + // InkWell( + // onTap: () => confirmSelectCountryTypeDialog(), + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [Texts(getCountryName()), Icon(Icons.arrow_drop_down)], + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // MobileNumberTextFiled( + // controller: _mobileTextController, + // onChange: (_) { + // setState(() {}); + // }, + // code: _selectedCountry == null ? "11" : _selectedCountry["code"], + // ), + SizedBox(height: 12), + if ((model.state == ViewState.Idle && model.allReferral.length == 0)) Center(child: Text(TranslationBase.of(context).noSearchResult)), + if ((model.state == ViewState.ErrorLocal)) AppEmbeddedError(error: model.error), + model.allReferral.length > 0 + ? NetworkBaseView( + baseViewModel: model, + child: ListView.separated( + separatorBuilder: (context, index) => SizedBox(height: 0), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: model.allReferral == null ? 0 : model.allReferral.length, + itemBuilder: (BuildContext context, int index) { + return Container( + width: double.infinity, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferralDetails(referral: model.allReferral[index]), + ), + ); + }, + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(projectViewModel.isArabic ? model.allReferral[index].statusAr : model.allReferral[index].status, + style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(top: 5.0), + child: MyRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName, projectViewModel.isArabic)), + MyRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).referralDate + ": ", + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate)), projectViewModel.isArabic), + ], + ), + Icon(projectViewModel.isArabic ? Icons.arrow_back_ios_outlined : Icons.arrow_forward_outlined), + ], + ), + ), + ), + ), + ); + }, + ), + ) + : Container(), + SizedBox( + height: 80.0, + ) + ], ), ), ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + color: Theme.of(context).scaffoldBackgroundColor, width: double.infinity, - padding: EdgeInsets.all(9), - child: SecondaryButton( - textColor: Colors.white, - label: "Search", - onTap: () async { - SearchEReferralRequestModel searchEReferralRequestModel = - new SearchEReferralRequestModel( - patientMobileNumber: - _selectedCountry['code'] + _mobileTextController.text, - ); - if (selectedCriteria.value == 1) { - searchEReferralRequestModel.identificationNo = - _searchTextController.text; - searchEReferralRequestModel.referralNumber = 0; - } else { - searchEReferralRequestModel.referralNumber = - int.parse(_searchTextController.text); - searchEReferralRequestModel.identificationNo = ''; - } - await model.getEReferrals(searchEReferralRequestModel); - setState(() { - _isSubmitted = true; - }); - }, - loading: model.state == ViewState.BusyLocal, - disabled: _searchTextController.text.isEmpty || - _mobileTextController.text.isEmpty, + padding: EdgeInsets.all(14), + child: DefaultButton( + TranslationBase.of(context).search, + (_searchTextController.text.isEmpty || mobileNo.isEmpty) + ? null + : () async { + SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel( + patientMobileNumber: _selectedCountry['code'] + mobileNo, + ); + if (selectedCriteria.value == 1) { + searchEReferralRequestModel.identificationNo = _searchTextController.text; + searchEReferralRequestModel.referralNumber = 0; + } else { + searchEReferralRequestModel.referralNumber = int.parse(_searchTextController.text); + searchEReferralRequestModel.identificationNo = ''; + } + await model.getEReferrals(searchEReferralRequestModel); + setState(() { + _isSubmitted = true; + }); + }, + disabledColor: Colors.grey, ), ))); } @@ -219,21 +247,68 @@ class _SearchForReferralsPageState extends State { return "Country"; } - void selectSearchCriteriaDialog() { - showDialog( - context: context, - child: SelectSearchCriteriaDialog( - selectedCriteria: selectedCriteria, - onValueSelected: (value) { - setState(() { - selectedCriteria = value; - }); - }, + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), - ); + ).withBorderedContainer; } - String getSearchCriteriaName() { - return selectedCriteria.name; + String getSearchCriteriaName(ProjectViewModel projectViewModel) { + return projectViewModel.isArabic ? selectedCriteria.nameAr : selectedCriteria.name; } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart index bfab0324..3db199b2 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart @@ -9,9 +9,7 @@ class ConfirmCancelOrderDialog extends StatefulWidget { final HomeHealthCareViewModel model; final Function onTap; - - ConfirmCancelOrderDialog( - {Key key, this.model, this.onTap}); + ConfirmCancelOrderDialog({Key key, this.model, this.onTap}); @override _ConfirmCancelOrderDialogState createState() => _ConfirmCancelOrderDialogState(); @@ -26,7 +24,7 @@ class _ConfirmCancelOrderDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + contentPadding: EdgeInsets.all(20), title: Center( child: Texts( TranslationBase.of(context).confirm, @@ -37,14 +35,16 @@ class _ConfirmCancelOrderDialogState extends State { Column( children: [ Divider(), + SizedBox( + height: 10.0, + ), Center( child: Texts( - TranslationBase.of(context).cancelOrderMsg , - color: Colors.grey, + TranslationBase.of(context).cancelOrderMsg, ), ), SizedBox( - height: 5.0, + height: 10, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -76,7 +76,7 @@ class _ConfirmCancelOrderDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ + onTap: () async { widget.onTap(); Navigator.pop(context); }, @@ -84,9 +84,9 @@ class _ConfirmCancelOrderDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), ), ), ), @@ -98,6 +98,3 @@ class _ConfirmCancelOrderDialogState extends State { ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index 0e013ebf..58d66b3d 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -21,132 +21,115 @@ class LocationPage extends StatefulWidget { final double longitude; final dynamic model; - const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) - : super(key: key); + const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); @override - _LocationPageState createState() => - _LocationPageState(); + _LocationPageState createState() => _LocationPageState(); } -class _LocationPageState - extends State { +class _LocationPageState extends State { double latitude = 0; double longitude = 0; bool showCurrentLocation = false; @override void initState() { - latitude = widget.latitude; longitude = widget.longitude; - if(latitude == 0.0 && longitude == 0.0) { + if (latitude == 0.0 && longitude == 0.0) { showCurrentLocation = true; } super.initState(); } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) {}, builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).addAddress, - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - AddNewAddressRequestModel - addNewAddressRequestModel = - new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: - selectedPlace.formattedAddress, - address2: selectedPlace - .formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); - - selectedPlace.addressComponents.forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel.customer - .addresses[0].country = e.longName; - } - if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer - .addresses[0].zipPostalCode = - e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel.customer - .addresses[0].city = - e.longName; - } - }); + appBarTitle: TranslationBase.of(context).addAddress, + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); - await model.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: "Address Added Successfully"); - } - Navigator.of(context).pop(addNewAddressRequestModel); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), - ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(addNewAddressRequestModel); + }, + label: TranslationBase.of(context).addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + )); } } 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 86ee791b..f8e377b7 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 @@ -1,47 +1,37 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; class NewHomeHealthCareStepOnePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepOnePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.model, - this.changePageViewIndex}) - : super(key: key); + const NewHomeHealthCareStepOnePage({Key key, this.patientERInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key); @override - _NewHomeHealthCareStepOnePageState createState() => - _NewHomeHealthCareStepOnePageState(); + _NewHomeHealthCareStepOnePageState createState() => _NewHomeHealthCareStepOnePageState(); } -class _NewHomeHealthCareStepOnePageState - extends State { +class _NewHomeHealthCareStepOnePageState extends State { PickResult _result; @override void initState() { - if (widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList == - null) - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList = []; + if (widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList == null) widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = []; super.initState(); } @@ -52,124 +42,89 @@ class _NewHomeHealthCareStepOnePageState return AppScaffold( isShowAppBar: false, baseViewModel: widget.model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: Center( - child: FractionallySizedBox( - widthFactor: 1, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Texts( - TranslationBase.of(context).selectHomeHealthCareServices, - textAlign: TextAlign.center, - ), - Column( - children: widget.model.hhcAllServicesList.map((service) { - return Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - child: Column( - children: [ - Row( - children: [ - Checkbox( - value: isServiceSelected(service.serviceID), - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (!isServiceSelected( - service.serviceID)) - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .add(PatientERHHCInsertServicesList( - recordID: widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length, - serviceID: service.serviceID, - serviceName: - service.description)); - else - removeSelected(service.serviceID); - // widget.patientERInsertPresOrderRequestModel - // isPatientInsured = newValue; - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - projectViewModel.isArabic - ? service.descriptionN - : service.description, - fontSize: 15, - ), - ), - ), - ], - ), - ], + body: Column( + children: [ + Expanded( + child: ListView.separated( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 12), + itemBuilder: (context, index) { + HHCGetAllServicesResponseModel service = widget.model.hhcAllServicesList[index]; + + return Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Row( + children: [ + Checkbox( + value: isServiceSelected(num.tryParse(service.serviceID)), + activeColor: Color(0xffD02127), + tristate: false, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onChanged: (bool newValue) { + setState(() { + if (!isServiceSelected(num.tryParse(service.serviceID))) + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList( + recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, + serviceID: num.tryParse(service.serviceID), + serviceName: projectViewModel.isArabic ? service.textN : service.text)); + else + removeSelected(num.tryParse(service.serviceID)); + // widget.patientERInsertPresOrderRequestModel + // isPatientInsured = newValue; + }); + }), + SizedBox(width: 6), + Expanded( + child: Text( + projectViewModel.isArabic ? service.textN : service.text.toLowerCase()?.capitalize(), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ), + ], + ), + ); + }, + separatorBuilder: (context, index) => Divider( + height: 1, + color: Color(0xffE5E5E5), + ), + itemCount: widget.model.hhcAllServicesList.length), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).next, + (this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal) + ? null + : () async { + widget.model.setState(ViewState.Busy); + await widget.model.getCustomerInfo(); + Navigator.push( + context, + FadePage( + page: NewHomeHealthCareStepTowPage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, + ), ), ); - }).toList(), - ) - ], - ), + // } + }, + disabledColor: Color(0xff575757), ), ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).next, - disabled: this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length == - 0 || - widget.model.state == ViewState.BusyLocal, - color: Colors.grey[800], - loading: widget.model.state == ViewState.BusyLocal, - onTap: () async { - await widget.model.getCustomerInfo(); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(); - } else { - widget.changePageViewIndex(1); - } - }, - textColor: Theme.of(context).backgroundColor), - ), - ], - ), + ], ), ); } isServiceSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) { return true; } @@ -178,15 +133,11 @@ class _NewHomeHealthCareStepOnePageState removeSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) setState(() { - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .remove(patientERHHCInsertServicesList.first); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList.first); }); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart index 5e9bd04d..d580f2bb 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart @@ -4,34 +4,34 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_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/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.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/secondary_button.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/data_display/text.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:google_maps_flutter/google_maps_flutter.dart'; import 'package:provider/provider.dart'; class NewHomeHealthCareStepThreePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - NewHomeHealthCareStepThreePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}); + NewHomeHealthCareStepThreePage({Key key, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}); @override - _NewHomeHealthCareStepThreePageState createState() => - _NewHomeHealthCareStepThreePageState(); + _NewHomeHealthCareStepThreePageState createState() => _NewHomeHealthCareStepThreePageState(); } -class _NewHomeHealthCareStepThreePageState - extends State { +class _NewHomeHealthCareStepThreePageState extends State { Completer _controller = Completer(); static CameraPosition _kGooglePlex = CameraPosition( @@ -42,22 +42,17 @@ class _NewHomeHealthCareStepThreePageState @override void initState() { - if (widget.patientERInsertPresOrderRequestModel.latitude != null) { markers.clear(); markers.add( Marker( markerId: MarkerId( - widget.patientERInsertPresOrderRequestModel.latitude.hashCode - .toString(), + widget.patientERInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng( - widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude), + target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude), zoom: 14.4746, ); } @@ -71,6 +66,9 @@ class _NewHomeHealthCareStepThreePageState return AppScaffold( isShowDecPage: false, baseViewModel: widget.model, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( @@ -79,62 +77,104 @@ class _NewHomeHealthCareStepThreePageState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderDetails, fontWeight: FontWeight.bold,), - SizedBox( - height: 12, - ), Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), - padding: EdgeInsets.all(8), + padding: EdgeInsets.only(top: 12.0, bottom: 12.0), + child: Texts( + TranslationBase.of(context).RRTSummary, + fontWeight: FontWeight.bold, + fontSize: 22, + )), + Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), + padding: EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderLocation, fontWeight: FontWeight.bold), + Text( + TranslationBase.of(context).selectedLocation, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + letterSpacing: -0.56, + ), + ), SizedBox( height: 12, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( + Container( height: 200, - child: GoogleMap( - mapType: MapType.normal, - markers: markers, - initialCameraPosition: _kGooglePlex, - onMapCreated: (GoogleMapController controller) { - _controller.complete(controller); - }, - ), - ), - ), + // child: GoogleMap( + // mapType: MapType.normal, + // markers: markers, + // initialCameraPosition: _kGooglePlex, + // onMapCreated: (GoogleMapController controller) { + // _controller.complete(controller); + // }, + // ), + decoration: containerColorRadiusBorderWidth(Colors.transparent, 12,Colors.transparent,0.5), + clipBehavior: Clip.antiAlias, + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=" + + widget.patientERInsertPresOrderRequestModel.latitude.toString() + + "," + + widget.patientERInsertPresOrderRequestModel.longitude.toString() + + "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + + widget.patientERInsertPresOrderRequestModel.latitude.toString() + + "," + + widget.patientERInsertPresOrderRequestModel.longitude.toString() + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + )), SizedBox( height: 12, ), - Texts(TranslationBase.of(context).selectedService + " : ", fontWeight: FontWeight.bold), + Text( + TranslationBase.of(context).selectedService, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + letterSpacing: -0.56, + ), + ), ...List.generate( - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length, + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // ), SizedBox( height: 5, ), - Texts( - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList[index] - .serviceName, - fontSize: 15, - bold: true, - ), + Row( + children: [ + Text( + (index + 1).toString() + '. ', + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: CustomColors.black, + letterSpacing: -0.48, + ), + ), + Text( + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList[index].serviceName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: CustomColors.black, + letterSpacing: -0.48, + ), + ), + ], + ) ], ), ), @@ -150,29 +190,53 @@ class _NewHomeHealthCareStepThreePageState ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, + color: Theme.of(context).scaffoldBackgroundColor, width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).confirm, - disabled: widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length == - 0, - color: Colors.grey[800], - onTap: () async { - await widget.model.insertPresPresOrder( - order: widget.patientERInsertPresOrderRequestModel); - if (widget.model.state != ViewState.ErrorLocal) { - widget.changePageViewIndex(0); - } - }, - textColor: Theme.of(context).backgroundColor), - ), - ], + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).confirm, + () { + widget.model.setState(ViewState.Busy); + widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel).then((value) { + widget.model.setState(ViewState.Idle); + if (widget.model.state != ViewState.ErrorLocal) { + if (widget.model.orderId != null) { + showCMCConfirmDialog( + context, + widget.model.orderId.toString(), + onClick: () { + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: HomeHealthCarePage)); + Navigator.push(context, FadePage(page: HomeHealthCarePage())); + }, + ); + } + } else { + AppToast.showErrorToast(message: widget.model.error); + } + }); + }, + color: CustomColors.green, + ), ), + + // SecondaryButton( + // label: TranslationBase.of(context).confirm, + // disabled: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0, + // color: Colors.grey[800], + // onTap: () async { + // widget.model.setState(ViewState.Busy); + // widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel).then((value) => { + // widget.model.setState(ViewState.Idle), + // Navigator.push( + // context, + // FadePage( + // page: HomeHealthCarePage(), + // ), + // ) + // }); + // }, + // textColor: Theme.of(context).backgroundColor), ), ); } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 1b96cdc8..31518f61 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -1,208 +1,287 @@ -import 'package:diplomaticquarterapp/config/config.dart'; +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.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:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart'; import 'location_page.dart'; +import 'package:geolocator/geolocator.dart'; class NewHomeHealthCareStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; final double longitude; - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepTowPage( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}) - : super(key: key); + const NewHomeHealthCareStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}) : super(key: key); @override - _NewHomeHealthCareStepTowPageState createState() => - _NewHomeHealthCareStepTowPageState(); + _NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState(); } -class _NewHomeHealthCareStepTowPageState - extends State { +class _NewHomeHealthCareStepTowPageState extends State { double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; bool showCurrentLocation = false; - - + final Set markers = new Set(); + AppMap appMap; + AppSharedPreferences sharedPref = AppSharedPreferences(); + static CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + LatLng currentPostion; + Completer mapController = Completer(); @override void initState() { - if (widget.patientERInsertPresOrderRequestModel.latitude == null) { - setLatitudeAndLongitude(); + appMap = AppMap( + _kGooglePlex.toMap(), + onCameraMove: (camera) { + _updatePosition(camera); + }, + onMapCreated: () { + // goToCurrentLocation(); + _getUserLocation(); + setState(() {}); + }, + ); + super.initState(); + } + + void _getUserLocation() async { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + var lat = await this.sharedPref.getDouble(USER_LAT); + var long = await this.sharedPref.getDouble(USER_LONG); + latitude = lat; + longitude = long; + currentPostion = LatLng(lat, long); + setMap(); } else { - latitude = widget.patientERInsertPresOrderRequestModel.latitude; - longitude = widget.patientERInsertPresOrderRequestModel.longitude; + if (await Permission.location.request().isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } else { + requestPermissions().then( + (value) async { + if (value[Permission.location].isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } + }, + ); + } } - - super.initState(); } setLatitudeAndLongitude({bool isSetState = false, String latLong}) { - if (latLong == null){ - if(widget.model.addressesList.isEmpty) { + if (latLong == null) { + if (widget.model.addressesList.isEmpty) { setState(() { showCurrentLocation = true; }); } else { - latLong = widget.model.addressesList[widget.model.addressesList - .length - 1].latLong; + latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong; } - } - if(!showCurrentLocation) { + if (!showCurrentLocation) { List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); + currentPostion = LatLng(latitude, longitude); + setMap(); } + } + setMap() { + setState(() { + _kGooglePlex = CameraPosition( + target: currentPostion, + zoom: 14.4746, + ); + appMap.moveTo(cameraPostion: _kGooglePlex); + }); } @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, - body: Stack( + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, + body: Column( children: [ - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: - LocationPage( - latitude: latitude, - longitude: longitude, - ), - ), - ); - }, - label: TranslationBase.of(context).addNewAddress, - ), - SizedBox(height: 10,), - SecondaryButton( - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientERInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.patientERInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, - ), - ], + if (widget.model.addressesList.isNotEmpty) + Container( + margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12), + decoration: cardRadius(12), + child: Container( + child: InkWell( + onTap: () => confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(8), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + getAddressName(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.45, + ), + ), + ), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 50, + width: double.infinity, + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, ), ), ); }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), + child: Row( + children: [ + Icon(Icons.add_circle_outline_sharp), + mWidth(12), + Text( + TranslationBase.of(context).addNewAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + ], + ), + ), ), - if(widget.model.addressesList.isNotEmpty) - Container( - child: InkWell( - onTap: () => - confirmSelectLocationDialog(widget.model.addressesList), - child: Container( - padding: EdgeInsets.all(10), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded(child: Texts(getAddressName(), fontSize: 14,),), - Icon(Icons.arrow_drop_down) - ], + // Expanded( + // child: Stack( + // alignment: Alignment.center, + // children: [ + // GoogleMap( + // mapType: MapType.normal, + // zoomControlsEnabled: false, + // myLocationButtonEnabled: true, + // myLocationEnabled: true, + // initialCameraPosition: _kGooglePlex, + // onCameraMove: ((_position) => _updatePosition(_position)), + // onMapCreated: (GoogleMapController controller) { + // googleMapController = controller; + // _controller.complete(controller); + // }, + // ), + // Icon( + // Icons.place, + // color: CustomColors.accentColor, + // size: 50, + // ), + // ], + // ), + // ), + Expanded( + child: Stack( + alignment: Alignment.center, + children: [ + if (appMap != null) appMap, + Icon( + Icons.place, + color: CustomColors.accentColor, + size: 50, ), - ), + ], ), - height: 56, width: double.infinity, color: Theme - .of(context) - .scaffoldBackgroundColor, + ), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + child: SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.patientERInsertPresOrderRequestModel.latitude = latitude; + widget.patientERInsertPresOrderRequestModel.longitude = longitude; + }); - ) + navigateTo( + context, + NewHomeHealthCareStepThreePage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ); + }, + label: TranslationBase.of(context).continues, + ), + ), ], ), ); } + void _updatePosition(CameraPosition _position) { + latitude = _position.target.latitude; + longitude = _position.target.longitude; + } void confirmSelectLocationDialog(List addresses) { showDialog( context: context, child: SelectLocationDialog( addresses: addresses, - selectedAddress: _selectedAddress - , + selectedAddress: _selectedAddress, onValueSelected: (value) { setLatitudeAndLongitude(latLong: value.latLong); setState(() { @@ -219,4 +298,27 @@ class _NewHomeHealthCareStepTowPageState else return TranslationBase.of(context).selectAddress; } + + goToCurrentLocation() { + Geolocator.getCurrentPosition().then((value) { + _selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}'); + moveToLocation(LatLng(value.latitude, value.longitude)); + }); + } + + moveToLocation(LatLng location, {bool animate = true}) async { + await Future.delayed(Duration(milliseconds: 200)); + _kGooglePlex = CameraPosition( + target: location, + zoom: 16.4746, + ); + if (animate) + (await mapController.future).animateCamera( + CameraUpdate.newCameraPosition(_kGooglePlex), + ); + else + (await mapController.future).moveCamera( + CameraUpdate.newCameraPosition(_kGooglePlex), + ); + } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index ab564cb7..82f91cff 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -1,42 +1,37 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; -import '../StepsWidget.dart'; import 'new_Home_health_care_step_one_page.dart'; class NewHomeHealthCarePage extends StatefulWidget { NewHomeHealthCarePage({this.model}); final HomeHealthCareViewModel model; + @override _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState(); } -class _NewHomeHealthCarePageState extends State - with TickerProviderStateMixin { +class _NewHomeHealthCarePageState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 1; double _latitude; double _longitude; - PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = - new PatientERInsertPresOrderRequestModel(); + PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); @override void initState() { @@ -64,32 +59,25 @@ class _NewHomeHealthCarePageState extends State setState(() { _currentIndex = tab; }); - _controller.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + _controller.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override Widget build(BuildContext context) { - void showConfirmMessage(HomeHealthCareViewModel model, - GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmCancelOrderDialog( - model: model, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, - editedBy: 3); + model.setState(ViewState.Busy); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + await model.updateHHCPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast( - message: - TranslationBase.of(context).processDoneSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -99,287 +87,211 @@ class _NewHomeHealthCarePageState extends State ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: _changeCurrentTab, + return PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + widget.model.pendingOrder != null + ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ + (Container( + decoration: BoxDecoration( + color: Color(0xffCC9B14), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.pendingOrder != null - ? FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( + 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( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.pendingOrder.statusText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).hospital + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + widget.model.pendingOrder.nearestProjectName.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model.pendingOrder.iD - .toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget.model.pendingOrder - .descriptionN - : widget.model.pendingOrder - .description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil - .getDayMonthYearDateFormatted( - DateUtil - .convertStringToDate( - widget - .model - .pendingOrder - .createdOn)), - fontSize: 22, - ), - ], - ), - ), - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .serviceName, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget - .model - .hhcAllOrderDetail[ - index] - .descriptionN - : widget - .model - .hhcAllOrderDetail[ - index] - .description, - fontSize: 22, - bold: true, - ), - ], - ), - ), - ), - SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery.of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of(context) - .cancel - .toUpperCase(), - onTap: () { - showConfirmMessage( - widget.model, - widget.model - .hhcAllOrderDetail[0]); - }, - color: Colors.red[800], - disabled: false, - textColor: Theme.of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 12, - ), - ], + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), ), - ) - : NewHomeHealthCareStepOnePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ), - NewHomeHealthCareStepTowPage( - latitude: _latitude, - longitude: _longitude, - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ), - NewHomeHealthCareStepThreePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ) - ], + ], + ), + ], + ), ), - ), - ], - ), - ), - ), - ), + )) + ]) + + // FractionallySizedBox( + // widthFactor: 0.9, + // child: SingleChildScrollView( + // child: Container( + // // margin: EdgeInsets.all(10), + // child: Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 12, right: 12, top: 12), + // child: Card( + // shape: cardRadius(12), + // elevation: 2, + // margin: EdgeInsets.zero, + // color: Color(0xffcd9e1b), + // clipBehavior: Clip.antiAlias, + // child: Container( + // // decoration: containerColorRadiusLeft(Colors.white, 12), + // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), + // padding: EdgeInsets.all(12), + // // color: Colors.white, + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // ), + // ), + // // clipBehavior: Clip.antiAlias, + // child: Row( + // children: [ + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus + + // ' ' + + // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + // bold: false, + // fontSize: 12, + // color: Color(0xffcd9e1b), + // fontWeight: FontWeight.bold, + // ), + // Texts( + // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + // fontWeight: FontWeight.w600, + // fontSize: 18, + // ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // fontWeight: FontWeight.w600, + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // child: Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + // fontSize: 13, + // bold: false, + // ), + // ), + // ), + // ], + // )), + // Column( + // children: [ + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 14, + // ), + // mHeight(8), + // // SecondaryButton( + // // onTap: () { + // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // // }, + // // label: TranslationBase.of(context).cancel, + // // color: Colors.red[900], + // // small: true, + // // ) + // ], + // ), + // ], + // ))), + // )))) + : NewHomeHealthCareStepOnePage( + changePageViewIndex: _changeCurrentTab, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ], ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart index 370544d0..dc34d312 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart @@ -1,8 +1,7 @@ -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class StepsWidget extends StatelessWidget { final int index; @@ -12,170 +11,87 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return !projectViewModel.isArabic? Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.42, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2 ? Colors.white : Colors.grey[800], - ), - ), - ), - ), - ), + return showRow(); + } - ], - ):Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( + Widget showRow() { + return Container( + width: double.infinity, + child: Row( + children: [ + InkWell( onTap: () => changeCurrentTab(0), child: Container( width: 35, height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), + decoration: containerColorRadiusBorder( + index == 0 + ? CustomColors.accentColor + : index > 0 + ? Colors.green[700] + : Colors.white, + 2000, + Colors.black), child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + child: Text( + "1", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.42, - child: InkWell( + Expanded(child: mDivider(Colors.grey)), + InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( width: 35, height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), + decoration: containerColorRadiusBorder( + index == 1 + ? CustomColors.accentColor + : index > 1 + ? Colors.green[700] + : Colors.white, + 2000, + Colors.black), child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + child: Text( + "2", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3) : null, + Expanded(child: mDivider(Colors.grey)), + InkWell( + onTap: () => index == 2 ? changeCurrentTab(3) : null, child: Container( width: 35, height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : Colors.white, + decoration: containerColorRadiusBorder( + index == 2 ? CustomColors.accentColor : Colors.white, + 2000, + Colors.black, ), child: Center( - child: Texts( - '3', - color: index == 2 ? Colors.white : Colors.grey[800], + child: Text( + "3", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - ], + ], + ), ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart index fa0799f9..89091886 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_page.dart @@ -5,7 +5,6 @@ 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:hexcolor/hexcolor.dart'; import 'home_health_care_page.dart'; diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 001ecbb1..1a4a9f4f 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -2,12 +2,14 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'NewHomeHealthCare/new_home_health_care_page.dart'; import 'orders_log_details_page.dart'; @@ -17,8 +19,7 @@ class HomeHealthCarePage extends StatefulWidget { _HomeHealthCarePageState createState() => _HomeHealthCarePageState(); } -class _HomeHealthCarePageState extends State - with SingleTickerProviderStateMixin { +class _HomeHealthCarePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -35,6 +36,7 @@ class _HomeHealthCarePageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { model.getHHCAllPresOrders(); @@ -43,99 +45,47 @@ class _HomeHealthCarePageState extends State isShowAppBar: true, description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, - imagesInfo: [ - ImagesInfo( - imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', - imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png') - ], - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Theme.of(context).primaryColor), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).homeHealthCare, - color: Colors.black, - ), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).orderLog, - color: Colors.black, - ), - ), - ), - ], - ), - ), - ), - ), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')], + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).homeHealthCare), Text(TranslationBase.of(context).orderLog)], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - NewHomeHealthCarePage( - model: model, - ), - OrdersLogDetailsPage( - model: model, - ) - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + NewHomeHealthCarePage( + model: model, + ), + OrdersLogDetailsPage( + model: model, + ) + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index f0ca5fe4..e14d07e8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; @@ -7,8 +8,8 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.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/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -24,240 +25,155 @@ class OrdersLogDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.iD, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); - await model.updateHHCPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); - await model.getHHCAllPresOrders(); - // await model.getHHCAllServices(); - } - }, - )); + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () async { + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + model.setState(ViewState.Busy); + await model.updateHHCPresOrder(updatePresOrderRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + await model.getHHCAllPresOrders(); + // await model.getHHCAllServices(); + } + }, + ), + ); + return; } return AppScaffold( isShowAppBar: false, baseViewModel: model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 50, + body: model.hhcAllPresOrders.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + GetCMCAllOrdersResponseModel order = model.hhcAllPresOrders[index]; + + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return Container( + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - Column( + 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( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( crossAxisAlignment: CrossAxisAlignment.start, - children: model.hhcAllPresOrders.map((order) { - return Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), + children: [ + Expanded( child: Column( + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 12, + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.iD.toString(), - fontSize: 22, - ), - ], - ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - - projectViewModel.isArabic ? order.descriptionN : order.description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), - fontSize: 22, - ), - ], - ), - ), - - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic ?order.nearestProjectDescription - .toString() : - order.nearestProjectDescriptionN - .toString(), - fontSize: 22, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).hospital + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.nearestProjectName.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - ], - ), - ), - SizedBox( - height: 12, - ), - if (order.status == 1 ||order.status == 2 ) - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(model, order); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), ), - ), - SizedBox( - height: 12, - ), + ], + ) ], ), - ); - }).toList()) - ], - ), - ), - ), - ), - ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + ), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 12), + itemCount: model.hhcAllPresOrders.length) + : getNoDataWidget(context), ); } } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 3d4294ec..ffb974e1 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart'; @@ -12,8 +13,10 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converte import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; @@ -22,10 +25,9 @@ import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dar import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; -import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -62,6 +64,7 @@ class _AllHabibMedicalServiceState extends State { LocationUtils locationUtils; var weather = '--'; WeatherService _weatherService = WeatherService(); + List hmgServices = []; @override void initState() { @@ -72,9 +75,23 @@ class _AllHabibMedicalServiceState extends State { super.initState(); } + initialiseHmgServices(bool isLogin) { + hmgServices.clear(); + hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/visa.png", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, "RRT", TranslationBase.of(context).emergency, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).reachUs, TranslationBase.of(context).findUs, "assets/images/new/reach_us.svg", isLogin)); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + initialiseHmgServices(false); return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, @@ -160,7 +177,7 @@ class _AllHabibMedicalServiceState extends State { Navigator.push( context, FadePage( - page: MedicalProfilePage(), + page: MedicalProfilePageNew(), ), ); }, @@ -181,9 +198,7 @@ class _AllHabibMedicalServiceState extends State { onTap: () => Navigator.push( context, FadePage( - page: BookingOptions( - isAppbar: true, - ), + page: Search(), ), ), imageLocation: 'assets/images/new-design/booking_icon_active.png', @@ -214,7 +229,7 @@ class _AllHabibMedicalServiceState extends State { context, FadePage(page: CovidDrivethruLocation()), ), - imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: 'assets/images/covid-car.png', title: TranslationBase.of(context).covid19_driveThrueTest, ), ServicesContainer( @@ -231,10 +246,7 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/emergency_service_image.png', title: TranslationBase.of(context).emergencyService, ), - ServicesContainer( - onTap: () => getPharmacyToken(), - imageLocation: 'assets/images/pharmacy_logo.png', - title: TranslationBase.of(context).pharmacy), + ServicesContainer(onTap: () => getPharmacyToken(), imageLocation: 'assets/images/pharmacy_logo.png', title: TranslationBase.of(context).pharmacy), ServicesContainer( onTap: () => Navigator.push( context, @@ -260,14 +272,14 @@ class _AllHabibMedicalServiceState extends State { page: MyFamily(), ), ), - imageLocation: 'assets/images/new-design/family_menu_icon_red.png', + imageLocation: 'assets/images/new-design/family_icon_bottom_bar.png', title: TranslationBase.of(context).myFamily, ), if (projectViewModel.havePrivilege(35)) ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: ChildVaccinesPage()), + FadePage(page: ChildInitialPage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', title: TranslationBase.of(context).childVaccine, @@ -280,14 +292,6 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), - // if (projectViewModel.havePrivilege(42)) - // ServicesContainer( - // onTap: () => Navigator.push( - // context, - // FadePage(page: SymptomInfo()), - // ), - // imageLocation: 'assets/images/new-design/body_icon.png', - // title: TranslationBase.of(context).symptomCheckerTitle), if (projectViewModel.havePrivilege(36)) ServicesContainer( onTap: () => Navigator.push( @@ -327,9 +331,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage( - page: SmartWatchInstructions() - ), + FadePage(page: SmartWatchInstructions()), ), imageLocation: 'assets/images/new-design/smartwatch_icon.png', title: TranslationBase.of(context).smartWatches, diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart new file mode 100644 index 00000000..37bc5fe6 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart @@ -0,0 +1,236 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/hmg_services.dart'; +import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/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:geolocator/geolocator.dart'; +import 'package:provider/provider.dart'; + +import 'health-weather/health-weather-indicator.dart'; + +class AllHabibMedicalSevicePage2 extends StatefulWidget { + @override + _AllHabibMedicalSevicePage2State createState() => _AllHabibMedicalSevicePage2State(); +} + +class _AllHabibMedicalSevicePage2State extends State { + List hmgServices = []; + LocationUtils locationUtils; + var weather = '--'; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + WeatherService _weatherService = WeatherService(); + double weatherNum = 30; + + @override + void initState() { + // TODO: implement initState + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); + }); + // getPatientAppointmentHistory1(); + // getFamilyFiles(); + } + + initialiseHmgServices(bool isLogin) { + hmgServices.clear(); + + hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCareTitle, TranslationBase.of(context).liveCareSubtitle, "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(7, TranslationBase.of(context).waterTitle, TranslationBase.of(context).waterSubtitle, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).findUs, TranslationBase.of(context).reachUs, "assets/images/new/reach_us.svg", isLogin)); + hmgServices.add(new HmgServices(9, TranslationBase.of(context).medicalFileTitle2, TranslationBase.of(context).medicalFileSubtitle, "assets/images/new/medical file.svg", isLogin)); + hmgServices.add(new HmgServices(10, TranslationBase.of(context).book, TranslationBase.of(context).appointmentLabel, "assets/images/new/book appointment.svg", isLogin)); + hmgServices.add(new HmgServices(11, TranslationBase.of(context).pharmacyTitle, TranslationBase.of(context).pharmacySubtitle, "assets/images/new/Pharmacy.svg", isLogin)); + hmgServices.add(new HmgServices(12, TranslationBase.of(context).updateInsurance, TranslationBase.of(context).updateInsuranceSubtitle, "assets/images/new/update insurance card.svg", isLogin)); + hmgServices.add(new HmgServices(13, TranslationBase.of(context).familyTitle, TranslationBase.of(context).familySubtitle, "assets/images/new/my family.svg", isLogin)); + hmgServices.add(new HmgServices(14, TranslationBase.of(context).My_Child, TranslationBase.of(context).Vaccines, "assets/images/new/child vaccines.svg", isLogin)); + hmgServices.add(new HmgServices(15, TranslationBase.of(context).Todo, TranslationBase.of(context).list, "assets/images/new/todo.svg", isLogin)); + hmgServices.add(new HmgServices(16, TranslationBase.of(context).Blood, TranslationBase.of(context).Donation, "assets/images/new/blood donation.svg", isLogin)); + hmgServices.add(new HmgServices(17, TranslationBase.of(context).healthCalculatorTitle, TranslationBase.of(context).healthCalculatorSubtitle, "assets/images/new/health calculator.svg", isLogin)); + hmgServices.add(new HmgServices(18, TranslationBase.of(context).healthConvertersTitle, TranslationBase.of(context).healthConvertersSubtitle, "assets/images/new/health converter.svg", isLogin)); + hmgServices.add(new HmgServices(19, TranslationBase.of(context).smartWatches.split(" ")[0], TranslationBase.of(context).smartWatches.split(" ")[1], "assets/images/new/smart watch.svg", isLogin)); + hmgServices.add(new HmgServices(20, TranslationBase.of(context).parkingTitle2, TranslationBase.of(context).parkingSubtitle, "assets/images/new/parking details.svg", isLogin)); + hmgServices.add(new HmgServices(21, TranslationBase.of(context).Virtual, TranslationBase.of(context).Tour, "assets/images/new/virtual tour.svg", isLogin)); + hmgServices.add(new HmgServices(22, TranslationBase.of(context).latestNews.split(" ")[0], TranslationBase.of(context).latestNews.split(" ")[1], "assets/images/new/latest news.svg", isLogin)); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + initialiseHmgServices(false); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).alhabiServices, + body: Container( + width: double.infinity, + height: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Directionality( + textDirection: TextDirection.ltr, + child: Text( + weather, + style: TextStyle( + fontSize: 24, + letterSpacing: -0.83, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + Text( + DateUtil.getMonthDayYearDateFormatted(new DateTime.now()), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + Text( + TranslationBase.of(context).healthWeatherIndicators, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + Text( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ], + ), + ), + Column( + children: [ + SvgPicture.asset( + "assets/images/new/cloudy.svg", + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Padding( + padding: const EdgeInsets.only(top: 10, bottom: 0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 12, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, decoration: TextDecoration.underline), + ), + ), + ) + ], + ), + ], + ), + ), + ), + mHeight(16), + Padding( + padding: const EdgeInsets.only( + left: 16, + right: 16, + top: 0, + ), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServicesView(hmgServices[index], index); + }, + ), + ), + mHeight(16), + ], + ), + ), + ), + ); + } + + void setLocation(Position position) { + this.sharedPref.setDouble(USER_LAT, position.latitude ?? 0.0); + this.sharedPref.setDouble(USER_LONG, position.longitude ?? 0.0); + getAuthUser(); + } + + getAuthUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + var data = await this.sharedPref.getObject(WEATHER); + if (data == null) { + var d = await _weatherService.getWeatherData(); + weatherNum = d.temperature; + setState(() { + weather = d != null ? d.temperature.toString() + '\u2103' : '--'; + }); + } else { + setState(() { + weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; + }); + } + } +} diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart index 4cb2b658..02ad27ec 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart @@ -1,13 +1,12 @@ import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class AnicllaryOrders extends StatefulWidget { @override diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 2c09de3d..24f00ea5 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -1,15 +1,15 @@ +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart'; +import 'package:flutter/material.dart'; class AnicllaryOrdersDetails extends StatefulWidget { final dynamic appoNo; @@ -21,8 +21,7 @@ class AnicllaryOrdersDetails extends StatefulWidget { _AnicllaryOrdersState createState() => _AnicllaryOrdersState(); } -class _AnicllaryOrdersState extends State - with SingleTickerProviderStateMixin { +class _AnicllaryOrdersState extends State with SingleTickerProviderStateMixin { void initState() { super.initState(); } @@ -34,8 +33,7 @@ class _AnicllaryOrdersState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrdersDetails( - widget.appoNo, widget.orderNo, widget.projectID), + onModelReady: (model) => model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, baseViewModel: model, @@ -157,8 +155,7 @@ class _AnicllaryOrdersState extends State Texts(" : "), Texts( DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - model.ancillaryListsDetails[0].appointmentDate), + DateUtil.convertStringToDate(model.ancillaryListsDetails[0].appointmentDate), ), ) ], @@ -228,27 +225,25 @@ class _AnicllaryOrdersState extends State Row( children: [], ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - TranslationBase.of(context).price, - color: Colors.grey[500], - fontSize: 14, - ), - SizedBox(width: 15), - Texts( - TranslationBase.of(context).vat, - color: Colors.grey[500], - fontSize: 14, - ), - SizedBox(width: 15), - Texts( - TranslationBase.of(context).total, - color: Colors.grey[500], - fontSize: 14, - ), - ]), + Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + Texts( + TranslationBase.of(context).price, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).vat, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).total, + color: Colors.grey[500], + fontSize: 14, + ), + ]), ], ), Divider( @@ -259,14 +254,9 @@ class _AnicllaryOrdersState extends State } Widget getAncillaryDetails(model) { - Map newMap = groupBy( - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, - (obj) => obj.procedureCategoryName); - print(newMap); + Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); - return Padding( - padding: EdgeInsets.only(top: 10, bottom: 10), - child: getHeaderDetails(newMap)); + return Padding(padding: EdgeInsets.only(top: 10, bottom: 10), child: getHeaderDetails(newMap)); } Widget getHeaderDetails(newMap) { @@ -295,8 +285,7 @@ class _AnicllaryOrdersState extends State String getTotalValue(value) { double total = 0.0; - value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList - .forEach((result) => {total += result.companyShareWithTax}); + value.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((result) => {total += result.companyShareWithTax}); return total.toStringAsFixed(2); } @@ -310,10 +299,7 @@ class _AnicllaryOrdersState extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Expanded( - flex: 3, - child: Text(result.procedureName.toString(), - overflow: TextOverflow.ellipsis)), + Expanded(flex: 3, child: Text(result.procedureName.toString(), overflow: TextOverflow.ellipsis)), Expanded(child: AppText(result.companyShare.toString())), Expanded(child: AppText(result.companyTaxAmount.toString())), Expanded( diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart index fee4ff40..03504f57 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ordersPayment.dart @@ -1,11 +1,4 @@ -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; class OrdersPayment extends StatefulWidget { @override diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart deleted file mode 100644 index 1558b8c7..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// ignore: must_be_immutable -class ConfirmAddAmountDialog extends StatefulWidget { - final int amount; - final String unit; - final H2OViewModel model; - - ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); - - @override - _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); -} - -class _ConfirmAddAmountDialogState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), - titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - textAlign: TextAlign.center, - color: Colors.black, - ), - ), - children: [ - Column( - children: [ - Divider(), - Center( - child: Texts( - "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?", - textAlign: TextAlign.center, - color: Colors.grey, - ), - ), - SizedBox( - height: 16.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () async { - InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); - await widget.model.insertUserActivity(insertUserActivityRequestModel); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok.toUpperCase(), - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ), - ], - ) - ], - ); - } -} diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart deleted file mode 100644 index 2df90419..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// ignore: must_be_immutable -class SelectAmountDialog extends StatefulWidget { - final Function(AmountModel) onValueSelected; - AmountModel selectedAmount; - - SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount}); - - @override - _SelectAmountDialogState createState() => _SelectAmountDialogState(); -} - -class _SelectAmountDialogState extends State { - List searchAmount = [ - AmountModel(name: "l", nameAr: "لتر", value: 1), - AmountModel(name: "ml", nameAr: "مم لتر", value: 2), - ]; - @override - void initState() { - super.initState(); - widget.selectedAmount = widget.selectedAmount ?? searchAmount[0]; - getLanguage(); - } - - String languageID = "en"; - - void getLanguage() async { - languageID = await sharedPref.getString(APP_LANGUAGE); - setState(() {}); - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Texts( - TranslationBase.of(context).preferredunit, - fontSize: 20, - ), - Divider(), - ...List.generate( - searchAmount.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedAmount = searchAmount[index]; - }); - }, - child: ListTile( - title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name), - leading: Radio( - value: searchAmount[index], - groupValue: widget.selectedAmount, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedAmount = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedAmount); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} - -class AmountModel { - String name; - String nameAr; - int value; - - AmountModel({this.name, this.nameAr, this.value}); - - AmountModel.fromJson(Map json) { - name = json['name']; - nameAr = json['nameAr']; - value = json['value']; - } - - Map toJson() { - final Map data = new Map(); - data['name'] = this.name; - data['nameAr'] = this.nameAr; - data['value'] = this.value; - return data; - } -} diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart deleted file mode 100644 index 2b22a100..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart +++ /dev/null @@ -1,132 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'Dialog/select_amount_dialog.dart'; - -class AddCustomAmount extends StatefulWidget { - final H2OViewModel model; - final Function changePageViewIndex; - - const AddCustomAmount({Key key, this.model, this.changePageViewIndex}) - : super(key: key); - - @override - _AddCustomAmountState createState() => _AddCustomAmountState(); -} - -class _AddCustomAmountState extends State { - TextEditingController _nameTextController = TextEditingController(); - AmountModel selectedAmount; - - @override - void initState() { - setState(() { - _nameTextController.text = "0"; - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle:TranslationBase.of(context).customLabel, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).h2oAmountOfWater, - // type: "Number", - controller: _nameTextController, - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmAmountTypeDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getAmountName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).ok, - onTap: () async { - Navigator.of(context).pop(); - showConfirmMessage (int.parse(_nameTextController.text), widget.model); - }, - // loading: model.state == ViewState.BusyLocal, - disabled: _nameTextController.text.isEmpty || selectedAmount == null), - SizedBox( - height: 12, - ), - ], - ), - ), - ), - ), - ), - ); - } - - -void confirmAmountTypeDialog() { - showDialog( - context: context, - child: SelectAmountDialog( - selectedAmount: selectedAmount, - onValueSelected: (value) { - setState(() { - selectedAmount = value; - }); - }, - ), - ); -} - - - String getAmountName() { - if (selectedAmount != null) - return selectedAmount.name; - else - return TranslationBase.of(context).selectUnit; - } - - - - void showConfirmMessage(int amount, H2OViewModel model) { - showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); - } -} diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index b8be6539..edc82034 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -1,13 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart'; -import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -22,6 +21,7 @@ import 'Dialog/setting_page_radio_button_list_dialog.dart'; class H2oSetting extends StatefulWidget { final UserDetailModel userDetailModel; final H2OViewModel viewModel; + H2oSetting({Key key, this.userDetailModel, this.viewModel}) : super(key: key); @override @@ -34,6 +34,9 @@ class _H2oSettingState extends State { TextEditingController _nameController = TextEditingController(); TextEditingController _heightController = TextEditingController(); TextEditingController _weightController = TextEditingController(); + List _weightPopupList = List(); + List _heightPopupList = List(); + bool _isUnitML = true; bool _isGenderMale = false; bool _isHeightCM = false; @@ -68,6 +71,7 @@ class _H2oSettingState extends State { } SharedPreferences prefs; + void readPrefs() async { prefs = await SharedPreferences.getInstance(); _isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; @@ -92,348 +96,427 @@ class _H2oSettingState extends State { @override Widget build(BuildContext context) { + _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).h2o, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), showHomeAppBarIcon: false, - body: SingleChildScrollView( - padding: EdgeInsets.fromLTRB(8, 8, 8, 80), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextField( - controller: _nameController, - decoration: InputDecoration( - labelText: TranslationBase.of(context).enterNameHere, - labelStyle: TextStyle(color: Colors.black87), - fillColor: Colors.white, - filled: true, - border: UnderlineInputBorder( - borderSide: BorderSide( - width: 0, - style: BorderStyle.none, - ), - borderRadius: BorderRadius.circular(6.0), - ), - ), - ), - SizedBox(height: 8), - Text(TranslationBase.of(context).preferredunit), - SizedBox(height: 8), - _commonButtonsRow(TranslationBase.of(context).ml, TranslationBase.of(context).l, _isUnitML, (value) { - if (_isUnitML != value) { - setState(() { - _isUnitML = value; - }); - } - }), - Padding( - padding: EdgeInsets.only(top: 8.0, bottom: 8.0), - child: Divider(height: 1.5, color: Colors.black54), - ), - Text(TranslationBase.of(context).gender), - SizedBox(height: 8), - _commonButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) { - if (_isGenderMale != value) { - setState(() { - _isGenderMale = value; - }); - } - }), - Padding( - padding: EdgeInsets.only(top: 8.0, bottom: 8.0), - child: Divider(height: 1.5, color: Colors.black54), - ), - Text(TranslationBase.of(context).height), - _commonSlidersRow(_heightController, 1, 270, _heightValue, (text) { - _heightController.text = text; - }, (value) { - setState(() { - _heightValue = value; - }); - }), - SizedBox(height: 8), - Text(TranslationBase.of(context).heightUnit), - SizedBox(height: 8), - _commonButtonsRow(TranslationBase.of(context).cm, TranslationBase.of(context).ft, _isHeightCM, (value) { - if (_isHeightCM != value) { - setState(() { - _isHeightCM = value; - }); - } - }), - SizedBox(height: 8), - _commonSlidersRow(_weightController, 1, 250, _weightValue, (text) { - _weightController.text = text; - }, (value) { - setState(() { - _weightValue = value; - }); - }), - SizedBox(height: 8), - Text(TranslationBase.of(context).weightUnit), - SizedBox(height: 8), - _commonButtonsRow(TranslationBase.of(context).kg, TranslationBase.of(context).lb, _isWeightKG, (value) { - if (_isWeightKG != value) { - setState(() { - _isWeightKG = value; - }); - } - }), - Padding( - padding: EdgeInsets.only(top: 8.0, bottom: 8.0), - child: Divider(height: 1.5, color: Colors.black54), - ), - Container( - padding: EdgeInsets.all(8), - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("${TranslationBase.of(context).birth_date}:"), - SizedBox(height: 8), - InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (context) { - return Container( - height: 250, - padding: EdgeInsets.all(8), - child: Column(children: [ - Container( - height: 40, - alignment: Alignment.centerRight, - child: Row(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - onTap: () => Navigator.pop(context), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).cancel), - ), + Text( + TranslationBase.of(context).enterDetailBelow, + style: TextStyle( + fontSize: 19, + height: 23 / 19, + fontWeight: FontWeight.w700, + color: Color(0xff2E303A), + letterSpacing: -1.14, + ), + ), + SizedBox(height: 12), + inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController).withBorderedContainer, + SizedBox(height: 16), + Text( + TranslationBase.of(context).preferredunit, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + SizedBox(height: 12), + _commonRadioButtonsRow(TranslationBase.of(context).mililitre, TranslationBase.of(context).litre, _isUnitML, (value) { + if (_isUnitML != value) { + setState(() { + _isUnitML = value; + }); + } + }), + SizedBox(height: 12), + Text( + TranslationBase.of(context).pleaseSelectGender, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + SizedBox(height: 12), + _commonRadioButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) { + if (_isGenderMale != value) { + setState(() { + _isGenderMale = value; + }); + } + }), + SizedBox(height: 18), + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; + }, + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList), + SizedBox(height: 12), + _commonInputAndUnitRow( + TranslationBase.of(context).weight, + _weightController, + 1, + 250, + _weightValue, + (text) { + _heightController.text = text; + }, + (value) { + _weightValue = value; + }, + _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).lb, + (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }, + _weightPopupList), + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: 250, + padding: EdgeInsets.all(8), + child: Column(children: [ + Container( + height: 40, + alignment: Alignment.centerRight, + child: Row(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + onTap: () => Navigator.pop(context), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).cancel), ), - SizedBox(width: 8), - InkWell( - onTap: () { - Navigator.pop(context); - setState(() { - _dobDate = _tempDate; - }); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).ok), - ), - ) - ]), - ), - Expanded( - child: Container( - width: MediaQuery.of(context).size.width, - child: CupertinoDatePicker( - initialDateTime: _dobDate, - mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (_date) { - _tempDate = _date; - }, + ), + SizedBox(width: 8), + InkWell( + onTap: () { + Navigator.pop(context); + setState(() { + _dobDate = _tempDate; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).ok), ), + ) + ]), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: CupertinoDatePicker( + initialDateTime: _dobDate, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (_date) { + _tempDate = _date; + }, ), - ) - ]), - ); - }); - }, // implement cupertino dialog to select date - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text(DateUtil.getFormattedDate(_dobDate, "yyyy-MM-dd")), Icon(Icons.arrow_drop_down_outlined)]), - ) + ), + ) + ]), + ); + }); + }, iconData: Icons.calendar_today) + .withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + List list = [ + for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedActiveLevel, + onValueSelected: (index) { + _selectedActiveLevel = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 18), + Text( + TranslationBase.of(context).reminderLabel, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { + List list = [ + for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedRemindedTime, + onValueSelected: (index) { + _selectedRemindedTime = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, ], ), ), - SizedBox(height: 8), - _commonDialogSelectorRow(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { - showDialog( - context: context, - child: CommonRadioButtonDialog( - list: _activityLevelListEng, - title: TranslationBase.of(context).activityLevel, - onSelect: (index) { - Navigator.pop(context); - setState(() { - _selectedActiveLevel = index + 1; - }); - }, - selectedIndex: _selectedActiveLevel - 1, - ), - ); - }), - SizedBox(height: 8), - _commonDialogSelectorRow(TranslationBase.of(context).reminderLabel, _remindedTimeListEng[_selectedRemindedTime], () { - showDialog( - context: context, - child: CommonRadioButtonDialog( - list: _remindedTimeListEng, - onSelect: (index) { - Navigator.pop(context); - setState(() { - _selectedRemindedTime = index; - }); - }, - selectedIndex: _selectedRemindedTime, - ), - ); - }), - SizedBox(height: 16), - SizedBox( - height: 50, - width: MediaQuery.of(context).size.width, - child: FlatButton( - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - ), - onPressed: _updateUserDetails, - child: Text( - TranslationBase.of(context).save, - style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600), - ), - ), - ) - ], - ), - ), - ); - } - - Widget _commonButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) { - return Row(children: [ - Expanded( - child: SizedBox( - height: 40, - child: RaisedButton( - color: checkParam ? Theme.of(context).appBarTheme.color : Colors.white, - child: Text( - rightText, - style: TextStyle(color: checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), - ), - onPressed: () => callBack(true), ), - ), - ), - SizedBox(width: 12), - Expanded( - child: SizedBox( - height: 40, - child: RaisedButton( - color: !checkParam ? Theme.of(context).appBarTheme.color : Colors.white, - child: Text( - leftText, - style: TextStyle(color: !checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).save, + _updateUserDetails, + color: Color(0xff349745), ), - onPressed: () => callBack(false), ), - ), + ], ), - ]); + ); } - Widget _commonSlidersRow(_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) { - return Container( - margin: EdgeInsets.only(top: 6), - padding: EdgeInsets.all(6), - color: Colors.white, - height: 50, + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return InkWell( + onTap: hasSelection ? () {} : null, child: Row( children: [ - SizedBox( - width: 75, - child: TextField( - controller: _controller, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - onChanged: (value) { - double _value = double.parse(value); - if (_value > _maxValue) { - onTextValueChange(_maxValue.toStringAsFixed(0)); - onValueChange(_maxValue); - return; - } else if (_value < _minValue) { - onTextValueChange(_minValue.toStringAsFixed(0)); - onValueChange(_minValue); - return; - } else if (_value >= _minValue && _value <= _maxValue) { - onValueChange(_value); - return; - } - }, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), - ], - decoration: InputDecoration( - contentPadding: EdgeInsets.only(left: 4, right: 4), - fillColor: Colors.white, - filled: true, - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - width: 1, - color: Colors.grey, - style: BorderStyle.solid, + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, ), - borderRadius: BorderRadius.circular(6.0), ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - width: 1, - color: Colors.grey, - style: BorderStyle.solid, + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => { + // validateForm() + }, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - borderRadius: BorderRadius.circular(6.0), ), - ), + ], ), ), - Expanded( - flex: 6, - child: Slider( - min: _minValue, - max: _maxValue, - activeColor: Colors.redAccent, - inactiveColor: Colors.redAccent.withOpacity(.3), - value: _valueOrg, - onChanged: (value) { - onTextValueChange(value.toStringAsFixed(0)); - onValueChange(value); - }, - ), - ) + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), ], ), ); } - Widget _commonDialogSelectorRow(String title, String selectedText, VoidCallback onPressed) { - return Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(title), - SizedBox(height: 8), - InkWell( - onTap: onPressed, - child: Container( - height: 50, - padding: EdgeInsets.all(8), - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text(selectedText), Icon(Icons.arrow_drop_down_outlined)], + Widget _commonRadioButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) { + return Row( + children: [ + Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(width: 22, height: 22, child: Radio(value: true, groupValue: checkParam, onChanged: callBack)), + SizedBox(width: 8), + Text( + rightText, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.44, + ), + ), + ], + ), + SizedBox(width: 12), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(width: 22, height: 22, child: Radio(value: false, groupValue: checkParam, onChanged: callBack)), + SizedBox(width: 8), + Text( + leftText, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.44, + ), + ), + ], + ), + ], + ); + } + + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), - ) - ]); + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; } void _updateUserDetails() async { @@ -456,7 +539,7 @@ class _H2oSettingState extends State { if (tag) { AppToast.showSuccessToast(message: TranslationBase.of(context).success); await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l"); - int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? _selectedRemindedTime; + int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? 0; if (_tempRemindTime != _selectedRemindedTime) { await prefs.setInt(H2O_REMINDER, _selectedRemindedTime); _addReminderToCalender(_selectedRemindedTime); @@ -469,6 +552,7 @@ class _H2oSettingState extends State { } final CalendarPlugin _myPlugin = CalendarPlugin(); + void _addReminderToCalender(int _selectedRemindedTime) async { bool _calendarPermission = await _myPlugin.hasPermissions(); if (_calendarPermission) { @@ -479,8 +563,70 @@ class _H2oSettingState extends State { if (!value) { _myPlugin.requestPermissions(); } else { - _myPlugin.getCalendars().then((value) => {print(value.length)}); + _myPlugin.getCalendars().then((value) => {}); } }); } } + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], + ), + ); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart index e6e05ee6..df8d3cc8 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart @@ -6,7 +6,6 @@ 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:hexcolor/hexcolor.dart'; class H2OPageIndexPage extends StatelessWidget { @override @@ -23,7 +22,7 @@ class H2OPageIndexPage extends StatelessWidget { "Water Tracker:", fontWeight: FontWeight.normal, fontSize: 25, - color: HexColor("#60686b"), + color: Color(0xFF60686b), ), SizedBox( height: 12, diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index 7c4e8b8b..d216cd21 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -3,21 +3,23 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.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/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class H2OPage extends StatefulWidget { @override @@ -44,140 +46,101 @@ class _H2OPageState extends State with SingleTickerProviderStateMixin { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getUserDetail(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).waterTracker, description: TranslationBase.of(context).h2oInfo, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), imagesInfo: [ - ImagesInfo( - imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/h2o/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/h2o/ar/0.png') + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/h2o/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/h2o/ar/0.png') ], showHomeAppBarIcon: false, baseViewModel: model, isHelp: true, appBarIcons: [ - model.isLogin - ? IconButton( - icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), - color: Colors.white, - onPressed: () { - Navigator.push( - context, - FadePage( - page: H2oSetting(userDetailModel: model.userDetail, viewModel: model), - ), - ); - }, - ) - : Container(), - ], - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - alignment: Alignment.center, - // margin: EdgeInsets.only(top: 10.0), - // width: MediaQuery.of(context).size.width * 0.9, - - child: TabBar( - isScrollable: false, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts(TranslationBase.of(context).today), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts(TranslationBase.of(context).week), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts(TranslationBase.of(context).month), - ), - ), - ], - ), + if (model.isLogin) + IconButton( + icon: Icon(Icons.settings), + color: Color(0xff2B353E), + onPressed: () { + Navigator.push( + context, + FadePage( + page: H2oSetting(userDetailModel: model.userDetail, viewModel: model), ), - ), - ], + ); + }, ), - ), - backgroundColor: Colors.white, - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [TodayPage(), WeekPage(), MonthPage()], - ), - ) - ], - ), - bottomNavigationBar: BottomNavBar( - changeIndex: (index) { - if (index == 0) { - IS_VOICE_COMMAND_CLOSED = false; - } else if (index == 1) { - Navigator.push( - context, - FadePage( - page: AppScaffold( - appBarTitle: TranslationBase.of(context).medicalProfile, - isShowAppBar: true, - showHomeAppBarIcon: false, - appBarIcons: [ - IconButton( - icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), - color: Colors.white, - onPressed: () => Navigator.of(context).pushNamed( - SETTINGS, - ), + ], + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [TodayPage(), WeekPage(), MonthPage()], + ), + ) + ], + ), + bottomNavigationBar: BottomNavBar( + changeIndex: (index) { + if (index == 0) { + IS_VOICE_COMMAND_CLOSED = false; + } else if (index == 1) { + Navigator.push( + context, + FadePage( + page: AppScaffold( + appBarTitle: TranslationBase.of(context).medicalProfile, + isShowAppBar: true, + showHomeAppBarIcon: false, + appBarIcons: [ + IconButton( + icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), + color: Colors.white, + onPressed: () => Navigator.of(context).pushNamed( + SETTINGS, ), - ], - body: MedicalProfilePage()))); - } else if (index == 2) { - Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); - } else if (index == 3) { - Navigator.of(context).pushNamed(MY_FAMILIY); - } else if (index == 4) { - Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); - } - }, - showHomeIcon: true, - index: 0, - ), + ), + ], + body: MedicalProfilePageNew()))); + } else if (index == 2) { + Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); + } else if (index == 3) { + Navigator.of(context).pushNamed(MY_FAMILIY); + } else if (index == 4) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); + } + }, + showHomeIcon: true, + index: 0, ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index 8867fb77..642f4826 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -3,13 +3,12 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_v import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; -import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; class MonthPage extends StatelessWidget { @override @@ -21,37 +20,39 @@ class MonthPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInMonth, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForMonthDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInMonth, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInMonth, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForMonthDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForMonthDataSeries, isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 03d11f50..984d0680 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,21 +1,41 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.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:hexcolor/hexcolor.dart'; -import 'package:percent_indicator/circular_percent_indicator.dart'; +import 'package:flutter/services.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:wave/config.dart'; +import 'package:wave/wave.dart'; -class TodayPage extends StatelessWidget { +class TodayPage extends StatefulWidget { + TodayPage({Key key}) : super(key: key); + + @override + _TodayPageState createState() { + return _TodayPageState(); + } +} + +class _TodayPageState extends State { + TextEditingController _h20AmountController = TextEditingController(); + + bool isUnitML = true; Future readPrefs() async { SharedPreferences prefs = await SharedPreferences.getInstance(); - return (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; + isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; + return isUnitML; } + bool canShowAddButton = false; + @override Widget build(BuildContext context) { return BaseView( @@ -25,27 +45,19 @@ class TodayPage extends StatelessWidget { appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 12), - child: Container( - margin: EdgeInsets.only(top: 60), - child: Column( - children: [ - Center( - child: CircularPercentIndicator( - radius: 180.0, - animation: true, - animationDuration: 1200, - lineWidth: 15.0, - percent: model.userProgressData == null - ? 0.0 - : (model.userProgressData.percentageConsumed / 100) >= 1 - ? 1 - : (model.userProgressData.percentageConsumed / 100), - center: Center( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 320, + child: Row( + children: [ + Expanded( child: FutureBuilder( future: readPrefs(), builder: (context, data) { - var isUnitML = true; String unit; if (data.connectionState == ConnectionState.done) { isUnitML = data.data; @@ -56,121 +68,295 @@ class TodayPage extends StatelessWidget { unit = TranslationBase.of(context).l; } unit = unit.toLowerCase(); - var totalH2O = model?.userProgressData?.quantityLimit ?? 0.0; - var consumedH2O = model?.userProgressData?.quantityConsumed ?? 0.0; + double totalH2O = model?.userProgressData?.quantityLimit ?? 0.0; + double consumedH2O = model?.userProgressData?.quantityConsumed ?? 0.0; if (!isUnitML) { totalH2O = totalH2O / 1000; consumedH2O = consumedH2O / 1000; } + + if (consumedH2O > totalH2O) { + consumedH2O = totalH2O; + } + + double divide = consumedH2O / totalH2O; + String percentage = (divide * 100).toStringAsFixed(0); var remainingH2O = totalH2O - consumedH2O; - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - // SizedBox( - // height: 40, - // ), - Text( - TranslationBase.of(context).consumed, - style: TextStyle(fontSize: 16.0), - ), - SizedBox( - height: 4, - ), - Text( - model.userProgressData == null ? "0.0" : "$consumedH2O $unit", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")), - ), - SizedBox( - height: 4, - ), - SizedBox( - height: 5, - width: 50, - child: Container(), - ), - SizedBox( - height: 4, - ), - Text( - TranslationBase.of(context).remaining, - style: TextStyle(fontSize: 16.0), - ), - SizedBox( - height: 4, - ), - Text( - model.userProgressData == null - ? "0.0" - : (remainingH2O) < 0 - ? "0 $unit" - : '$remainingH2O $unit', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0), - ), - ], + return AspectRatio( + aspectRatio: 234 / 320, + child: Stack( + alignment: Alignment.center, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(18), + child: WaveWidget( + config: CustomConfig( + colors: [Color(0xff0d47a1), Color(0xff1976d2), Color(0xff2196f3)], + durations: [19440, 10800, 6000], + heightPercentages: [1 - divide - .10, 1 - divide - .05, 1 - divide], + blur: MaskFilter.blur(BlurStyle.solid, 0), + ), + waveAmplitude: 0, + backgroundColor: Color(0xff2e303a), + size: Size( + double.infinity, + double.infinity, + ), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + remainingH2O.toStringAsFixed(0) + "$unit " + TranslationBase.of(context).left.toLowerCase(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.white, + letterSpacing: -0.56, + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "$percentage%", + style: TextStyle( + fontSize: 34, + fontWeight: FontWeight.bold, + color: Colors.white, + letterSpacing: -2.34, + ), + ), + Text( + TranslationBase.of(context).consumed, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.white, + letterSpacing: -0.56, + ), + ), + ], + ), + ], + ), + ) + ], + ), ); }, ), ), - circularStrokeCap: CircularStrokeCap.butt, - backgroundColor: HexColor("#D1E3F6"), - progressColor: HexColor("#60BCF9"), + SizedBox(width: 21), + SizedBox( + height: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + _circularButton(context, 600, model), + SizedBox(height: 8), + _circularButton(context, 330, model), + SizedBox(height: 8), + _circularButton(context, 200, model), + SizedBox(height: 8), + InkWell( + onTap: () => undoVolume(context, model), + child: Text( + TranslationBase.of(context).undo, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xffD02127), + letterSpacing: -0.56, + decoration: TextDecoration.underline, + ), + ), + ), + ], + ), + ) + ], + ), + ), + SizedBox(height: 40), + Text( + TranslationBase.of(context).addCustomAmount, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.56, + ), + ), + SizedBox(height: 12), + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + child: Column( + mainAxisSize: MainAxisSize.min, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, + Row( children: [ - Container( - margin: EdgeInsets.only(bottom: 16), - height: 30, - width: 70, - decoration: BoxDecoration(color: HexColor("#D1E3F6"), borderRadius: BorderRadius.all(Radius.circular(30))), + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).amount_, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _h20AmountController, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = 0; + if (value.length > 0) _value = double.parse(value); + + if (value.length > 0) { + if (canShowAddButton) { + return; + } + canShowAddButton = true; + setState(() {}); + } else { + canShowAddButton = false; + setState(() {}); + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), ), - Text( - "${TranslationBase.of(context).remaining} %", - style: TextStyle(fontSize: 16.0), - ) + if (canShowAddButton) + Expanded( + flex: 1, + child: DefaultButton( + TranslationBase.of(context).add, + () async { + await showConfirmMessage(context, int.parse(_h20AmountController.text), model); + _h20AmountController.text = ""; + canShowAddButton = false; + SystemChannels.textInput.invokeMethod('TextInput.hide'); + setState(() {}); + }, + ), + ), ], ), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(bottom: 16), - height: 30, - width: 70, - decoration: BoxDecoration(color: HexColor("#60BCF9"), borderRadius: BorderRadius.all(Radius.circular(30))), - ), - Text( - "${TranslationBase.of(context).consumed} %", - style: TextStyle(fontSize: 16.0), - ) - ], - ) ], ), - SizedBox( - height: 30, - ), - SizedBox( - height: 0.5, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey, - ), - ), - ], - ), + ), + ], ), ), - floatingActionButton: H20FloatingActionButton( - // controller: _controller, - model: model, + ), + ); + } + + Widget _circularButton(context, int value, model) { + String _text = "$value${TranslationBase.of(context).ml}"; + return InkWell( + onTap: () { + showConfirmMessage(context, value, model); + }, + child: Container( + padding: EdgeInsets.all(21), + alignment: Alignment.center, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(width: 1, color: Color(0xffDEDEDE)), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).add, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + color: Color(0xff575757), + letterSpacing: -0.44, + ), + ), + Text( + _text, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + ], ), ), ); } + + Future showConfirmMessage(context, int amount, H2OViewModel model) async { + String title = "${TranslationBase.of(context).areyousure} $amount ${(isUnitML ? TranslationBase.of(context).ml : TranslationBase.of(context).l).toLowerCase()} ?"; + await showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: title, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: amount); + await model.insertUserActivity(insertUserActivityRequestModel); + GifLoaderDialogUtils.hideDialog(context); + FocusManager.instance.primaryFocus.unfocus(); + }, + ), + ); + } + + void undoVolume(context, H2OViewModel model) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.undoUserActivity(); + GifLoaderDialogUtils.hideDialog(context); + } } diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index 6f4423b2..83529afd 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,12 +1,10 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; -import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -21,37 +19,39 @@ class WeekPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInWeek, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForWeekDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInWeek, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInWeek, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForWeekDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForWeekDataSeries,isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart new file mode 100644 index 00000000..3b2e166e --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart @@ -0,0 +1,59 @@ + +import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; +import 'package:flutter/material.dart'; + +class H20BottomNavigationBar extends StatelessWidget { + H20BottomNavigationBar({Key key}) : super(key: key); + + PageController pageController = PageController(keepPage: true); + int currentTab = 0; + + @override + Widget build(BuildContext context) { + // TODO: implement build + return Scaffold( + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + HomePage2( + goToMyProfile: () { + _changeCurrentTab(1); + }, + ), + MedicalProfilePageNew(), + BookingOptions(), + MyFamily(isAppbarVisible: false), + ToDo(isShowAppBar: false), + ], // Please do not remove the BookingOptions from this array + ), + bottomNavigationBar: BottomNavBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + floatingActionButton: FloatingButton( + elevation: true, + onTap: () { + _changeCurrentTab(2); + }), + ); + } + + _changeCurrentTab(int tab) { + // setState(() { + currentTab = tab; + if (tab != 0) + pageController.jumpToPage(tab); + else { + pageController.jumpToPage(tab); + } + // }); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart deleted file mode 100644 index b692e6ba..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ /dev/null @@ -1,200 +0,0 @@ -import 'dart:math' as math; - -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../add_custom_amount.dart'; - -class H20FloatingActionButton extends StatefulWidget { - const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); - - final H2OViewModel model; - - @override - _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); -} - -class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { - AnimationController _controller; - @override - void initState() { - _controller = new AnimationController( - vsync: this, - duration: const Duration(milliseconds: 500), - ); - super.initState(); - } - - void showConfirmMessage(int amount, H2OViewModel model) { - showDialog( - context: context, - child: ConfirmAddAmountDialog( - model: model, - amount: amount, - ), - ); - } - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(left: 20, right: 20), - child: new Column(mainAxisSize: MainAxisSize.min, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - ActionButton( - controller: _controller, - text: "600${TranslationBase.of(context).ml}", - onTap: () { - showConfirmMessage(600, widget.model); - }, - ), - ActionButton( - controller: _controller, - text: "330${TranslationBase.of(context).ml}", - onTap: () { - showConfirmMessage(330, widget.model); - }, - ), - ActionButton( - controller: _controller, - text: "200${TranslationBase.of(context).ml}", - onTap: () { - showConfirmMessage(200, widget.model); - }, - ), - ], - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - FloatingActionButton( - heroTag: null, - child: new AnimatedBuilder( - animation: _controller, - builder: (BuildContext context, Widget child) { - return new Transform( - transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), - alignment: FractionalOffset.center, - child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), - ); - }, - ), - onPressed: () { - if (_controller.isDismissed) { - _controller.forward(); - } else { - _controller.reverse(); - } - }, - ), - new Container( - margin: EdgeInsets.only(left: 8, bottom: 4), - alignment: FractionalOffset.topCenter, - child: new ScaleTransition( - scale: new CurvedAnimation( - parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), - ), - child: new FloatingActionButton( - backgroundColor: Colors.white, - heroTag: null, - // mini: true, - child: Text( - TranslationBase.of(context).custom, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12, color: Colors.grey), - ), - onPressed: () { - Navigator.push( - context, - FadePage( - page: AddCustomAmount( - model: widget.model, - ), - ), - ); - }, - ), - ), - ), - new Container( - margin: EdgeInsets.only(left: 8, bottom: 4), - alignment: FractionalOffset.topCenter, - child: new ScaleTransition( - scale: new CurvedAnimation( - parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), - ), - child: new FloatingActionButton( - backgroundColor: Colors.white, - heroTag: null, - //mini: true, - child: Text( - TranslationBase.of(context).undo, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0, color: Colors.grey), - ), - onPressed: undoVolume, - ), - ), - ), - ], - ), - ]), - ); - } - - void undoVolume() async { - GifLoaderDialogUtils.showMyDialog(context); - await widget.model.undoUserActivity(); - GifLoaderDialogUtils.hideDialog(context); - } -} - -class ActionButton extends StatelessWidget { - const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) - : _controller = controller, - super(key: key); - - final AnimationController _controller; - final String text; - final Function onTap; - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(left: 4, bottom: 8), - alignment: FractionalOffset.topCenter, - child: new ScaleTransition( - scale: new CurvedAnimation( - parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), - ), - child: new FloatingActionButton( - heroTag: null, - backgroundColor: Colors.white, - //mini: true, - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0, color: Colors.grey), - ), - onPressed: onTap), - ), - ); - } -} diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index bc1de1f6..bbd73d64 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -3,16 +3,18 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; class HealthWeatherIndicator extends StatefulWidget { @override @@ -24,90 +26,98 @@ class _HospitalsPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); LocationUtils locationUtils; var weather = '--'; + + ProjectViewModel projectViewModel; + @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance - .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); getWeather(); super.initState(); } @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeatherData(), allowAny: true, builder: (_, mode, widget) => AppScaffold( isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).healthWeatherIndicators, isShowAppBar: true, body: mode.weatherIndicatorData.length > 0 ? SingleChildScrollView( child: Column(children: [ Container( - margin: EdgeInsets.all(8), width: double.infinity, - height: 150, - decoration: BoxDecoration( - image: DecorationImage( - image: - ExactAssetImage('assets/images/Weather_img.png'), - fit: BoxFit.cover, - ), - borderRadius: BorderRadius.circular(8.0)), + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: const EdgeInsets.all(20.0), child: Row( children: [ Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .healthWeatherIndicators, - color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Directionality( + textDirection: TextDirection.ltr, + child: Text( + weather, + style: TextStyle( + fontSize: 24, + letterSpacing: -0.83, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + Text( + DateUtil.getMonthDayYearDateFormatted(new DateTime.now()), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, fontWeight: FontWeight.w600, + color: Colors.white, ), - AppText( - TranslationBase.of(context) - .healthTipsBasedOnCurrentWeather, + ), + Text( + TranslationBase.of(context).healthWeatherIndicators, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, color: Colors.white, - fontSize: 14, ), - ], - )), - Expanded( - flex: 2, - child: InkWell( - onTap: () {}, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/Weather_ico.png', - width: 60, - height: 60, - ), - Directionality( - textDirection: TextDirection.ltr, - child: AppText(weather, - fontSize: 22, - color: Colors.white)) - ], - ), - ], - )), - ) + ), + Text( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ], + ), + ), + SvgPicture.asset( + "assets/images/new/cloudy.svg", + ), ], ), ), @@ -115,9 +125,7 @@ class _HospitalsPageState extends State { Padding( padding: EdgeInsets.all(15), child: AppText( - projectViewModel.isArabic - ? mode.weatherIndicatorData[0].cityNameN - : mode.weatherIndicatorData[0].cityName, + projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, fontSize: 24, fontWeight: FontWeight.bold, )), @@ -125,7 +133,7 @@ class _HospitalsPageState extends State { padding: EdgeInsets.all(15), child: Column( children: mode.weatherIndicatorData.map((data) { - return WeatherSlider(data); + return WeatherSlider(data, projectViewModel); }).toList())) ])) : Center(child: AppCircularProgressIndicator())), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart index c71a0c87..13de0140 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart @@ -1,11 +1,15 @@ +import 'dart:collection'; + import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -63,9 +67,7 @@ class _BariatricsPageState extends State { activeColor: Colors.blue.shade700, value: item.diseasesID, groupValue: _selectedDisease != null ? _selectedDisease.diseasesID : -1, - selected: _selectedDisease != null - ? item.diseasesID == _selectedDisease.diseasesID - : false, + selected: _selectedDisease != null ? item.diseasesID == _selectedDisease.diseasesID : false, onChanged: (val) { setState(() { _selectedDisease = item; @@ -97,10 +99,14 @@ class _BariatricsPageState extends State { radius: 8, fontWeight: FontWeight.bold, handler: () async { - Navigator.push( - context, - FadePage(page: DoctorList(diseaseByClinic: _selectedDisease,)), - ); + callDoctorsSearchAPI(); + // Navigator.push( + // context, + // FadePage( + // page: DoctorList( + // diseaseByClinic: _selectedDisease, + // )), + // ); }, ), ), @@ -118,10 +124,11 @@ class _BariatricsPageState extends State { borderColor: Color(0x00000000), fontWeight: FontWeight.bold, handler: () async { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + callDoctorsSearchAPI(); + // Navigator.push( + // context, + // FadePage(page: DoctorList()), + // ); }, ), ), @@ -131,6 +138,65 @@ class _BariatricsPageState extends State { ); } + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(108, 0, false, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) + .then((value) { + setState(() { + // dropdownValue = null; + }); + // getProjectsList(); + }); + } + _getImageName(int gender, double obeseResult, bool isArabic) { String path = "assets/images/BMI/"; double result = obeseResult; diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart index ec7074c2..08b756ee 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -1,15 +1,14 @@ +import 'dart:math'; + +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'dart:math'; -import '../health_calc_desc.dart'; import 'result_page.dart'; const activeCardColor = Color(0xff70777A); @@ -25,52 +24,17 @@ class _BMICalculatorState extends State { String textResult; String msg; double bmiResult; - int height = 150; - int weight = 40; - Color cmCard = activeCardColor; - Color ftCard = inactiveCardColor; - Color lbCard = inactiveCardColor; - Color kgCard = activeCardColor; - void updateColor(int type) { - //MG/DLT card - if (type == 1) { - if (cmCard == inactiveCardColor) { - cmCard = activeCardColor; - ftCard = inactiveCardColor; - } else { - cmCard = inactiveCardColor; - } - } - if (type == 2) { - if (ftCard == inactiveCardColor) { - ftCard = activeCardColor; - cmCard = inactiveCardColor; - } else { - ftCard = inactiveCardColor; - } - } - } + TextEditingController _heightController = TextEditingController(); + TextEditingController _weightController = TextEditingController(); - void updateColorWeight(int type) { - //MG/DLT card - if (type == 1) { - if (kgCard == inactiveCardColor) { - kgCard = activeCardColor; - lbCard = inactiveCardColor; - } else { - kgCard = inactiveCardColor; - } - } - if (type == 2) { - if (lbCard == inactiveCardColor) { - lbCard = activeCardColor; - kgCard = inactiveCardColor; - } else { - lbCard = inactiveCardColor; - } - } - } + List _weightPopupList = List(); + List _heightPopupList = List(); + + bool _isHeightCM = true; + bool _isWeightKG = true; + double _heightValue = 150; + double _weightValue = 40; double convertToCm(double number) { return number * 30.48; @@ -81,10 +45,11 @@ class _BMICalculatorState extends State { } double calculateBMI() { - if (ftCard == activeCardColor) { - convertToCm(height.toDouble()); - } - bmiResult = weight / pow(height / 100, 2); + if (!_isHeightCM) _heightValue = convertToCm(_heightValue.toDouble()); + + if (!_isWeightKG) _weightValue = convertToKg(_weightValue); + + bmiResult = _weightValue / pow(_heightValue / 100, 2); return bmiResult; } @@ -117,432 +82,261 @@ class _BMICalculatorState extends State { void initState() { super.initState(); textController.text = '0'; // Setting the initial value for the field. + _heightValue = 100; + _weightValue = 50; + _heightController.text = _heightValue.toStringAsFixed(0); + _weightController.text = _weightValue.toStringAsFixed(0); + + _isWeightKG = true; + _isHeightCM = true; } Widget build(BuildContext context) { + _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, isShowDecPage: false, - showHomeAppBarIcon: false, - appBarIcons: [ - IconButton( - icon: Icon(Icons.info_outline), - color: Colors.white, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HealthDescPage( - "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}", - TranslationBase.of(context).bmiCalcDesc, - "assets/images/AlHabibMedicalService/health_calculator/bmi.png")), - ); - }, - ) - ], - appBarTitle: - "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}", - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - child: Padding( - padding: EdgeInsets.symmetric(vertical: 15.0), - child: Text( - TranslationBase.of(context).bmiCalcDesc, - style: TextStyle(fontSize: 18.0), - ), - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - padding: EdgeInsets.only(bottom: 16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12.0), - ), - child: Column( - children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).height), - ), - ], - ), - Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(height.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (height < 250) height++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (height > 120) height--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Slider( - value: height.toDouble(), - min: 120, - max: 250, - onChanged: (double newValue) { - setState(() { - height = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ], - ), - Row( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).selectUnit), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow - ), - ], - color: cmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center( - child: Texts(TranslationBase.of(context).cm)), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: ftCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center( - child: Texts(TranslationBase.of(context).feet)), - ), - ), - ), - ], - ), - ], - ), - ), - SizedBox( - height: 25.0, - ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - padding: EdgeInsets.only(bottom: 16), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12.0), - ), + showHomeAppBarIcon: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}", + body: Column( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(16.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).weight), - ), - ], + Text( + TranslationBase.of(context).bmiCalcDesc, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + ), ), - Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(weight.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight < 250) weight++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight > 40) weight--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Slider( - value: weight.toDouble(), - min: 40, - max: 250, - onChanged: (double newValue) { - setState(() { - weight = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ], + mHeight(24), + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; + }, + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList, ), - Row( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).selectUnit), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(1); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow - ), - ], - color: kgCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center( - child: Texts(TranslationBase.of(context).kg)), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(2); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: lbCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center( - child: - Texts(TranslationBase.of(context).pound)), - ), - ), - ), - ], + mHeight(12), + _commonInputAndUnitRow( + TranslationBase.of(context).weight, + _weightController, + 1, + 270, + _weightValue, + (text) { + _weightController.text = text; + }, + (value) { + _weightValue = value; + }, + _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound, + (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }, + _weightPopupList, ), ], ), ), - SizedBox( - height: 25.0, - ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - padding: EdgeInsets.symmetric(vertical: 8), - child: SecondaryButton( - label: TranslationBase.of(context).calculate, - onTap: () => { - setState(() { - calculateBMI(); - showTextResult(context); - showMsg(context); - { - Navigator.push( - context, - FadePage( - page: ResultPage( + ), + Container( + color: Colors.white, + padding: EdgeInsets.all(16), + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + calculateBMI(); + showTextResult(context); + showMsg(context); + { + Navigator.push( + context, + FadePage( + page: ResultPage( finalResult: bmiResult, textResult: textResult, msg: msg, - )), - ); - } - }) + ), + ), + ); + } + }); + }, + ), + ), + ], + ), + ); + } + + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), ), - ), - ], + ], + ), ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; + } +} + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], ), ); } } + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart index 9b0ee417..fa12a9fe 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -1,47 +1,58 @@ -import 'dart:ffi'; +import 'dart:collection'; -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +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/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:percent_indicator/percent_indicator.dart'; +import 'package:flutter_svg/svg.dart'; -class ResultPage extends StatelessWidget { +class ResultPage extends StatefulWidget { final double finalResult; final String textResult; final String msg; ResultPage({this.finalResult, this.textResult, this.msg}); + @override + _ResultPageState createState() => _ResultPageState(); +} + +class _ResultPageState extends State { Color inductorColor; + double percent; Color colorInductor() { - if (finalResult >= 30) { + if (widget.finalResult >= 30) { inductorColor = Color(0xffC70D00); - } else if (finalResult < 30 && finalResult >= 25) { + } else if (widget.finalResult < 30 && widget.finalResult >= 25) { inductorColor = Color(0xffC25400); - } else if (finalResult < 25 && finalResult >= 18.5) { + } else if (widget.finalResult < 25 && widget.finalResult >= 18.5) { inductorColor = Color(0xff36D600); - } else if (finalResult < 18.5) { + } else if (widget.finalResult < 18.5) { inductorColor = Color(0xff1BE0EE); } return inductorColor; } double percentInductor() { - if (finalResult >= 30) { + if (widget.finalResult >= 30) { percent = 1.0; - } else if (finalResult < 30 && finalResult >= 25) { + } else if (widget.finalResult < 30 && widget.finalResult >= 25) { percent = 0.73; - } else if (finalResult < 25 && finalResult >= 18.5) { + } else if (widget.finalResult < 25 && widget.finalResult >= 18.5) { percent = 0.5; - } else if (finalResult < 18.5) { + } else if (widget.finalResult < 18.5) { percent = 0.25; } return percent; @@ -52,71 +63,71 @@ class ResultPage extends StatelessWidget { return AppScaffold( isShowDecPage: false, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: "${TranslationBase.of(context).bmi} ${TranslationBase.of(context).calcHealth}", body: Column( children: [ - Expanded( - child: SingleChildScrollView( + Container( + margin: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 6), + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - margin: EdgeInsets.only(top: 50), - child: Center( - child: CircularPercentIndicator( - radius: 220.0, - lineWidth: 20.0, - percent: percentInductor(), - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - finalResult.toStringAsFixed(1), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 5.0, - ), - Text( - textResult, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - progressColor: colorInductor(), - backgroundColor: Colors.white, - ), + Text( + TranslationBase.of(context).bodyMassIndex + widget.finalResult.toStringAsFixed(2), + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), ), + mHeight(20), Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: Texts(msg), + height: MediaQuery.of(context).size.width / 2.8, + child: Row( + children: [ + showMass(context, TranslationBase.of(context).underWeight, "< 18.5", widget.finalResult <= 18.5 ? Colors.red : Colors.black, 8), + mWidth(12), + showMass(context, TranslationBase.of(context).healthy, "18.5 - 24.9", (widget.finalResult > 18.5 && widget.finalResult < 25) ? Colors.red : Colors.black, 6), + mWidth(12), + showMass(context, TranslationBase.of(context).overWeight, "25 - 29.9", (widget.finalResult >= 25 && widget.finalResult < 30) ? Colors.red : Colors.black, 4), + mWidth(12), + showMass(context, TranslationBase.of(context).obese, "30 - 34.9", (widget.finalResult >= 30 && widget.finalResult < 35) ? Colors.red : Colors.black, 2), + mWidth(12), + showMass(context, TranslationBase.of(context).extremeObese, "> 35", (widget.finalResult >= 35) ? Colors.red : Colors.black, 0), + ], + ), + ), + mHeight(20), + Text( + widget.textResult, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + ), + ), + mHeight(4), + Text( + widget.msg, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), ), ], ), ), ), + mFlex(1), Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - child: BorderedButton( + color: Colors.white, + padding: EdgeInsets.all(16), + child: DefaultButton( TranslationBase.of(context).seeListOfDoctor, - fontSize: SizeConfig.textMultiplier * 2.1, - textColor: Colors.white, - vPadding: 8, - hPadding: 8, - backgroundColor: Theme.of(context).primaryColor, - radius: 8, - fontWeight: FontWeight.bold, - handler: () { - Navigator.push( - context, - FadePage(page: BariatricsPage(1, 1, finalResult)), - ); + () { + callDoctorsSearchAPI(); }, ), ), @@ -124,4 +135,116 @@ class ResultPage extends StatelessWidget { ), ); } + + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(108, 0, false, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) + .then((value) { + setState(() { + // dropdownValue = null; + }); + // getProjectsList(); + }); + } + + Widget showMass(BuildContext context, String title, String weight, Color color, int f) { + return Expanded( + flex: 1, + child: Container( + height: double.infinity, + width: double.infinity, + child: Column( + children: [ + Flexible( + child: Row( + children: [ + mFlex(f), + Flexible( + flex: 10, + child: SvgPicture.asset( + "assets/images/new/mass/health_BMI.svg", + height: double.infinity, + width: double.infinity, + fit: BoxFit.fill, + color: color, + ), + ), + mFlex(f), + ], + ), + ), + mHeight(20), + AutoSizeText( + title, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + color: color, + fontSize: 10, + letterSpacing: -0.6, + ), + ), + AutoSizeText( + weight, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + color: color, + fontSize: 10, + letterSpacing: -0.6, + ), + ) + ], + ), + ), + ); + } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index 7dc30415..62020a62 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -1,10 +1,14 @@ -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'dart:math'; +import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'bmr_result_page.dart'; @@ -27,11 +31,25 @@ class _BmrCalculatorState extends State { Color lbCard = inactiveCardColor; Color cmCard = activeCardColor; Color ftCard = inactiveCardColor; - int age = 0; - int height = 0; - int weight = 0; + + final GlobalKey clinicDropdownKey = GlobalKey(); + TextEditingController ageController = new TextEditingController(); + TextEditingController _heightController = new TextEditingController(); + TextEditingController _weightController = TextEditingController(); + + bool _isHeightCM = true; + bool _isWeightKG = true; + double _heightValue = 150; + double _weightValue = 40; + + List _heightPopupList = List(); + List _weightPopupList = List(); + + // int age = 0; + // int height = 0; + // int weight = 0; double bmrResult = 0; - String dropdownValue = 'Lighty Active (1-3) days per week'; + String dropdownValue = null; double calories = 0; void updateColor(int type) { @@ -96,23 +114,22 @@ class _BmrCalculatorState extends State { void calculateBmr() { if (isMale == true) { - bmrResult = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age); + bmrResult = 66.5 + (13.75 * int.parse(_weightController.text)) + (5.003 * int.parse(_heightController.text)) - (6.755 * int.parse(ageController.text)); } else if (isMale == false) { - bmrResult = - 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + bmrResult = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text)); } bmrResult = bmrResult.roundToDouble(); } - void calculateCalories() { - if (dropdownValue == "Almost Inactive(Little or no exercises)") { + void calculateCalories(BuildContext context) { + if (dropdownValue == TranslationBase.of(context).almostInactive) { calories = bmrResult * 1.2; - } else if (dropdownValue == "Lighty Active (1-3) days per week") { + } else if (dropdownValue == TranslationBase.of(context).lightActive1) { calories = bmrResult * 1.375; - } else if (dropdownValue == "very Active(6-7) days per week") { + } else if (dropdownValue == TranslationBase.of(context).veryActive) { calories = bmrResult * 1.55; - } else if (dropdownValue == "Super Active(very hard exercises)") { + } else if (dropdownValue == TranslationBase.of(context).superActive) { calories = bmrResult * 1.725; } else if (dropdownValue == "") { calories = bmrResult * 10.725; @@ -121,10 +138,17 @@ class _BmrCalculatorState extends State { @override Widget build(BuildContext context) { + if (dropdownValue == null) dropdownValue = TranslationBase.of(context).lightActive1; + ProjectViewModel projectViewModel = Provider.of(context); + _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: 'Bmr Calculator', + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bmr, showHomeAppBarIcon: false, appBarIcons: [ Padding( @@ -135,600 +159,505 @@ class _BmrCalculatorState extends State { ), ) ], - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 850, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Texts( - 'Calculates the amount of energy that the person’s body expends in a day'), - ), - Divider( - thickness: 2.0, - ), - SizedBox( - height: 5.0, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Gender'), - SizedBox( - height: 5.0, - ), - Container( - width: 350, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(35.0), - color: Colors.white, - border: Border.all( - color: Colors.black45, - )), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + body: Container( + height: double.infinity, + width: double.infinity, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).calculateAmount, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - isMale = false; - }); - }, - child: Container( - height: 55.0, - width: 170.0, - decoration: BoxDecoration( - color: maleCard, - borderRadius: BorderRadius.circular(35.0), - ), - child: Center(child: Texts('FEMALE')), - ), + SizedBox( + height: 20, ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - isMale = true; - }); - }, - child: Container( - height: 55.0, - width: 170.0, - decoration: BoxDecoration( - color: femaleCard, - borderRadius: BorderRadius.circular(35.0), - ), - child: Center(child: Texts('MALE')), + Text( + TranslationBase.of(context).selectGender, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, ), ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Texts( - 'The Age ( 11 - 120 ) yrs', - ), - SizedBox( - height: 10.0, - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + SizedBox( + height: 8.0, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + isMale = false; + }); + }, child: Row( - children: [ - Expanded( - child: Center( - child: Text(age.toString()), + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100), ), ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (age < 120) age++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (age > 0) age--; - }); - }, - ), - ], + mWidth(12), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, ), ), ], ), ), ), - ), - Expanded( - child: Slider( - value: age.toDouble(), - min: 0, - max: 120, - onChanged: (double newValue) { - setState(() { - age = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - ], - ), - Texts( - 'Height', - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + isMale = true; + }); + }, child: Row( - children: [ - Expanded( - child: Center( - child: Text(height.toString()), + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100), ), ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (height < 250) - height++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (height > 0) height--; - }); - }, - ), - ], + mWidth(12), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, ), ), ], ), ), ), - ), - Expanded( - child: Slider( - value: height.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - height = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - ], - ), - Texts('Select Unit'), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(1); - isHeightCm = true; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), ], - color: cmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), ), ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(2); - isHeightCm = false; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: ftCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), - ), + SizedBox( + height: 12.0, ), - ), - ], - ), - SizedBox( - height: 5.0, - ), - Texts( - 'Weight', - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController), + SizedBox( + height: 12.0, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(weight.toString()), + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; + }, + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList, + ), + SizedBox( + height: 12.0, + ), + _commonInputAndUnitRow( + TranslationBase.of(context).weight, + _weightController, + 1, + 270, + _weightValue, + (text) { + _weightController.text = text; + }, + (value) { + _weightValue = value; + }, + _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound, + (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }, + _weightPopupList, + ), + SizedBox( + height: 12.0, + ), + InkWell( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, + child: Container( + // width: double.infinity, + // decoration: containerRadius(Colors.white, 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).activityLevel, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, ), ), Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight < 250) - weight++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight > 0) weight--; - }); - }, + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: dropdownValue, key: clinicDropdownKey, + icon: Icon(Icons.arrow_downward), + iconSize: 0, + elevation: 16, + isExpanded: true, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, ), - ], + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + TranslationBase.of(context).almostInactive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).veryActive, + TranslationBase.of(context).superActive + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), ), ), ], ), ), - ), - ), - Expanded( - child: Slider( - value: weight.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - weight = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), + Icon(Icons.keyboard_arrow_down), + ], ), - ], - ), - ), - ], - ), - Texts('Select Unit'), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(1); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: kgCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('KG')), - ), + ).withBorderedContainer, ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(2); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: lbCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('LB')), - ), + SizedBox( + height: 25.0, ), - ), - ], - ), - SizedBox( - height: 45.0, - ), - Divider( - thickness: 2.0, - ), - SizedBox( - height: 5.0, - ), - Texts('Activity level'), - Container( - width: 300, - child: DropdownButton( - value: dropdownValue, - icon: Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle(color: Colors.black87), - underline: Container( - height: 2, - color: Colors.black54, - ), - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - }); - }, - items: [ - 'Almost Inactive(Little or no exercises)', - 'Lighty Active (1-3) days per week', - 'very Active(6-7) days per week', - 'Super Active(very hard exercises)' - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), + ], ), + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + calculateBmr(); + calculateCalories(context); + + { + Navigator.push( + context, + FadePage( + page: BmrResultPage( + bmrResult: bmrResult, + calories: calories, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ); + } + + void openDropdown(GlobalKey key) { + GestureDetector detector; + void searchForGestureDetector(BuildContext element) { + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget; + return false; + } else { + searchForGestureDetector(element); + } + + return true; + }); + } + + searchForGestureDetector(key.currentContext); + assert(detector != null); + + detector.onTap(); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - SizedBox( - height: 30.0, + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - height: 50.0, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - onTap: () { - setState(() { - calculateBmr(); - calculateCalories(); - - { - Navigator.push( - context, - FadePage( - page: BmrResultPage( - bmrResult: bmrResult, - calories: calories, - )), - ); - } - }); - }, + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), - ], + ), + ], + ), ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; + } +} + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart index 6e7d6279..4ef6ad08 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -1,5 +1,12 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -9,65 +16,165 @@ import 'package:percent_indicator/circular_percent_indicator.dart'; class BmrResultPage extends StatelessWidget { final double bmrResult; final double calories; + BmrResultPage({this.bmrResult, this.calories}); + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: 'BMR Calculator', + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bmr, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Center( - child: CircularPercentIndicator( - radius: 220.0, - lineWidth: 20.0, - percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500), - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - bmrResult.toStringAsFixed(1), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.34, + fontWeight: FontWeight.bold, ), - SizedBox( - height: 5.0, + ), + mHeight(20), + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 3.0, + percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + bmrResult.toStringAsFixed(1), + style: TextStyle( + fontSize: 17, + letterSpacing: -1.02, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 5.0, + ), + Text( + TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + progressColor: CustomColors.accentColor, + backgroundColor: Colors.white, ), - Text( - 'Calories/Day', - style: TextStyle( - fontSize: 16.0, + ), + mHeight(20), + Text( + TranslationBase.of(context).bodyWillBurn+' ( ${bmrResult.toStringAsFixed(1)} )'+TranslationBase.of(context).caloriesEachDay+'( ${calories.toStringAsFixed(1)} ) '+TranslationBase.of(context).maintainWeight, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, fontWeight: FontWeight.w600, - ), + color: CustomColors.textColor ), - ], - ), - progressColor: Color(0xff3C3939), - ), - ), - Container( - height: 120, - width: 280.0, - child: Texts( - 'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.'), + ), + ], + ).withBorderedContainer, ), + mFlex(1), + Container( - width: 350, - child: Button( - label: 'See List Of Doctors', - onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); - }), + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), ), + ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 3).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} \ No newline at end of file diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 44a3dc9e..6aab447a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -1,10 +1,13 @@ -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'dart:math'; + +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'dart:math'; +import 'package:flutter/services.dart'; import 'body_fat_result_page.dart'; @@ -19,43 +22,63 @@ class BodyFat extends StatefulWidget { } class _BodyFatState extends State { + final GlobalKey clinicDropdownKey = GlobalKey(); + bool _isHeightCM = true; + bool _isNeckKG = true; + bool _isWaistKG = true; + bool _isHipKG = true; + double _heightValue = 0; + double _neckValue = 0; + double _waistValue = 0; + double _hipValue = 0; + + TextEditingController _heightController = new TextEditingController(); + TextEditingController _neckController = TextEditingController(); + TextEditingController _waistController = TextEditingController(); + TextEditingController _hipController = TextEditingController(); + + List _heightPopupList = List(); + List _neckPopupList = List(); + List _waistPopupList = List(); + List _hipPopupList = List(); + bool isMale = false; - bool isHeightCm = true; + + // bool isHeightCm = true; Color maleCard = activeCardColorGender; Color femaleCard = inactiveCardColorGender; - Color neckCmCard = activeCardColor; - Color neckFtCard = inactiveCardColor; + + // Color neckCmCard = activeCardColor; + // Color neckFtCard = inactiveCardColor; Color waistCmCard = activeCardColor; Color waistFtCard = inactiveCardColor; Color hipCmCard = activeCardColor; Color hipFtCard = inactiveCardColor; Color cmCard = activeCardColor; Color ftCard = inactiveCardColor; - int neck = 10; - int heightCm = 0; - int heightFt = 0; - int hip = 5; + + // int neck = 10; + // int heightCm = 0; + // int heightFt = 0; + // int hip = 5; double heightInches; double minRange; double maxRange; double overWeightBy; - int waist = 5; + + // int waist = 5; double bodyFat = 0; double fat = 0; String dropdownValue; double calories = 0; String textResult = ''; - TextEditingController heightController = TextEditingController(); - TextEditingController neckController = TextEditingController(); - TextEditingController waistController = TextEditingController(); - TextEditingController hipController = TextEditingController(); @override void initState() { - neckController.text = neck.toString(); - hipController.text = hip.toString(); - waistController.text = waist.toString(); - heightController.text = heightCm.toString(); + _neckController.text = _neckValue.toString(); + _hipController.text = _hipValue.toString(); + _waistController.text = _waistValue.toString(); + _heightController.text = _heightValue.toString(); super.initState(); } @@ -79,26 +102,6 @@ class _BodyFatState extends State { } } - void updateColorNeck(int type) { - //MG/DLT card - if (type == 1) { - if (neckCmCard == inactiveCardColor) { - neckCmCard = activeCardColor; - neckFtCard = inactiveCardColor; - } else { - neckCmCard = inactiveCardColor; - } - } - if (type == 2) { - if (neckFtCard == inactiveCardColor) { - neckFtCard = activeCardColor; - neckCmCard = inactiveCardColor; - } else { - neckFtCard = inactiveCardColor; - } - } - } - void updateColorWaist(int type) { //MG/DLT card if (type == 1) { @@ -161,10 +164,10 @@ class _BodyFatState extends State { void calculateBodyFat() { if (isMale == true) { - bodyFat = 495 / (1.0324 - 0.19077 * (log(waist - neck) / ln10) + 0.15456 * (log(heightCm) / ln10)) - 450; + bodyFat = 495 / (1.0324 - 0.19077 * (log(_waistValue - _neckValue) / ln10) + 0.15456 * (log(int.parse(_heightController.text)) / ln10)) - 450; fat = (bodyFat * 10) / 10.round(); } else if (isMale == false) { - bodyFat = 495 / (1.29579 - 0.35004 * (log(waist + hip - neck) / ln10) + 0.22100 * (log(heightCm) / ln10)) - 450; + bodyFat = 495 / (1.29579 - 0.35004 * (log(_waistValue + _hipValue - _neckValue) / ln10) + 0.22100 * (log(int.parse(_heightController.text)) / ln10)) - 450; fat = (bodyFat * 10) / 10.round(); } if (fat <= 0) { @@ -172,46 +175,54 @@ class _BodyFatState extends State { } } - void showTextResult() { + void showTextResult(BuildContext context) { if (isMale == false) { if (bodyFat > 9 && bodyFat <= 13) { - textResult = 'The category falls under essential'; + textResult = TranslationBase.of(context).essential; } else if (bodyFat > 13 && bodyFat <= 20) { - textResult = 'The category falls under athlete'; + textResult = TranslationBase.of(context).athlete; } else if (bodyFat > 20 && bodyFat <= 24) { - textResult = 'The category falls under fitness'; + textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 31) { - textResult = 'The category falls under acceptable'; + textResult = TranslationBase.of(context).acceptable; } else if (bodyFat > 31 && bodyFat <= 60) { - textResult = 'The category falls under obese'; + textResult = TranslationBase.of(context).underObese; } else if (bodyFat > 60) { - textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + textResult = TranslationBase.of(context).crossedLimits; } else if (bodyFat <= 9) { - textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + textResult = TranslationBase.of(context).lowLimits; } } else { if (bodyFat > 5 && fat <= 13) { - textResult = 'The category falls under essential'; + textResult = TranslationBase.of(context).essential; } else if (bodyFat > 13 && bodyFat <= 17) { - textResult = 'The category falls under athlete'; + textResult = TranslationBase.of(context).athlete; } else if (bodyFat > 17 && bodyFat <= 24) { - textResult = 'The category falls under fitness'; + textResult = TranslationBase.of(context).fitness; } else if (bodyFat > 24 && bodyFat <= 45) { - textResult = 'The category falls under obese'; + textResult = TranslationBase.of(context).underObese; } else if (bodyFat > 45) { - textResult = 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + textResult = TranslationBase.of(context).crossedLimits; } else if (bodyFat <= 5) { - textResult = 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + textResult = TranslationBase.of(context).lowLimits; } } } @override Widget build(BuildContext context) { + _neckPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + + _waistPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _hipPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, - appBarTitle: 'Body Fat', - showHomeAppBarIcon: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bodyFatTitle, appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), @@ -221,814 +232,455 @@ class _BodyFatState extends State { ), ) ], - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 1000.0, - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Texts('Estimates the total body fat based on\n the size'), - ), - Divider( - thickness: 2.0, - ), - SizedBox( - height: 5.0, - ), - Column( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(20), + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Gender'), + Text( + TranslationBase.of(context).bodyFatDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), + ), SizedBox( - height: 5.0, + height: 20, + ), + Text( + TranslationBase.of(context).selectGender, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), + ), + SizedBox( + height: 8.0, ), Container( - width: 350, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(35.0), - color: Colors.white, - border: Border.all( - color: Colors.black45, - )), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - isMale = false; - }); - }, - child: Container( - height: 55.0, - width: 170.0, - decoration: BoxDecoration( - color: maleCard, - borderRadius: BorderRadius.circular(35.0), - ), - child: Center(child: Texts('FEMALE')), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - isMale = true; - }); - }, - child: Container( - height: 55.0, - width: 170.0, - decoration: BoxDecoration( - color: femaleCard, - borderRadius: BorderRadius.circular(35.0), - ), - child: Center(child: Texts('MALE')), - ), - ), - ], - ), - ), - Texts( - 'Height', - ), - Row( - children: [ - Expanded( - child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + isMale = false; + }); + }, + child: Row( + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Padding( - padding: const EdgeInsets.only(left: 10.0), - child: TextFormField( - keyboardType: TextInputType.number, - controller: heightController, - ), - ), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (heightCm < 250) heightCm++; - heightController.text = heightCm.toString(); - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (heightCm > 0) heightCm--; - heightController.text = heightCm.toString(); - }); - }, - ), - ], - ), - ), - ], - ), + width: double.infinity, + height: double.infinity, + decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100), ), ), - ), - Expanded( - child: Slider( - value: heightCm.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - heightCm = newValue.round(); - heightController.text = heightCm.toString(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), + mWidth(12), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + ), ), - ), - ], - ), - ), - ), - ], - ), - Texts('Select Unit'), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(1); - isHeightCm = true; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - color: cmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(2); - isHeightCm = false; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: ftCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), + ], + ), ), ), - ), - ], - ), - SizedBox( - height: 10.0, - ), - Texts( - 'Neck', - ), - Row( - children: [ - Expanded( - child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + isMale = true; + }); + }, + child: Row( + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Padding( - padding: const EdgeInsets.only(left: 15.0, bottom: 0), - child: TextFormField( - keyboardType: TextInputType.number, - controller: neckController, - ), - ), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (neck < 60) neck++; - neckController.text = neck.toString(); - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (neck > 5) neck--; - neckController.text = neck.toString(); - }); - }, - ), - ], - ), - ), - ], - ), + width: double.infinity, + height: double.infinity, + decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100), ), ), - ), - Expanded( - child: Slider( - value: neck.toDouble(), - min: 5, - max: 60, - onChanged: (double newValue) { - setState(() { - neck = newValue.round(); - neckController.text = neck.toString(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), + mWidth(12), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + ), ), - ), - ], - ), - ), - ), - ], - ), - Texts('Select Unit'), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorNeck(1); - isHeightCm = true; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - color: neckCmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorNeck(2); - isHeightCm = false; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: neckFtCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), + ], + ), ), ), - ), - ], + ], + ), ), SizedBox( - height: 10.0, - ), - Texts( - 'Waist', + height: 12.0, ), - Row( - children: [ - Expanded( - child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Padding( - padding: const EdgeInsets.only(left: 10.0), - child: TextFormField( - keyboardType: TextInputType.number, - controller: waistController, - ), - ), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (waist < 200) waist++; - waistController.text = waist.toString(); - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (waist > 5) waist--; - waistController.text = waist.toString(); - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: waist.toDouble(), - min: 5, - max: 200, - onChanged: (double newValue) { - setState(() { - waist = newValue.round(); - waistController.text = waist.toString(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - ), - ], + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; + }, + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList, ), - Texts('Select Unit'), SizedBox( - height: 5.0, + height: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorWaist(1); - isHeightCm = true; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - color: waistCmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorWaist(2); - isHeightCm = false; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: waistFtCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), - ), - ), - ), - ], + _commonInputAndUnitRow( + TranslationBase.of(context).neck, + _neckController, + 1, + 270, + _neckValue, + (text) { + _neckController.text = text; + }, + (value) { + _neckValue = value; + }, + _isNeckKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isNeckKG != value) { + setState(() { + _isNeckKG = value; + }); + } + }, + _neckPopupList, ), SizedBox( - height: 10.0, - ), - Texts( - 'Hip', + height: 12.0, ), - Row( - children: [ - Expanded( - child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Padding( - padding: const EdgeInsets.only(left: 10.0), - child: TextFormField( - keyboardType: TextInputType.number, - controller: hipController, - ), - ), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (hip < 140) hip++; - hipController.text = hip.toString(); - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (hip > 5) hip--; - hipController.text = hip.toString(); - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: hip.toDouble(), - min: 5, - max: 140, - onChanged: (double newValue) { - setState(() { - hip = newValue.round(); - hipController.text = hip.toString(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - ), - ], + _commonInputAndUnitRow( + TranslationBase.of(context).waist, + _waistController, + 1, + 270, + _waistValue, + (text) { + _waistController.text = text; + }, + (value) { + _waistValue = value; + }, + _isWaistKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isWaistKG != value) { + setState(() { + _isWaistKG = value; + }); + } + }, + _waistPopupList, ), - Texts('Select Unit'), SizedBox( - height: 5.0, + height: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorHip(1); - isHeightCm = true; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - color: hipCmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorHip(2); - isHeightCm = false; - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: hipFtCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), - ), - ), - ), - ], + _commonInputAndUnitRow( + TranslationBase.of(context).hip, + _hipController, + 1, + 270, + _hipValue, + (text) { + _hipController.text = text; + }, + (value) { + _hipValue = value; + }, + _isHipKG ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHipKG != value) { + setState(() { + _isHipKG = value; + }); + } + }, + _hipPopupList, ), SizedBox( - height: 35.0, + height: 12.0, ), ], ), - Container( - height: MediaQuery.of(context).size.height * 0.084, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - // onTap: () => { - // setState(() { - // print('hiii'); - // }) - // } - onTap: () { - setState(() { - calculateBodyFat(); - showTextResult(); + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + calculateBodyFat(); + showTextResult(context); - { - Navigator.push( - context, - FadePage( - page: FatResult( - bodyFat: bodyFat, - fat: fat, - textResult: textResult, - )), - ); - } - }); - }, + { + Navigator.push( + context, + FadePage( + page: FatResult( + bodyFat: bodyFat, + fat: fat, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - ), - ], + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; + } +} + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart index f41f9598..b8285083 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart @@ -1,5 +1,12 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -12,7 +19,9 @@ class FatResult extends StatelessWidget { final String textResult; FatResult({this.bodyFat, this.fat, this.textResult = ''}); + Color inductorColor; + Color colorInductor() { if (bodyFat >= 17) { inductorColor = Color(0xffC70D00); @@ -30,56 +39,145 @@ class FatResult extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Body Fat', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bodyFatTitle, body: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - SizedBox( - // height: 40.0, - ), - Center( - child: CircularPercentIndicator( - radius: 220.0, - lineWidth: 20.0, - percent: ((fat > 70) ? 100 : fat / 100), - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - fat.toStringAsFixed(1) + '%', - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bodyFatTitle, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.34, + fontWeight: FontWeight.bold, + ), + ), + mHeight(20), + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 3.0, + percent: ((fat > 70) ? 100 : fat / 100), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + fat.toStringAsFixed(1) + '%', + style: TextStyle( + fontSize: 17, + letterSpacing: -1.02, + fontWeight: FontWeight.w600, + ), + ), + ], ), + progressColor: CustomColors.accentColor, + backgroundColor: Colors.white, ), - SizedBox( - height: 5.0, + ), + mHeight(20), + Text( + textResult, style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor ), - ], - ), - progressColor: inductorColor, - backgroundColor: Colors.white, - ), - ), - Container( - height: 120, - width: 280.0, - child: Texts(textResult), + ), + ], + ).withBorderedContainer, ), + mFlex(1), + Container( - width: 350, - child: Button( - label: 'See List Of Doctors', + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), + ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 5).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} \ No newline at end of file diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index 25293a81..b7e00652 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -1,10 +1,14 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'calorie_result_page.dart'; @@ -22,13 +26,23 @@ class _CalorieCalculatorState extends State { bool isMale = false; Color maleCard = activeCardColorGender; Color femaleCard = inactiveCardColorGender; - Color kgCard = activeCardColor; - Color lbCard = inactiveCardColor; - Color cmCard = activeCardColor; - Color ftCard = inactiveCardColor; - int age = 0; - int height = 0; - int weight = 0; + + final GlobalKey clinicDropdownKey = GlobalKey(); + bool _isHeightCM = true; + bool _isWeightKG = true; + double _heightValue = 150; + double _weightValue = 40; + + TextEditingController ageController = new TextEditingController(); + TextEditingController _heightController = new TextEditingController(); + TextEditingController _weightController = TextEditingController(); + + List _heightPopupList = List(); + List _weightPopupList = List(); + + // int age = 0; + // int height = 0; + // int weight = 0; double calories; String dropdownValue; @@ -52,69 +66,32 @@ class _CalorieCalculatorState extends State { } } - void updateColorWeight(int type) { - //MG/DLT card - if (type == 1) { - if (kgCard == inactiveCardColor) { - kgCard = activeCardColor; - lbCard = inactiveCardColor; - } else { - kgCard = inactiveCardColor; - } - } - if (type == 2) { - if (lbCard == inactiveCardColor) { - lbCard = activeCardColor; - kgCard = inactiveCardColor; - } else { - lbCard = inactiveCardColor; - } - } - } - - void updateColorHeight(int type) { - //MG/DLT card - if (type == 1) { - if (cmCard == inactiveCardColor) { - cmCard = activeCardColor; - ftCard = inactiveCardColor; - } else { - cmCard = inactiveCardColor; - } - } - if (type == 2) { - if (ftCard == inactiveCardColor) { - ftCard = activeCardColor; - cmCard = inactiveCardColor; - } else { - ftCard = inactiveCardColor; - } - } - } - void calculateCalories() { if (isMale == true) { - calories = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age); + calories = 66.5 + (13.75 * int.parse(_weightController.text)) + (5.003 * int.parse(_heightController.text)) - (6.755 * int.parse(ageController.text)); } else if (isMale == false) { - calories = - 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + calories = 655.0955 + (9.5634 * int.parse(_weightController.text)) + (1.850 * int.parse(_heightController.text)) - (4.676 * int.parse(ageController.text)); } } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: - "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}", - showHomeAppBarIcon: false, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calcHealth}", appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), child: Icon( Icons.info_outline, - color: Colors.white, + color: Colors.black, ), ) ], @@ -128,23 +105,31 @@ class _CalorieCalculatorState extends State { //mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( + Text( TranslationBase.of(context).calorieCalcDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), ), SizedBox( - height: 8.0, + height: 20, + ), + Text( + TranslationBase.of(context).selectGender, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), ), - Texts(TranslationBase.of(context).gender), SizedBox( height: 8.0, ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(30.0), - color: Colors.white, - border: Border.all( - color: Colors.black45, - )), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -156,15 +141,29 @@ class _CalorieCalculatorState extends State { isMale = false; }); }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 16), - decoration: BoxDecoration( - color: maleCard, - borderRadius: BorderRadius.circular(30.0), - ), - child: Center( - child: Texts( - TranslationBase.of(context).female)), + child: Row( + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadius(!isMale ? CustomColors.accentColor : Colors.white, 100), + ), + ), + mWidth(12), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + ), + ), + ], ), ), ), @@ -176,506 +175,157 @@ class _CalorieCalculatorState extends State { isMale = true; }); }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 16), - decoration: BoxDecoration( - color: femaleCard, - borderRadius: BorderRadius.circular(30.0), - ), - child: Center( - child: Texts( - TranslationBase.of(context).male)), - ), - ), - ), - ], - ), - ), - SizedBox( - height: 12.0, - ), - Texts( - TranslationBase.of(context).age11_120Years, - ), - Container( - margin: - EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Center( - child: Text(age.toString()), - ), - ), + child: Row( + children: [ + Container( + decoration: containerColorRadiusBorderWidth(Colors.white, 1000, CustomColors.darkGreyColor, 1), + width: 24, + height: 24, + padding: EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadius(isMale ? CustomColors.accentColor : Colors.white, 100), ), - Container( - padding: - EdgeInsets.symmetric(horizontal: 4), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (age < 120) age++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (age > 0) age--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: age.toDouble(), - min: 0, - max: 120, - onChanged: (double newValue) { - setState(() { - age = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - Texts( - TranslationBase.of(context).height, - ), - Container( - margin: - EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, ), - ), - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Center( - child: Text(height.toString()), - ), - ), + mWidth(12), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, ), - Container( - padding: - EdgeInsets.symmetric(horizontal: 4.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (height < 250) height++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (height > 0) height--; - }); - }, - ), - ], - ), - ), - ], - ), + ), + ], ), ), ), - Expanded( - child: Slider( - value: height.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - height = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), ], ), ), - Texts( - TranslationBase.of(context).selectUnit, + SizedBox( + height: 12.0, ), + inputWidget(TranslationBase.of(context).age11_120Years, "0", ageController), SizedBox( - height: 8.0, + height: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColorHeight(1); - }); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center( - child: - Texts(TranslationBase.of(context).cm)), - ), - ), - ), - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColorHeight(2); - }); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: ftCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Center( - child: Texts( - TranslationBase.of(context).feet))), - ), - ), - ), - ], + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; + }, + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList, ), SizedBox( - height: 8.0, + height: 12.0, ), - Texts( + _commonInputAndUnitRow( TranslationBase.of(context).weight, + _weightController, + 1, + 270, + _weightValue, + (text) { + _weightController.text = text; + }, + (value) { + _weightValue = value; + }, + _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound, + (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }, + _weightPopupList, ), SizedBox( - height: 5.0, + height: 12.0, ), - Container( - margin: - EdgeInsets.symmetric(horizontal: 4.0, vertical: 12.0), - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(weight.toString()), - ), + + InkWell( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, + child: Container( + // width: double.infinity, + // decoration: containerRadius(Colors.white, 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).activityLevel, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight < 250) weight++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight > 0) weight--; - }); - }, - ), - ], + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: dropdownValue, + key: clinicDropdownKey, + icon: Icon(Icons.arrow_downward), + iconSize: 0, + elevation: 16, + isExpanded: true, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + TranslationBase.of(context).almostInactive, + TranslationBase.of(context).lightActive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).superActive, + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), ), ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: weight.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - weight = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - Texts(TranslationBase.of(context).selectUnit), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColorWeight(1); - }); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow ), ], - color: kgCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center( - child: - Texts(TranslationBase.of(context).kg)), ), ), - ), + Icon(Icons.keyboard_arrow_down), + ], ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColorWeight(2); - }); - }, - child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: lbCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Center( - child: Texts( - TranslationBase.of(context).pound)), - ), - ), - ), - ), - ], - ), - SizedBox( - height: 8.0, - ), - Texts(TranslationBase.of(context).activityLevel), - Container( - child: DropdownButton( - value: dropdownValue, - icon: Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle(color: Colors.black87), - underline: Container( - height: 2, - color: Colors.black54, - ), - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - }); - }, - items: [ - 'Almost Inactive(Little or no exercises)', - 'Lighty Active (1-3) days per week', - 'very Active(6-7) days per week', - 'Super Active(very hard exercises)' - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), + ).withBorderedContainer, ), SizedBox( height: 25.0, @@ -687,8 +337,10 @@ class _CalorieCalculatorState extends State { ), Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, child: SecondaryButton( label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, onTap: () { setState(() { calculateCalories(); @@ -710,4 +362,231 @@ class _CalorieCalculatorState extends State { ), ); } + + void openDropdown(GlobalKey key) { + GestureDetector detector; + void searchForGestureDetector(BuildContext element) { + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget; + return false; + } else { + searchForGestureDetector(element); + } + + return true; + }); + } + + searchForGestureDetector(key.currentContext); + assert(detector != null); + + detector.onTap(); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; + } +} + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], + ), + ); + } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart index ed3dd8f8..68bd2d2c 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -1,6 +1,12 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -15,54 +21,160 @@ class CalorieResultPage extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - isShowDecPage: false, appBarTitle: "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calculators}", isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, body: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Center( - child: CircularPercentIndicator( - radius: 220.0, - lineWidth: 20.0, - percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500), - center: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - calorie.toStringAsFixed(1), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.34, + fontWeight: FontWeight.bold, + ), + ), + mHeight(20), + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 3.0, + percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + calorie.toStringAsFixed(1), + style: TextStyle( + fontSize: 17, + letterSpacing: -1.02, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 5.0, + ), + Text( + TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), + progressColor: CustomColors.accentColor, + backgroundColor: Colors.white, ), - SizedBox( - height: 5.0, + ), + mHeight(20), + Text( + TranslationBase.of(context).dailyIntake+' ${calorie.toStringAsFixed(1)} '+TranslationBase.of(context).calories, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor ), - Texts('Calories'), - ], - ), - progressColor: Color(0xff3C3939), - backgroundColor: Colors.white, - ), + ), + ], + ).withBorderedContainer, ), + mFlex(1), Container( - child: Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'), - ), - Container( - width: 350, - child: Button( - label: 'See List Of Doctors', + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), + ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 2).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index 7d8f4655..9f2c6842 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -1,11 +1,13 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.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/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:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'carbs_result_page.dart'; @@ -16,6 +18,7 @@ class Carbs extends StatefulWidget { class _CarbsState extends State { TextEditingController textController = new TextEditingController(); + final GlobalKey clinicDropdownKey = GlobalKey(); int calories; String dropdownValue; bool _visible = false; @@ -35,27 +38,27 @@ class _CarbsState extends State { double fCalMeal; void calculateDietRatios() { - if (dropdownValue == 'Very Low Carb') { + if (dropdownValue == TranslationBase.of(context).dietVeryLow) { meals = 3; protein = 45; carbs = 10; fat = 45; - } else if (dropdownValue == 'Low Carb') { + } else if (dropdownValue == TranslationBase.of(context).dietLow) { meals = 3; protein = 40; carbs = 30; fat = 30; - } else if (dropdownValue == 'Moderate Carb') { + } else if (dropdownValue == TranslationBase.of(context).dietModerate) { meals = 3; protein = 25; carbs = 50; fat = 25; - } else if (dropdownValue == 'USDA Gudilines') { + } else if (dropdownValue == TranslationBase.of(context).dietUSDA) { meals = 3; protein = 15; carbs = 55; fat = 30; - } else if (dropdownValue == 'Zone Diet') { + } else if (dropdownValue == TranslationBase.of(context).dietZone) { meals = 3; protein = 30; carbs = 40; @@ -66,9 +69,9 @@ class _CarbsState extends State { void calculate() { pCal = (protein / 100.0) * int.parse(textController.text).ceil(); cCal = (carbs / 100.0) * int.parse(textController.text); - ; + fCal = (fat / 100) * int.parse(textController.text); - ; + pCalGram = pCal / 4.0; cCalGram = cCal / 4.0; fCalGram = fCal / 9.0; @@ -79,10 +82,13 @@ class _CarbsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, - appBarTitle: 'Carb Protein Fat', - showHomeAppBarIcon: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).carbohydrate, appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), @@ -92,286 +98,280 @@ class _CarbsState extends State { ), ) ], - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - 'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio', - ), - SizedBox( - height: 15.0, - ), - Column( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 300.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: TextFormField( - controller: textController, - inputFormatters: [ - FilteringTextInputFormatter - .digitsOnly - ], - keyboardType: TextInputType.number, - decoration: InputDecoration( - hintText: " The Calories per day ", - labelStyle: TextStyle( - color: Colors.black87, - ), - ), - ), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - int currentValue = int.parse( - textController.text); - currentValue++; - textController.text = - (currentValue).toString(); - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - int currentValue = int.parse( - textController.text); - currentValue--; - textController.text = - (currentValue).toString(); - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - ], + Text( + TranslationBase.of(context).carbProteinDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, ), ), SizedBox( - height: 20.0, + height: 15.0, ), - Button( - backgroundColor: Color(0xffC5272D), - label: 'NOT SURE? CLICK HERE', - onTap: () { - setState(() { - { + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + inputWidget(TranslationBase.of(context).calDay, "0", textController), + InkWell( + onTap: () { Navigator.push( context, FadePage(page: CalorieCalculator()), ); - } - }); - }, + }, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Text( + TranslationBase.of(context).notSure, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline), + ), + ), + ) + ], ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Select Diet Type'), - Container( - width: 400, - child: DropdownButton( - value: dropdownValue, - icon: Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle(color: Colors.black87), - underline: Container( - height: 2, - color: Colors.black54, - ), - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - calculateDietRatios(); - - dropdownValue == null - ? _visible = false - : _visible = true; - }); - }, - items: [ - 'Very Low Carb', - 'Low Carb', - 'Moderate Carb', - 'USDA Gudilines', - 'Zone Diet', - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), + SizedBox( + height: 12.0, ), - Visibility( - visible: _visible, + InkWell( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, child: Container( - height: 170.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // width: double.infinity, + // decoration: containerRadius(Colors.white, 12), + // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( children: [ - Texts( - 'Ratios are divided according to the selected diet'), - RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - TextSpan(text: 'Meals Per Day '), - TextSpan( - text: '$meals', - style: TextStyle(color: Color(0xffC5272D)), - ), - ], - ), - ), - RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - TextSpan( - text: 'Protein ', - ), - TextSpan( - text: '$protein%', - style: TextStyle(color: Color(0xffC5272D)), - ) - ], - ), - ), - RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - TextSpan( - text: 'Carbohydrate ', + Text( + TranslationBase.of(context).selectDiet, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), ), - TextSpan( - text: '$carbs%', - style: TextStyle(color: Color(0xffC5272D)), - ) - ], - ), - ), - RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - TextSpan( - text: 'Fat ', + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: dropdownValue, key: clinicDropdownKey, + icon: Icon(Icons.arrow_downward), + iconSize: 0, + elevation: 16, + isExpanded: true, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + calculateDietRatios(); + }); + }, + items: [ + TranslationBase.of(context).dietVeryLow, + TranslationBase.of(context).dietLow, + TranslationBase.of(context).dietModerate, + TranslationBase.of(context).dietUSDA, + TranslationBase.of(context).dietZone + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), + ); + }).toList(), + ), + ), ), - TextSpan( - text: '$fat%', - style: TextStyle(color: Color(0xffC5272D)), - ) ], ), ), + Icon(Icons.keyboard_arrow_down), ], ), - ), - ) + ).withBorderedContainer, + ), + SizedBox( + height: 25.0, + ), + SizedBox( + height: 55.0, + ), ], ), - SizedBox( - height: 55.0, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + { + calculate(); + Navigator.push( + context, + FadePage( + page: CarbsResult( + cCal: cCal, + pCal: pCal, + fCal: fCal, + pCalGram: pCalGram, + pCalMeal: pCalMeal, + fCalGram: fCalGram, + fCalMeal: fCalMeal, + cCalGram: cCalGram, + cCalMeal: cCalMeal, + )), + ); + } + }); + }, + ), + ), + ], + ), + ); + } + + void openDropdown(GlobalKey key) { + GestureDetector detector; + void searchForGestureDetector(BuildContext element) { + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget; + return false; + } else { + searchForGestureDetector(element); + } + + return true; + }); + } + + searchForGestureDetector(key.currentContext); + assert(detector != null); + + detector.onTap(); + } +} + +Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - Container( - height: 50.0, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - onTap: () { - setState(() { - { - calculate(); - Navigator.push( - context, - FadePage( - page: CarbsResult( - cCal: cCal, - pCal: pCal, - fCal: fCal, - pCalGram: pCalGram, - pCalMeal: pCalMeal, - fCalGram: fCalGram, - fCalMeal: fCalMeal, - cCalGram: cCalGram, - cCalMeal: cCalMeal, - )), - ); - } - }); - }, + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), ), ], ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), - ); - } + ), + ); +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart index 474b8613..44363734 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -1,12 +1,20 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'dart:math'; - import 'package:flutter/painting.dart'; +import 'package:provider/provider.dart'; class CarbsResult extends StatelessWidget { double pCal; @@ -19,165 +27,162 @@ class CarbsResult extends StatelessWidget { double cCalMeal; double fCalMeal; - CarbsResult( - {this.pCal, - this.cCal, - this.fCal, - this.pCalGram, - this.cCalGram, - this.fCalGram, - this.fCalMeal, - this.cCalMeal, - this.pCalMeal}); + CarbsResult({this.pCal, this.cCal, this.fCal, this.pCalGram, this.cCalGram, this.fCalGram, this.fCalMeal, this.cCalMeal, this.pCalMeal}); + @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, - appBarTitle: 'Carb Protein Fat', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).carbohydrate, body: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0), - child: Table( - border: TableBorder( - verticalInside: BorderSide(width: 1, color: Colors.black54), - bottom: BorderSide(width: 1, color: Colors.black54), - left: BorderSide(width: 1, color: Colors.black54), - right: BorderSide(width: 1, color: Colors.black54), - top: BorderSide(width: 1, color: Colors.black54), - ), + Container( + decoration: containerRadius(Colors.white, 12), + padding: EdgeInsets.all(12), + margin: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - TableRow( - decoration: BoxDecoration( - color: Colors.white, - ), - children: [ - TableCell( - child: Center( - child: Texts('Description'), - ), - ), - TableCell( - child: Center( - child: Texts('Protein'), - ), - ), - TableCell( - child: Center( - child: Texts( - 'Carbohydrate', - ), - ), - ), - TableCell( - child: Center( - child: Texts('Fat'), - ), - ), - ]), - TableRow(children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: TableCell( - child: Center( - child: Texts('Calories\n Per Day'), - ), - ), - ), - TableCell( - child: Center( - child: Texts(pCal.ceil().toString() + ' Cals'), - ), - ), - TableCell( - child: Center( - child: Texts(cCal.ceil().toString() + ' Cals'), - ), - ), - TableCell( - child: Center( - child: Texts(fCal.ceil().toString() + ' Cals'), - ), - ), - ]), - TableRow(children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: TableCell( - child: Center( - child: Texts('Grams Per\n Day'), - ), - ), - ), - TableCell( - child: Center( - child: Texts(pCalGram.ceil().toString() + ' gr'), - ), - ), - TableCell( - child: Center( - child: Texts(cCalGram.ceil().toString() + ' gr'), - ), - ), - TableCell( - child: Center( - child: Texts(fCalGram.ceil().toString() + ' gr'), - ), - ), - ]), - TableRow(children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: TableCell( - child: Center( - child: Texts('Grams Per\n Meal'), - ), - ), + Text( + TranslationBase.of(context).carbsProtin, + style: TextStyle( + fontSize: 19, + fontWeight: FontWeight.bold, + letterSpacing: -1.34, ), - TableCell( - child: Center( - child: Texts(pCalMeal.ceil().toString() + ' gr'), - ), - ), - TableCell( - child: Center( - child: Texts(cCalMeal.ceil().toString() + ' gr'), - ), - ), - TableCell( - child: Center( - child: Texts(fCalMeal.ceil().toString() + ' gr'), - ), - ), - ]), + ), + mHeight(12), + Table( + columnWidths: { + 0: FlexColumnWidth(2.4), + 1: FlexColumnWidth(1.8), + 2: FlexColumnWidth(2), + 3: FlexColumnWidth(1), + }, + children: fullData(context, projectViewModel), + ), ], ), ), Container( - width: 350, - child: Button( - label: 'See List Of Doctors', + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).seeListOfDoctor, + color: CustomColors.accentColor, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), + ], ), + ); + } - // Texts(pCal.ceil().toString()), - // Texts(cCal.ceil().toString()), - // Texts(fCal.ceil().toString()), - // Texts(pCalGram.ceil().toString()), - // Texts(cCalGram.ceil().toString()), - // Texts(fCalGram.ceil().toString()), - // Texts(pCalMeal.ceil().toString()), - // Texts(cCalMeal.ceil().toString()), - // Texts(fCalMeal.ceil().toString()), + List fullData(BuildContext context, ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).description), + Utils.tableColumnTitle(TranslationBase.of(context).Protein), + Utils.tableColumnTitle(TranslationBase.of(context).carbohydrate), + Utils.tableColumnTitle(TranslationBase.of(context).fat), + ], + ), ); + + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue(TranslationBase.of(context).calDay, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCal.ceil().toString() + ' '+TranslationBase.of(context).Cals, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue(TranslationBase.of(context).gramsPerDay, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(fCalGram.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue(TranslationBase.of(context).gramsPerMeal, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(pCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(cCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(fCalMeal.ceil().toString() + ' '+TranslationBase.of(context).gr, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + return tableRow; + } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 11).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index db5a585c..b8528ea6 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -40,104 +42,118 @@ class _DeliveryDueState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Delivery Due Date', - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 35.0, vertical: 20.0), - child: SingleChildScrollView( - child: Container( - child: Column( - //mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Texts( - 'Congratulations, you are pregnant! Now when will the new baby arrive? To estimate the due date, enter the date when the last menstrual perios began (the first day), then click calculate.', - ), - Divider( - //height: 2, - thickness: 2, - ), - Column( + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).pregnancyTitle, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( children: [ - Texts( - 'What was the date of the first day of the last period?', + Text( + TranslationBase.of(context).pregnancyDesc, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - bloodSugarDate = date; - dateFrom = date.add(Duration(days: 10)); + Divider( + //height: 2, + thickness: 1, + ), + Column( + children: [ + Text( + TranslationBase.of(context).pregnancyDateLabel, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + bloodSugarDate = date; + dateFrom = date.add(Duration(days: 10)); - dateTo = date.add(Duration(days: 20)); - conceivedDate = date.add(Duration(days: 14)); - deliveryDue = date.add(Duration(days: 280)); - firstTrimester = date.add(Duration(days: 85)); - secondTrimester = date.add(Duration(days: 190)); - thirdTrimester = date.add(Duration(days: 280)); - }); + dateTo = date.add(Duration(days: 20)); + conceivedDate = date.add(Duration(days: 14)); + deliveryDue = date.add(Duration(days: 280)); + firstTrimester = date.add(Duration(days: 85)); + secondTrimester = date.add(Duration(days: 190)); + thirdTrimester = date.add(Duration(days: 280)); + }); + }, + currentTime: DateTime.now(), + ); }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( + child: Container( + padding: EdgeInsets.all(12), + margin: EdgeInsets.only(top: 15.0), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Icon(Icons.date_range), - Texts('Date'), + Row( + children: [ + Icon(Icons.date_range), + Texts(TranslationBase.of(context).date), + ], + ), + Texts(getDate()), ], ), - Texts(getDate()), - ], + ), ), - ), + ], ), + ], ), - SizedBox( - height: 280.0, - ), - Container( - height: 50.0, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - onTap: () { - setState(() { - { - Navigator.push( - context, - FadePage( - page: DeliveryDueResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - firstTrimester: firstTrimester, - secondTrimester: secondTrimester, - thirdTrimester: thirdTrimester, - )), - ); - } - }); - }, - ), - ), - ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + { + Navigator.push( + context, + FadePage( + page: DeliveryDueResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + firstTrimester: firstTrimester, + secondTrimester: secondTrimester, + thirdTrimester: thirdTrimester, + )), + ); + } + }); + }, ), ), - ), + ], ), ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart index e03e5fce..f7431d1a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart @@ -1,5 +1,12 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -14,97 +21,183 @@ class DeliveryDueResult extends StatelessWidget { var firstTrimester; var secondTrimester; var thirdTrimester; - DeliveryDueResult( - {this.dateFrom, - this.dateTo, - this.conceivedDate, - this.deliveryDue, - this.firstTrimester, - this.secondTrimester, - this.thirdTrimester}); + + DeliveryDueResult({this.dateFrom, this.dateTo, this.conceivedDate, this.deliveryDue, this.firstTrimester, this.secondTrimester, this.thirdTrimester}); + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Delivery Due Date', - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 12.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - 'The next ovulation period is estimated to be:', - fontWeight: FontWeight.w400, - ), - Texts( - 'From:', - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateFrom), - fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - 'To:', - fontWeight: FontWeight.w400, - ), - Texts(DateFormat.yMMMEd().format(dateTo), - fontWeight: FontWeight.w800, fontSize: 21.0, color: Color(0xffC5272D)), - Texts( - 'You have conceived on:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'First Trimester Ends (12 weeks):', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(firstTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'Second Trimester Ends (27 weeks):', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(secondTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'Third Trimester, Estimated Due Date (40 weeks):', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(thirdTrimester), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: Button( - label: 'See List Of Doctors', - onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); - }, - ), - ), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).pregnancyTitle, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 21.0, vertical: 21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text( + TranslationBase.of(context).pregnancyTitle, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).firstTri, DateFormat.yMMMEd().format(firstTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).secondTri, DateFormat.yMMMEd().format(secondTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).thirdTri, DateFormat.yMMMEd().format(thirdTrimester)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).seeDoctorsList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 6).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart index 4a24ecc2..ba906ca4 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart @@ -69,26 +69,14 @@ class DoctorList extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (doctor.doctorTitle != null) - Text(doctor.doctorTitle + " " + doctor.name, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), + Text(doctor.doctorTitle + " " + doctor.name, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.clinicName != null ? doctor.clinicName : "", - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), + child: Text(doctor.clinicName != null ? doctor.clinicName : "", style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.projectName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), + child: Text(doctor.projectName, style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index d9d238e8..a594846e 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -1,10 +1,11 @@ -import 'package:diplomaticquarterapp/widgets/buttons/button.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/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 'dart:math'; +import 'package:flutter/services.dart'; import 'ideal_body_result_page.dart'; @@ -24,69 +25,44 @@ class _IdealBodyState extends State { Color lbCard = inactiveCardColor; Color cmCard = activeCardColor; Color ftCard = inactiveCardColor; - int age = 0; - int height = 0; + + // int age = 0; + // int height = 0; double heightInches; double minRange; double maxRange; double overWeightBy; int weight = 0; double idealWeight = 0; - String dropdownValue = 'Medium(fingers touch)'; + String dropdownValue = null; double calories = 0; String textResult = ''; double maxIdealWeight; double heightFeet; - void updateColorHeight(int type) { - //MG/DLT card - if (type == 1) { - if (cmCard == inactiveCardColor) { - cmCard = activeCardColor; - ftCard = inactiveCardColor; - } else { - cmCard = inactiveCardColor; - } - } - if (type == 2) { - if (ftCard == inactiveCardColor) { - ftCard = activeCardColor; - cmCard = inactiveCardColor; - } else { - ftCard = inactiveCardColor; - } - } - } + final GlobalKey clinicDropdownKey = GlobalKey(); + bool _isHeightCM = true; + bool _isWeightKG = true; + double _heightValue = 0; + double _weightValue = 0; + + TextEditingController _heightController = new TextEditingController(); + TextEditingController _weightController = TextEditingController(); + + List _heightPopupList = List(); + List _weightPopupList = List(); + - void updateColorWeight(int type) { - //MG/DLT card - if (type == 1) { - if (kgCard == inactiveCardColor) { - kgCard = activeCardColor; - lbCard = inactiveCardColor; - } else { - kgCard = inactiveCardColor; - } - } - if (type == 2) { - if (lbCard == inactiveCardColor) { - lbCard = activeCardColor; - kgCard = inactiveCardColor; - } else { - lbCard = inactiveCardColor; - } - } - } void calculateIdealWeight() { - heightInches = height * .39370078740157477; + heightInches = int.parse(_heightController.text) * .39370078740157477; heightFeet = heightInches / 12; idealWeight = (50 + 2.3 * (heightInches - 60)); - if (dropdownValue == 'Small(fingers overlap)') { + if (dropdownValue == TranslationBase.of(context).smallFinger) { idealWeight = idealWeight - 10; - } else if (dropdownValue == 'Medium(fingers touch)') { + } else if (dropdownValue == TranslationBase.of(context).mediumFinger) { idealWeight = idealWeight; - } else if (dropdownValue == 'Large(fingers don\'n touch)') { + } else if (dropdownValue == TranslationBase.of(context).largeFinger) { idealWeight = idealWeight + 10; } @@ -99,9 +75,17 @@ class _IdealBodyState extends State { @override Widget build(BuildContext context) { + if(dropdownValue==null) + dropdownValue=TranslationBase.of(context).mediumFinger; + _weightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; + _heightPopupList = [PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; + return AppScaffold( isShowAppBar: true, - appBarTitle: 'Ideal Body Weight', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).idealBody, showHomeAppBarIcon: false, appBarIcons: [ Padding( @@ -112,458 +96,418 @@ class _IdealBodyState extends State { ), ) ], - body: Padding( - padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0), - child: SingleChildScrollView( - child: Container( - height: 800.0, - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Texts( - 'Calculates the ideal body weight based on height, Weight, and Body Size', - ), - ), - Divider( - thickness: 2.0, - ), - SizedBox( - height: 5.0, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21), + child: Column( children: [ - Texts( - 'Height', - ), - Row( - children: [ - Expanded( - child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: - BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(height.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (height < 250) - height++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (height > 0) height--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: height.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - height = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), - ), - ), - ], + Text( + TranslationBase.of(context).idealBodyWeight, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), ), - Texts('Select Unit'), SizedBox( height: 5.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(1); - isHeightCm = true; - }); + SizedBox( + height: 12.0, + ), + _commonInputAndUnitRow( + TranslationBase.of(context).height, + _heightController, + 1, + 270, + _heightValue, + (text) { + _heightController.text = text; }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cmCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('CM')), - ), - ), + (value) { + _heightValue = value; + }, + _isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft, + (value) { + if (_isHeightCM != value) { + setState(() { + _isHeightCM = value; + }); + } + }, + _heightPopupList, ), - GestureDetector( - onTap: () { - setState(() { - updateColorHeight(2); - isHeightCm = false; - }); + SizedBox( + height: 12.0, + ), + _commonInputAndUnitRow( + TranslationBase.of(context).weight, + _weightController, + 1, + 270, + _weightValue, + (text) { + _weightController.text = text; }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: ftCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('Ft')), - ), - ), + (value) { + _weightValue = value; + }, + _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).pound, + (value) { + if (_isWeightKG != value) { + setState(() { + _isWeightKG = value; + }); + } + }, + _weightPopupList, ), - ], - ), - SizedBox( - height: 45.0, - ), - Divider( - thickness: 2.0, - ), - Texts( - 'Weight', - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( + SizedBox( + height: 12.0, + ), + InkWell( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, child: Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - ), + // width: double.infinity, + // decoration: containerRadius(Colors.white, 12), + // padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), child: Row( children: [ - Padding( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: - BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bodyFrameSize, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, ), ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(weight.toString()), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: dropdownValue, + icon: Icon(Icons.arrow_downward), key: clinicDropdownKey, + iconSize: 0, + elevation: 16, + isExpanded: true, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + TranslationBase.of(context).smallFinger, + TranslationBase.of(context).mediumFinger, + TranslationBase.of(context).largeFinger, + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight < 250) - weight++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (weight > 0) weight--; - }); - }, - ), - ], - ), - ), - ], + ), ), - ), - ), - ), - Expanded( - child: Slider( - value: weight.toDouble(), - min: 0, - max: 250, - onChanged: (double newValue) { - setState(() { - weight = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), + ], ), ), + Icon(Icons.keyboard_arrow_down), ], ), - ), + ).withBorderedContainer, ), ], ), - Texts('Select Unit'), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(1); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: kgCard, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Center(child: Texts('KG')), - ), - ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColorWeight(2); - }); - }, - child: Container( - height: 55.0, - width: 150.0, - decoration: BoxDecoration( - color: lbCard, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Center(child: Texts('LB')), - ), - ), - ), - ], - ), - SizedBox( - height: 45.0, - ), - Divider( - thickness: 2.0, + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + setState(() { + // calculateBmr(); + // calculateCalories(); + calculateIdealWeight(); + + print(idealWeight); + print(minRange); + print(maxRange); + print(overWeightBy); + print(textResult); + //print(overWeightBy); + { + Navigator.push( + context, + FadePage( + page: IdealBodyResult( + idealBodyWeight: idealWeight, + minRange: minRange, + mixRange: maxRange, + overWeightBy: overWeightBy, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ); + } + + void openDropdown(GlobalKey key) { + GestureDetector detector; + void searchForGestureDetector(BuildContext element) { + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget; + return false; + } else { + searchForGestureDetector(element); + } + + return true; + }); + } + + searchForGestureDetector(key.currentContext); + assert(detector != null); + + detector.onTap(); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - SizedBox( - height: 5.0, + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Texts('Body Frame Size'), - Container( - width: 300, - child: DropdownButton( - value: dropdownValue, - icon: Icon(Icons.arrow_downward), - iconSize: 24, - elevation: 16, - style: TextStyle(color: Colors.black87), - underline: Container( - height: 2, - color: Colors.black54, - ), - onChanged: (String newValue) { - setState(() { - dropdownValue = newValue; - }); - }, - items: [ - 'Small(fingers overlap)', - 'Medium(fingers touch)', - 'Large(fingers don\'n touch)', - ].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - SizedBox( - height: 30.0, - ), - Container( - height: 50.0, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - onTap: () { - setState(() { - // calculateBmr(); - // calculateCalories(); - calculateIdealWeight(); + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } - print(idealWeight); - //print(overWeightBy); - { - Navigator.push( - context, - FadePage( - page: IdealBodyResult( - idealBodyWeight: idealWeight, - minRange: minRange, - mixRange: maxRange, - overWeightBy: overWeightBy, - textResult: textResult, - )), - ); - } - }); - }, - ), - ), - ], + Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, + Function(bool) onUnitTap, _list) { + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, ), - ], - ), + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; + } +} + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], ), ); } } + + diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index 24fc768f..a29d4bf0 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -1,10 +1,16 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'dart:math'; class IdealBodyResult extends StatelessWidget { final double idealBodyWeight; @@ -14,154 +20,183 @@ class IdealBodyResult extends StatelessWidget { final String textResult; IdealBodyResult({this.idealBodyWeight, this.minRange, this.mixRange, this.overWeightBy, this.textResult}); + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Ideal Body Weight', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).idealBody, body: Column( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts( - 'Ideal weight range is', - fontSize: 23.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Row( - children: [ - Texts( - minRange.toStringAsFixed(1), - fontSize: 30.0, - ), - Padding( - padding: EdgeInsets.only(top: 8.0, left: 4.0), - child: Text( - 'Kg', - style: TextStyle(color: Colors.red), - ), - ), - ], - ), - Icon( - Icons.arrow_forward, - color: Colors.red, - size: 55.0, - ), - Row( - children: [ - Texts( - mixRange.toStringAsFixed(1), - fontSize: 30.0, - ), - Padding( - padding: EdgeInsets.only(top: 8.0, left: 4.0), - child: Text( - 'Kg', - style: TextStyle(color: Colors.red), - ), + + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).idealWeightRange, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.34, + fontWeight: FontWeight.bold, ), - ], - ), - ], - ), - overWeightBy >= 0 && overWeightBy <= 10 - ? Column( + ), + mHeight(12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Texts( - 'Congratulations! The current weight is\n perfect and considered healthy', - fontSize: 20.0, + Row( + children: [ + Texts( + minRange.toStringAsFixed(1), + fontSize: 30.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, left: 4.0), + child: Text( + " "+TranslationBase.of(context).kg+" ", + style: TextStyle(color: Colors.red), + ), + ), + ], ), - ], - ) - : overWeightBy > 10 && overWeightBy < 17 - ? Column( + Icon( + Icons.arrow_forward, + color: Colors.red, + size: 55.0, + ), + Row( children: [ - Texts('This means that the weight is a little bit more than ideal weight by'), - Texts(overWeightBy.toStringAsFixed(1)), Texts( - 'May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + mixRange.toStringAsFixed(1), + fontSize: 30.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, left: 4.0), + child: Text( + " "+TranslationBase.of(context).kg+" ", + style: TextStyle(color: Colors.red), + ), + ), ], - ) - : overWeightBy >= 18 - ? Container( - height: 250.0, - width: 350, - child: Column( + ), + ], + ), + mHeight(12), + overWeightBy >= 0 && overWeightBy <= 10 + ? Column( + children: [ + Texts( + TranslationBase.of(context).currentWeightPerfect, + fontSize: 20.0, + ), + ], + ) + : overWeightBy > 10 && overWeightBy < 17 + ? Column( children: [ - Texts( - 'Means that you suffer from excessive\n obesity by', - ), - SizedBox( - height: 55.0, - ), - Texts( - overWeightBy.toStringAsFixed(1), - fontSize: 40.0, - ), - SizedBox( - height: 25.0, - ), - Texts( - 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + Texts(TranslationBase.of(context).littleBitWeightMore), + Texts(overWeightBy.toStringAsFixed(1)), + Texts(TranslationBase.of(context).consultWithDoctor), ], - ), - ) - : overWeightBy < -18 - ? Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - 'Under Weight', - fontSize: 18.0, - ), - ), - SizedBox( - height: 55.0, - ), - Texts( - overWeightBy.toStringAsFixed(1), - fontSize: 20.0, + ) + : overWeightBy >= 18 + ? Container( + + child: Column( + children: [ + Texts( + TranslationBase.of(context).excessiveObesity, + ), + SizedBox( + height: 12.0, + ), + Text( + overWeightBy.toStringAsFixed(1), + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + letterSpacing: -1.34, + ), + ), + SizedBox( + height: 12.0, + ), + Texts(TranslationBase.of(context).mayWish), + ], ), - ], - ) - : Container( - height: 250.0, - width: 350.0, - child: Column( - children: [ - Texts( - 'under wheight', - fontSize: 20.0, - ), - SizedBox( - height: 55.0, - ), - Texts( - overWeightBy.toStringAsFixed(1), - fontSize: 20.0, - ), - SizedBox( - height: 25.0, + ) + : overWeightBy < -18 + ? Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).underWeight, + fontSize: 18.0, + ), + ), + SizedBox( + height: 12.0, + ), + Text( + overWeightBy.toStringAsFixed(1), + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + letterSpacing: -1.34, + ), + ), + ], + ) + : Container( + + child: Column( + children: [ + Text( + TranslationBase.of(context).underWeight, + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + letterSpacing: -1.34, + ), + ), + SizedBox( + height: 12.0, + ), + Text( + overWeightBy.toStringAsFixed(1), + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + letterSpacing: -1.34, + ), + ), + SizedBox( + height: 12.0, + ), + Texts(TranslationBase.of(context).mayWish), + ], + ), ), - Texts( - 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), - ], - ), - ), + ], + ).withBorderedContainer, + ), Container( - width: 350, - child: Button( - label: 'See List Of Doctors', + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), @@ -169,4 +204,73 @@ class IdealBodyResult extends StatelessWidget { ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 4).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index a6708855..69894df3 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -20,8 +22,9 @@ class _OvulationPeriodState extends State { DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); DateTime selectedDateTime = DateTime.now(); - int cycleLength = 0; - int lutealPhaseLength = 0; + + // int cycleLength = 0; + // int lutealPhaseLength = 0; String selectedDate; var dateFrom = DateTime.now(); var babyAgeWeeks; @@ -33,6 +36,9 @@ class _OvulationPeriodState extends State { var newFormat = DateFormat("yy-MM-dd"); String updatedDt; + TextEditingController cycleLengthController = new TextEditingController(); + TextEditingController lutelLengthController = new TextEditingController(); + String getTime() { return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; } @@ -41,10 +47,6 @@ class _OvulationPeriodState extends State { return "${DateUtil.getMonth(selectedDateTime.month)} ${selectedDateTime.day}, ${selectedDateTime.year}"; } - // void calculate() {} - // - // void calculateFertility(DateTime selectedDate) {const diff = Date.} - calculateBabyInformation() { setState(() { bloodSugarDate = selectedDateTime; @@ -55,10 +57,8 @@ class _OvulationPeriodState extends State { deliveryDue = selectedDateTime.add(Duration(days: 280)); // babyAge = Jiffy([DateTime.now()]).diff(Jiffy([date]), Units.WEEK); - babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) - .diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.WEEK); - babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]) - .diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.DAY); + babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.WEEK); + babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.DAY); }); } @@ -66,287 +66,180 @@ class _OvulationPeriodState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Ovulation Period', - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 700.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Calculates Ovulation Period'), - SizedBox( - height: 12.0, - ), - Divider( - //height: 2, - thickness: 2, - ), - SizedBox( - height: 12.0, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - print('confirm $date'); - setState(() { - selectedDateTime = date; - }); - }, - currentTime: DateTime.now(), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts('Date'), - Texts(getDate()), - ], - ), - ), - ), - SizedBox( - height: 5.0, - ), - Texts( - 'Average Cycle Length (usually 28 days):', - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).ovulation, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + Text( + TranslationBase.of(context).ovulationDesc, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.54, + color: Colors.black, + fontWeight: FontWeight.w600, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(cycleLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength < 45) cycleLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (cycleLength > 0) cycleLength--; - }); - }, - ), - ], - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Slider( - value: cycleLength.toDouble(), - min: 0, - max: 45, - onChanged: (double newValue) { - setState(() { - cycleLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], + ), + SizedBox( + height: 12.0, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + print('confirm $date'); + setState(() { + selectedDateTime = date; + }); + }, + currentTime: DateTime.now(), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).cycleLabel, "0", cycleLengthController), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).lutealLabel, "0", lutelLengthController), ], ), - Texts( - 'Average Luteal Phase Length (usually 14 days):', - fontWeight: FontWeight.w400, - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Container( - width: 340.0, - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).calculate, + color: CustomColors.accentColor, + onTap: () { + calculateBabyInformation(); + Navigator.push( + context, + FadePage( + page: OvulationResult( + conceivedDate: conceivedDate, + dateFrom: dateFrom, + dateTo: dateTo, + deliveryDue: deliveryDue, + babyAge: babyAgeWeeks, + babyAgeDays: babyAgeDays, + ), + ), + ); + }, + ), + ), + ], + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, ), - child: Row( - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0), - child: Center( - child: Container( - width: 60.0, - foregroundDecoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - border: Border.all( - color: Colors.blueGrey, - width: 2.0, - ), - ), - child: Row( - children: [ - Expanded( - child: Center( - child: Text(lutealPhaseLength.toString()), - ), - ), - Container( - height: 38.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0.5, - ), - ), - ), - child: InkWell( - child: Icon( - Icons.arrow_drop_up, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength < 15) lutealPhaseLength++; - }); - }, - ), - ), - InkWell( - child: Icon( - Icons.arrow_drop_down, - size: 18.0, - ), - onTap: () { - setState(() { - if (lutealPhaseLength > 0) lutealPhaseLength--; - }); - }, - ), - ], - ), - ), - ], - ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), ), - ), - Expanded( - child: Slider( - value: lutealPhaseLength.toDouble(), - min: 0, - max: 15, - onChanged: (double newValue) { - setState(() { - lutealPhaseLength = newValue.round(); - }); - }, - activeColor: Color(0xffC5272D), - inactiveColor: Color(0xffF3C5C6), - ), - ), - ], - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), - SizedBox( - height: 220.0, - ), - Container( - height: 50.0, - width: 350.0, - child: SecondaryButton( - label: 'CALCULATE', - onTap: () { - calculateBabyInformation(); - Navigator.push( - context, - FadePage( - page: OvulationResult( - conceivedDate: conceivedDate, - dateFrom: dateFrom, - dateTo: dateTo, - deliveryDue: deliveryDue, - babyAge: babyAgeWeeks, - babyAgeDays: babyAgeDays, - )), - ); - }, ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart index 53ccb664..67ec7dea 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -1,5 +1,12 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -22,92 +29,185 @@ class OvulationResult extends StatelessWidget { this.babyAge, this.babyAgeDays, }); + //var newFormat = DateFormat("yy-MM-dd"); @override Widget build(BuildContext context) { return AppScaffold( - isShowAppBar: true, - appBarTitle: 'Ovulation Period', - body: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 15.0), - child: SingleChildScrollView( - child: Container( - height: 750.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - 'The next ovulation period is estimated to be:', - fontWeight: FontWeight.w400, - ), - Texts( - 'From:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateFrom), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'To:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(dateTo), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'Useful Information:', - color: Color(0xffC5272D), - ), - Texts( - 'You have conceived on:', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(conceivedDate), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The baby\'s age right now:', - fontWeight: FontWeight.w400, - ), - Texts( - babyAge <= 0 ? "baby age is not available" : babyAge.toString() + " Weeks," + "3", - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Texts( - 'The delivery due date is estimated to be on the: ', - fontWeight: FontWeight.w400, - ), - Texts( - DateFormat.yMMMEd().format(deliveryDue), - fontWeight: FontWeight.w800, - fontSize: 21.0, - ), - Container( - width: 350, - child: Button( - label: 'See List Of Doctors', - onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); - }, - ), - ), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + appBarTitle: TranslationBase.of(context).ovulation, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).ovulation, + style: TextStyle( + fontSize: 19, + letterSpacing: -1.14, + fontWeight: FontWeight.w600, + ), + ), + mHeight(20), + Text( + TranslationBase.of(context).ovulationPeriod, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: CustomColors.textColor, + ), + ), + mHeight(20), + showItem(TranslationBase.of(context).from, DateFormat.yMMMEd().format(dateFrom), titleColor: CustomColors.accentColor), + mHeight(12), + showItem(TranslationBase.of(context).to, DateFormat.yMMMEd().format(dateTo), titleColor: CustomColors.accentColor), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + Text( + TranslationBase.of(context).useFullInfo, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: CustomColors.accentColor, + fontWeight: FontWeight.w500, + ), + ), + mHeight(12), + showItem(TranslationBase.of(context).conceive, DateFormat.yMMMEd().format(conceivedDate)), + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), + showItem(TranslationBase.of(context).babyAge, babyAge <= 0 ? TranslationBase.of(context).babyAgeAvail : babyAge.toString() + TranslationBase.of(context).week), + + mHeight(12), + mDivider(CustomColors.devider), + mHeight(12), showItem(TranslationBase.of(context).deliveryDue, DateFormat.yMMMEd().format(deliveryDue)), + ], + ).withBorderedContainer, + ), ), ), - ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + color: Colors.white, + child: SecondaryButton( + label: TranslationBase.of(context).viewDocList, + color: CustomColors.accentColor, + onTap: () { + getDoctorsList(context); + }, + ), + ), + ], + ), + ); + } + + Widget showItem(String title, String value, {Color titleColor}) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: titleColor ?? Colors.black, + fontWeight: FontWeight.w500, + // fontWeight: FontWeight.w600, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 18, + letterSpacing: -1.08, + fontWeight: FontWeight.w600, + ), + ), + ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 6).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); } diff --git a/lib/pages/AlHabibMedicalService/health_converter.dart b/lib/pages/AlHabibMedicalService/health_converter.dart index 5ae80183..c4ad7760 100644 --- a/lib/pages/AlHabibMedicalService/health_converter.dart +++ b/lib/pages/AlHabibMedicalService/health_converter.dart @@ -16,82 +16,76 @@ class HealthConverter extends StatefulWidget { class _HealthConverterState extends State { @override Widget build(BuildContext context) { + List myMedicalList = myOptionsList(context); + return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).converters, body: Column( children: [ - Container( - width: double.infinity, - height: 30, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage(page: BloodSugar()), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).bloodSugar, - imagePath: 'blood_sugar_icon.png', - subTitle: TranslationBase.of(context).sugar, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: BloodCholesterol(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).bloodCholesterol, - imagePath: 'blood_cholesterol_icon.png', - subTitle: TranslationBase.of(context).cholesterol, - ), - ), - ), - ], + Padding( + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; + }, + ), ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: Triglycerides(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).triglycerides, - imagePath: 'triglycerides_blood_icon.png', - subTitle: TranslationBase.of(context).fatInBlood, - ), - ), - ), - Expanded( - flex: 1, - child: Container(), - ), - ], - ) ], ), ); } + + List myOptionsList(BuildContext context) { + List medical = List(); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: BloodSugar()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).bloodSugar, + imagePath: 'sugar-blood-level.svg', + subTitle: TranslationBase.of(context).sugar, + isPngImage: false, + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: BloodCholesterol()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).bloodCholesterol, + imagePath: 'cholesterol.svg', + subTitle: TranslationBase.of(context).cholesterol, + isPngImage: false, + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: Triglycerides()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).triglycerides, + imagePath: 'fat.svg', + subTitle: TranslationBase.of(context).fatInBlood, + isPngImage: false, + ), + )); + return medical; + } } diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index ac31b98c..af93afa4 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -1,14 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; - +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xff70777A); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class BloodCholesterol extends StatefulWidget { @override @@ -20,7 +19,6 @@ class _BloodCholesterolState extends State { Color cardMMOLColor = inactiveCardColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -53,225 +51,246 @@ class _BloodCholesterolState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 38.67; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodCholesterol, + appBarTitle: TranslationBase.of(context).cholesTitle, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 350.0, - child: Text( - TranslationBase.of(context).convertCholesterolStatement, - //textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0), - ), - ), - SizedBox( - height: 15.0, - ), - Container( - color: Colors.white, - height: 120.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - //crossAxisAlignment: CrossAxisAlignment.end, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).cholesTitle, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertCholesterolStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 13.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + inputValue = double.parse(textController.text); + inputValue = inputValue / conversionConst; + unit = 'mmol/l'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ], + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('MG/DLt to MMOL/L', + textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + ), ), ), SizedBox( - height: 9.0, + width: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - inputValue = - double.parse(textController.text); - inputValue = inputValue / conversionConst; - unit = 'mmol/l'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Texts('MG/DLt TO \nMMOL/L'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - inputValue = - double.parse(textController.text); - inputValue = inputValue * conversionConst; - unit = 'mg/dlt'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Texts('MG/DLt TO\n MMOL/L'), - ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('MMOL/L to MG/DLt', + textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), ), ), - ], + ), ), ], ), - ), - ), - SizedBox( - height: 25.0, + ], ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController), + SizedBox( + height: 12.0, + ), + Visibility( + visible: _visible, + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), + ), + SizedBox( + height: 15.0, + ), + ], + ), + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate, + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateBloodCholesterol(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ":"), - Row( - children: [ - Text( - inputValue.toStringAsFixed(3).toString(), - style: TextStyle(fontSize: 35.0), - ), - Padding( - padding: EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - ], - ), - ], - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - Flexible( - child: Container( - height: 60.0, - width: 150.0, - child: SecondaryButton( - label: TranslationBase.of(context).calculate, - onTap: () { - setState(() { - _visible == false - ? _visible = !_visible - : _visible = _visible; - calculateBloodCholesterol(); - }); - }, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index e9369b82..4604c3df 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -1,16 +1,15 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/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/services.dart'; -const activeCardColor = Color(0xff515a5d); -const activeTextColor = Color(0xffFAFAFA); -const inactiveCardColor = Color(0xffFAFAFA); -const inactiveTextColor = Color(0xff60686B); +const activeCardColor = CustomColors.green; +const activeTextColor = CustomColors.black; +const inactiveCardColor = CustomColors.white; +const inactiveTextColor = CustomColors.black; class BloodSugar extends StatefulWidget { @override @@ -26,7 +25,6 @@ class _BloodSugarState extends State { Color textMMOLColor = inactiveTextColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -60,10 +58,12 @@ class _BloodSugarState extends State { inputValue = inputValue * 18; unit = 'mg/dlt'; } + setState(() {}); } bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0; @@ -81,6 +81,8 @@ class _BloodSugarState extends State { return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).bloodSugarConversion, body: Container( padding: const EdgeInsets.all(16.0), @@ -89,229 +91,222 @@ class _BloodSugarState extends State { Expanded( child: SingleChildScrollView( child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).bloodSugar, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.symmetric(horizontal: 8), - child: Text( - TranslationBase.of(context).convertBloodSugarStatement, - //textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0), - ), + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertBloodSugarStatement, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), ), SizedBox( height: 12.0, ), Container( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 16.0, horizontal: 8), - child: Column( - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, - ) - ], - ), - ), - SizedBox( - height: 8.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 16.0, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColor(1); - calculateBloodSugar(); - }); - }, - child: Container( - height: 65.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, - 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: - BorderRadius.circular(3.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 8.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Texts( - 'MG/DLt TO \nMMOL/L', - color: textMGColor, + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MG/DLt to MMOL/L', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), ), - SizedBox( - width: 12.0, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColor(2); - calculateBloodSugar(); - }); - }, - child: Container( - height: 65.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: - BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, - 3), // changes position of shadow - ), - ], + ), + SizedBox( + width: 12.0, + ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Texts( - 'MMOL/L TO MG/DLt ', - color: textMMOLColor, + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MMOL/L to MG/DLt', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), ), - SizedBox( - width: 16.0, - ), - ], - ), - ], - ), + ), + ], + ), + ], ), ), SizedBox( - height: 24.0, - ), - Container( - height: 65.0, - padding: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, - ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], - keyboardType: TextInputType.number, - decoration: InputDecoration( - labelText: - TranslationBase.of(context).enterReadingValue, - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - disabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - border: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white)), - labelStyle: TextStyle( - color: Colors.black87, - ), - ), - ), + height: 12.0, ), + inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController), SizedBox( - height: 24.0, + height: 12.0, ), Visibility( visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ": "), - Row( - children: [ - Text( - inputValue.toStringAsFixed(2), - style: TextStyle(fontSize: 35.0), - ), - Padding( - padding: - EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - ], - ), - ), - ), + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), ), ], ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16), - child: SecondaryButton( - label: TranslationBase.of(context).calculate, - color: Color(0XFF515A5D), - onTap: () { - setState(() { - _visible == false - ? _visible = !_visible - : _visible = _visible; - calculateBloodSugar(); - }); - }, + ], + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate, + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateBloodSugar(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index 7c821055..e441d935 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -1,16 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; - import 'package:flutter/services.dart'; -const activeCardColor = Color(0xff70777A); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class Triglycerides extends StatefulWidget { @override @@ -21,6 +18,7 @@ class _TriglyceridesState extends State { Color cardMGColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor; int type; + void updateColor(type) { //MG/DLT card if (type == 1) { @@ -55,224 +53,250 @@ class _TriglyceridesState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 88.57; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).triglycerides, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 350.0, - child: Text( - TranslationBase.of(context).triglyceridesConvertStatement, - //textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0), - ), - ), - SizedBox( - height: 15.0, - ), - Container( - color: Colors.white, - height: 120.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - //crossAxisAlignment: CrossAxisAlignment.end, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).triglycerides, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: + Text(TranslationBase.of(context).triglyceridesConvertStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 12.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts(TranslationBase.of(context).convertFrom) - ], + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + inputValue = double.parse(textController.text); + inputValue = inputValue / conversionConst; + unit = 'mmol/l'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MG/DLt to MMOL/L', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), + ), + ), + ), ), ), SizedBox( - height: 9.0, + width: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - inputValue = - double.parse(textController.text); - inputValue = inputValue / conversionConst; - unit = 'mmol/l'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Texts('MG/DLt TO \nMMOL/L'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - inputValue = - double.parse(textController.text); - inputValue = inputValue * conversionConst; - unit = 'mg/dlt'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Texts('MG/DLt TO\n MMOL/L'), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MMOL/L to MG/DLt', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), - ], + ), ), ], ), - ), - ), - SizedBox( - height: 25.0, + ], ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).enterReadingValue, "0.0", textController), + SizedBox( + height: 12.0, + ), + Visibility( + visible: _visible, + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), + ), + ], + ), + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate.toUpperCase(), + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateTriglycerides(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ":"), - Row( - children: [ - Text( - inputValue.toStringAsFixed(2), - style: TextStyle(fontSize: 35.0), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - Padding( - padding: EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - ], - ), - ), - ), - ), - SizedBox( - height: 10.0, - ), - Flexible( - child: Container( - height: 60.0, - width: 250.0, - child: SecondaryButton( - label: - TranslationBase.of(context).calculate.toUpperCase(), - onTap: () { - setState(() { - _visible == false - ? _visible = !_visible - : _visible = _visible; - calculateTriglycerides(); - }); - }, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/my_web_view.dart b/lib/pages/AlHabibMedicalService/my_web_view.dart index 9e8defc1..4b03c7dd 100644 --- a/lib/pages/AlHabibMedicalService/my_web_view.dart +++ b/lib/pages/AlHabibMedicalService/my_web_view.dart @@ -1,7 +1,7 @@ import 'dart:async'; + import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; - import 'package:webview_flutter/webview_flutter.dart'; class MyWebView extends StatelessWidget { @@ -22,6 +22,8 @@ class MyWebView extends StatelessWidget { isShowAppBar: true, appBarTitle: title, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: WebView( initialUrl: selectedUrl, javascriptMode: JavascriptMode.unrestricted, diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart index f3620917..ac63011c 100644 --- a/lib/pages/AlHabibMedicalService/parking_page.dart +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -1,16 +1,16 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/qr_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; -import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:provider/provider.dart'; + import '../../d_q_icons_icons.dart'; class ParkingPage extends StatelessWidget { @@ -21,18 +21,18 @@ class ParkingPage extends StatelessWidget { onModelReady: (model) => model.getIsSaveParking(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).parking, description: TranslationBase.of(context).parkingDescription, - imagesInfo: [ - ImagesInfo(imageAr: 'assets/images/bc_parking.png', imageEn: 'assets/images/bc_parking.png', isAsset: true) - ], + imagesInfo: [ImagesInfo(imageAr: 'assets/images/bc_parking.png', imageEn: 'assets/images/bc_parking.png', isAsset: true)], body: SingleChildScrollView( padding: EdgeInsets.all(12), child: !model.isSavePark ? Column( children: [ Texts( - TranslationBase.of(context).parkingTitle, + TranslationBase.of(context).parkingDescription, fontWeight: FontWeight.normal, fontSize: 15, ), @@ -61,10 +61,7 @@ class ParkingPage extends StatelessWidget { child: Container( height: 150, padding: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, @@ -86,16 +83,13 @@ class ParkingPage extends StatelessWidget { Container( padding: EdgeInsets.all(8), width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), height: 70, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).showMyPark), - Texts(projectViewModel.isArabic - ? model.qrParkingModel.floorDescriptionN - : model.qrParkingModel.floorDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel.floorDescriptionN : model.qrParkingModel.floorDescription), ], ), ), @@ -103,8 +97,7 @@ class ParkingPage extends StatelessWidget { height: 15, ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), padding: EdgeInsets.all(8), width: double.infinity, height: 70, @@ -112,9 +105,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).gate), - Texts(projectViewModel.isArabic - ? model.qrParkingModel.gateDescriptionN - : model.qrParkingModel.gateDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel.gateDescriptionN : model.qrParkingModel.gateDescription), ], ), ), @@ -122,8 +113,7 @@ class ParkingPage extends StatelessWidget { height: 15, ), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), padding: EdgeInsets.all(8), width: double.infinity, height: 70, @@ -131,9 +121,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).building), - Texts(projectViewModel.isArabic - ? model.qrParkingModel.buildingDescriptionN - : model.qrParkingModel.buildingDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel.buildingDescriptionN : model.qrParkingModel.buildingDescription), ], ), ), @@ -142,17 +130,14 @@ class ParkingPage extends StatelessWidget { ), Container( padding: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white, shape: BoxShape.rectangle), width: double.infinity, height: 70, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).branch), - Texts(projectViewModel.isArabic - ? model.qrParkingModel.branchDescriptionN - : model.qrParkingModel.branchDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel.branchDescriptionN : model.qrParkingModel.branchDescription), ], ), ), @@ -164,19 +149,14 @@ class ParkingPage extends StatelessWidget { ), bottomSheet: !model.isSavePark ? Container( + color: Theme.of(context).scaffoldBackgroundColor, height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, child: Column( children: [ Container( width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - model.readQr(); - }, - label: TranslationBase.of(context).readBarcode, - loading: model.state == ViewState.BusyLocal, - textColor: Theme.of(context).backgroundColor), + child: DefaultButton(TranslationBase.of(context).readBarcode, () => {model.readQr()}), ), ], ), @@ -189,16 +169,14 @@ class ParkingPage extends StatelessWidget { children: [ Container( width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - MapsLauncher.launchCoordinates( - model.qrParkingModel.latitude, - model.qrParkingModel.longitude, - ); - }, - disabled: model.qrParkingModel.longitude == 0, - label: TranslationBase.of(context).showMyPark, - textColor: Theme.of(context).backgroundColor), + child: DefaultButton( + TranslationBase.of(context).showMyPark, + () => { + MapsLauncher.launchCoordinates( + model.qrParkingModel.latitude, + model.qrParkingModel.longitude, + ), + }), ), SizedBox( height: 12, diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index fab4eb6d..67f27337 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -1,17 +1,17 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:provider/provider.dart'; + import 'health_calculator/bmi_calculator/bmi_calculator.dart'; import 'health_calculator/bmr_calculator/bmr_calculator.dart'; -import 'health_calculator/calorie_calculator/calorie_calculator.dart'; import 'health_calculator/delivery_due/delivery_due.dart'; import 'health_calculator/ideal_body/ideal_body.dart'; @@ -22,6 +22,7 @@ class HealthCalculators extends StatefulWidget { class _HealthCalculatorsState extends State with SingleTickerProviderStateMixin { TabController _tabController; + void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); @@ -34,249 +35,219 @@ class _HealthCalculatorsState extends State with SingleTicker @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + List generalHealthList = getGeneralHealthList(context); + List womenHealthList = getWomenHealthList(context); + return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).calculators, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(70.0), - child: Stack( - children: [ - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 1.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 5.7, - ), - ), - color: Colors.white, - ), - child: Center( - child: TabBar( - controller: _tabController, - isScrollable: true, - indicatorWeight: 4.0, - indicatorColor: Colors.red, - labelColor: Theme.of(context).buttonColor, - labelPadding: EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), - unselectedLabelColor: Colors.grey, - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: Center( - child: Texts(TranslationBase.of(context).generalHealth), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: Center( - child: Texts(TranslationBase.of(context).womanHealth), - ), - ), - ], - ), - ), + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Text(TranslationBase.of(context).generalHealth), ), - ) + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Text(TranslationBase.of(context).womanHealth), + ), + ), ], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - Container( - child: Column( - children: [ - Container( - width: double.infinity, - height: 80, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage(page: BMICalculator()), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).bmi, - imagePath: 'bmi_health_calculator.png', - subTitle: TranslationBase.of(context).calcHealth, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: CalorieCalculator(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).calories, - imagePath: 'calories-calculator.png', - subTitle: TranslationBase.of(context).calcHealth, - ), - ), - ), - ], + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + controller: _tabController, + children: [ + Container( + // margin: EdgeInsets.all(20.0), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: generalHealthList.length, + itemBuilder: (BuildContext context, int index) { + return generalHealthList[index]; + }, ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: BmrCalculator(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).bmr, - imagePath: 'BMR_calculator.png', - subTitle: TranslationBase.of(context).calcHealth, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: IdealBody(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).idealBody, - imagePath: 'body_weight.png', - subTitle: TranslationBase.of(context).weight, - ), - ), - ), - ], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: BodyFat(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).bodyWord, - imagePath: 'body_fat.png', - subTitle: TranslationBase.of(context).fat, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: Carbs(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).carbohydrate, - imagePath: 'carb_protein.png', - subTitle: TranslationBase.of(context).proteinFat, - ), - ), - ), - ], - ), - ], - ), + ), + ], ), - Container( - child: Column( - children: [ - Container( - width: double.infinity, - height: 80, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage(page: OvulationPeriod()), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).ovulation, - imagePath: 'ovulation_period_icon.png', - subTitle: TranslationBase.of(context).period, - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: DeliveryDue(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).delivery, - imagePath: 'delivery_date_icon.png', - subTitle: TranslationBase.of(context).dueDate, - ), - ), - ), - ], + ), + Container( + // margin: EdgeInsets.all(20.0), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: womenHealthList.length, + itemBuilder: (BuildContext context, int index) { + return womenHealthList[index]; + }, ), - ], - ), + ), + ], ), - ], - ), - ) - ], - ), + ), + ], + ), + ), + ], ), ); } + + List getGeneralHealthList(BuildContext context) { + List medical = List(); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: BMICalculator()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).bmi, + imagePath: 'bmi.svg', + subTitle: TranslationBase.of(context).calcHealth, + + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: CalorieCalculator()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).calories, + imagePath: 'calories_calc.svg', + subTitle: TranslationBase.of(context).calcHealth, + + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: BmrCalculator()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).bmr, + imagePath: 'bmr_calc.svg', + subTitle: TranslationBase.of(context).calcHealth, + + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: IdealBody()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).idealBody, + imagePath: 'ideal_weight_calc.svg', + subTitle: TranslationBase.of(context).weight, + + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: BodyFat()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).bodyWord, + imagePath: 'bmr_calc.svg', + subTitle: TranslationBase.of(context).fat, + + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: Carbs()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).carbohydrate, + imagePath: 'carbs_proteitn_fat.svg', + subTitle: TranslationBase.of(context).proteinFat, + + ), + )); + + return medical; + } + + List getWomenHealthList(BuildContext context) { + List medical = List(); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: OvulationPeriod()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).ovulation, + imagePath: 'ovulation.svg', + subTitle: TranslationBase.of(context).period, + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: DeliveryDue()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).delivery, + imagePath: 'delivery.svg', + subTitle: TranslationBase.of(context).dueDate, + ), + )); + + return medical; + } } diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index f362c2bc..b61cd4fc 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,37 +1,25 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; - -//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.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/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; -import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectBloodDialog.dart'; -import 'dialogs/SelectGenderDialog.dart'; -import 'dialogs/SelectPatientFamilyDialog.dart'; -import 'dialogs/SelectPatientInfoDialog.dart'; - enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } enum Gender { Male, Female, NON } enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } @@ -42,23 +30,20 @@ class BloodDonationPage extends StatefulWidget { } class _BloodDonationPageState extends State { - TextEditingController _fileTextController = TextEditingController(); - TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - Gender gender = Gender.Male; //Gender.NON; - Blood blood = Blood.Aminus; //Blood.NON; - //HospitalsModel _selectedHospital; + CitiesModel _selectedHospital; + int _selectedHospitalIndex = 0; + int _selectedGenderIndex = 1; + int _selectedBloodTypeIndex = 0; + String _selectedBloodType = "O+"; + String amount = ""; String email; - PatientInfo _selectedPatientInfo; - AuthenticatedUser authenticatedUser; - GetAllSharedRecordsByStatusList selectedPatientFamily; - AdvanceModel advanceModel = AdvanceModel(); + List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; var checkedValue = false; List imagesInfo = List(); @@ -69,475 +54,326 @@ class _BloodDonationPageState extends State { imagesInfo.add( ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), ); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (projectProvider.isLogin) getAuthUser(); - }); + WidgetsBinding.instance.addPostFrameCallback((_) {}); super.initState(); } + int getSelectedCityID(MyBalanceViewModel model) { + int cityID = 1; + model.CitiesModelList.forEach((element) { + if (element.description == model.bloodModelList[0].city) { + cityID = element.iD; + } + }); + return cityID; + } + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCities(), //model.getHospitals(), + onModelReady: (model) => model.getCities().then((value) { + model.getBlood().then((value) { + if (model.bloodModelList.length > 0) { + CitiesModel citiesModel = new CitiesModel(); + citiesModel.iD = getSelectedCityID(model); + _selectedHospitalIndex = (citiesModel.iD - 1); + citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + _selectedHospital = citiesModel; + _selectedBloodType = model.bloodModelList[0].bloodGroup; + _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + } else { + _selectedHospital = model.CitiesModelList[0]; + } + }); + }), + // { + // if (projectProvider.isLogin && projectProvider.user != null) { + // model.getCities().then((value) { + // model.getBlood().then((value) { + // if (model.bloodModelList.length > 0) { + // CitiesModel citiesModel = new CitiesModel(); + // citiesModel.iD = getSelectedCityID(model); + // _selectedHospitalIndex = (citiesModel.iD - 1); + // citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + // citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + // _selectedHospital = citiesModel; + // _selectedBloodType = model.bloodModelList[0].bloodGroup; + // _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); + // } else { + // _selectedHospital = model.CitiesModelList[0]; + // } + // }); + // }); + // } + // }, builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - baseViewModel: model, - imagesInfo: imagesInfo, - description: TranslationBase.of(context).bloodDonationInfo, - appBarTitle: TranslationBase.of(context).bloodD, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).bloodDEnterDesc, - textAlign: TextAlign.center, - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.CitiesModelList), - //model.hospitals - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Theme.of(context).primaryColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(getHospitalName(projectProvider, context)), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectGenderDialog(), - //confirmSelectBeneficiaryDialog(model), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Theme.of(context).primaryColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - //Texts(getBeneficiaryType()), - Texts(getGender(context)), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectBloodDialog(), - //confirmSelectBeneficiaryDialog(model), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Theme.of(context).primaryColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - //Texts(getBeneficiaryType()), - Texts(getBlood()), - Icon(Icons.arrow_drop_down) - ], - ), + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + baseViewModel: model, + isShowDecPage: true, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bloodDEnterDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), - ), - SizedBox( - height: 12, - ), - Row( - children: [ - Container( - child: Text(TranslationBase.of(context).viewTermsConditions), - ), - SizedBox( - width: MediaQuery.of(context).size.height * 0.10, - ), - InkWell( - onTap: () { - Navigator.of(context).push(FadePage(page: UserAgreementPage())); - }, - child: Container( - child: Texts( + SizedBox(height: 12), + if (projectProvider.isLogin && model.state != ViewState.Busy) + + CommonDropDownView( + TranslationBase.of(context).city, + model.CitiesModelList.isNotEmpty + ? projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN + : model.CitiesModelList[_selectedHospitalIndex].description + : "", () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).male, 1), + RadioSelectionDialogModel(TranslationBase.of(context).female, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedGenderIndex, + onValueSelected: (index) { + _selectedGenderIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).bloodType, _selectedBloodType, () { + List list = [ + RadioSelectionDialogModel("O+", 0), + RadioSelectionDialogModel("O-", 1), + RadioSelectionDialogModel("AB+", 2), + RadioSelectionDialogModel("AB-", 3), + RadioSelectionDialogModel("A+", 4), + RadioSelectionDialogModel("A-", 5), + RadioSelectionDialogModel("B+", 6), + RadioSelectionDialogModel("B-", 7), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedBloodTypeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedBloodTypeIndex = index; + _selectedBloodType = getBlood(index); + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).viewTermsConditions + ":", + style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), + ), + InkWell( + onTap: () { + Navigator.of(context).push(FadePage(page: UserAgreementPage())); + }, + child: Text( TranslationBase.of(context).clickHere, - color: Colors.blue, + style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), ), + ) + ], + ), + SizedBox(height: 12), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + value: checkedValue, + activeColor: Color(0xFFc5272d), ), - ) - ], - ), - SizedBox( - height: 12, - ), - Row( - children: [ - Checkbox( - onChanged: (bool value) { - setState(() { - checkedValue = value; - }); - }, - // tristate: checkedValue==true,//i == 1, - value: checkedValue, - activeColor: Color(0xFFc5272d), //Color(0xFF6200EE), - ), - SizedBox( - height: 10, - ), - Row( - children: [], - ), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context).iAgreeToTheTermsAndConditions, - style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue ? Color(0xFFc5272d) : Colors.black), - ), - ], - ), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - color: Theme.of(context).primaryColor, - width: 350, - child: InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - "", - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.asset('assets/images/BloodChrt_EN.png'), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png')), + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + color: Theme.of(context).primaryColor, + width: 350, + child: InkWell( + onTap: () { + showZoomImageDialog(context, 'assets/images/BloodChrt_EN.png', isNetworkImage: false); + }, + child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ), ), ), - ), - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], - ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Color(0xFFa0a4a6) - : Color.fromRGBO( - 63, - 72, - 74, - 1, + ], ), - label: TranslationBase.of(context).save, - onTap: () async { - if (_selectedHospital == null) { - AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); - return; - } - bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; - bloodDetails.cityCode = _selectedHospital.iD.toString(); - bloodDetails.gender = gender == Gender.Male ? 1 : 2; - await model.updateBloodGroup(bloodDetails); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); - } else { - AppToast.showErrorToast(message: model.error); - } - }, + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), + ), ), - )), - ); - } - - //============== - void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { - showDialog( - context: context, - child: SelectBeneficiaryDialog( - beneficiaryType: beneficiaryType, - onValueSelected: (value) { - setState(() { - if (value == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - beneficiaryType = value; - }); - }, - ), - ); - } - - void confirmSelectBloodDialog() { - showDialog( - context: context, - child: SelectBloodDialog( - bloodType: blood, - onValueSelected: (value) { - setState(() { - if (value == Blood.Oplus) { - bloodDetails.bloodGroup = "O+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Ominus) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.bloodGroup = "O-"; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABplus) { - bloodDetails.bloodGroup = "AB+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABminus) { - bloodDetails.bloodGroup = "AB-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aplus) { - bloodDetails.bloodGroup = "A+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aminus) { - bloodDetails.bloodGroup = "A-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bplus) { - bloodDetails.bloodGroup = "B+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bminus) { - bloodDetails.bloodGroup = "B-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - // beneficiaryType = value; - blood = value; - }); - }, - ), - ); - } - - void confirmSelectGenderDialog() { - showDialog( - context: context, - child: SelectGenderDialog( - beneficiaryType: gender, - onValueSelected: (value) { - setState(() { - if (value == Gender.Male) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.patientType = 1; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - // _fileTextController.text = ""; - { - bloodDetails.gender = 2; - } - - // beneficiaryType = value; - gender = value; - }); - }, - ), - ); - } - -//void confirmSelectHospitalDialog(List hospitals) { - void confirmSelectHospitalDialog(List hospitals) { - showDialog( - context: context, - child: SelectCiteisDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); - }, - ), - ); - } - - void confirmSelectPatientDialog(List patientInfoList) { - showDialog( - context: context, - child: SelectPatientInfoDialog( - patientInfoList: patientInfoList, - selectedPatientInfo: _selectedPatientInfo, - onValueSelected: (value) { - setState(() { - advanceModel.depositorName = value.fullName; - _selectedPatientInfo = value; - }); - }, + DefaultButton( + TranslationBase.of(context).save, + checkedValue + ? () async { + if (_selectedHospital == null) { + AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + return; + } + bloodDetails.city = _selectedHospital.description; + bloodDetails.cityCode = _selectedHospital.iD.toString(); + bloodDetails.gender = _selectedGenderIndex; + bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); + await model.updateBloodGroup(bloodDetails); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); + } else { + AppToast.showErrorToast(message: model.error); + } + } + : null, + disabledColor: CustomColors.grey2, + ).insideContainer + ], + ), ), ); } - void confirmSelectFamilyDialog(List getAllSharedRecordsByStatusList) { - showDialog( - context: context, - child: SelectPatientFamilyDialog( - getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, - selectedPatientFamily: selectedPatientFamily, - onValueSelected: (value) { - setState(() { - selectedPatientFamily = value; - _fileTextController.text = selectedPatientFamily.patientID.toString(); - advanceModel.depositorName = value.patientName; - }); - }, - ), - ); - } - - String getBeneficiaryType() { - switch (beneficiaryType) { - case BeneficiaryType.MyAccount: - return TranslationBase.of(context).myAccount; - case BeneficiaryType.MyFamilyFiles: - return TranslationBase.of(context).myFamilyFiles; - break; - case BeneficiaryType.OtherAccount: - return TranslationBase.of(context).otherAccount; - break; - case BeneficiaryType.NON: - return TranslationBase.of(context).selectBeneficiary; - } - return TranslationBase.of(context).selectBeneficiary; - } - - String getGender(BuildContext context) { - switch (gender) { - case Gender.Male: - return TranslationBase.of(context).male; - case Gender.Female: - return TranslationBase.of(context).female; - break; - - case Gender.NON: - return TranslationBase.of(context).selectGender; - } - return TranslationBase.of(context).selectGender; - } - - String getBlood() { - switch (blood) { - case Blood.Oplus: + String getBlood(int index) { + switch (index) { + case 0: return "O+"; break; - case Blood.Ominus: + case 1: return "O-"; break; - case Blood.ABplus: + case 2: return "AB+"; break; - case Blood.ABminus: + case 3: return "AB-"; break; - case Blood.Aplus: + case 4: return "A+"; break; - case Blood.Aminus: + case 5: return "A-"; break; - case Blood.Bplus: + case 6: return "B-"; break; - case Blood.Bminus: + case 7: return "B-"; break; - case Blood.Bplus: + case 8: return "B+"; break; - case Blood.NON: - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; + default: + return ""; } - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } - String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { - if (_selectedHospital != null) - return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; - else - return TranslationBase.of(context).selectCity; - // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; - } - - String getPatientName() { - if (_selectedPatientInfo != null) - return _selectedPatientInfo.fullName; - else - return TranslationBase.of(context).selectPatientName; - } + int getBloodIndex(String type) { + switch (type) { + case "O+": + return 0; + break; + case "O-": + return 1; + break; + case "AB+": + return 2; + break; + case "AB-": + return 3; + break; + case "A+": + return 4; + break; + case "A-": + return 5; + break; + case "B-": + return 6; + break; + case "B-": + return 7; + break; + case "B+": + return 8; + break; - getAuthUser() async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); + default: + return 0; } } - String getFamilyMembersName() { - if (selectedPatientFamily != null) - return selectedPatientFamily.patientName; + String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { + if (_selectedHospital != null) + return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; else - return TranslationBase.of(context).selectFamilyPatientName; + return TranslationBase.of(context).selectCity; } - -//================ - } diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index f3f7bffb..96e8d593 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; @@ -86,7 +87,7 @@ class ConfirmPaymentPage extends StatelessWidget { height: 100.0, padding: EdgeInsets.all(7.0), width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset(getImagePath(selectedPaymentMethod)), + child: selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(selectedPaymentMethod)) : Image.asset(getImagePath(selectedPaymentMethod)), ), Texts( '${advanceModel.amount} SAR', @@ -193,6 +194,9 @@ class ConfirmPaymentPage extends StatelessWidget { case "Installment": return 'assets/images/new-design/installment.png'; break; + case "ApplePay": + return 'assets/images/new-design/applepay.svg'; + break; } return 'assets/images/new-design/mada.png'; @@ -219,8 +223,8 @@ class ConfirmPaymentPage extends StatelessWidget { authenticatedUser, browser, false, - null, - null); + "3", + ""); } onBrowserLoadStart(String url) { diff --git a/lib/pages/Blood/dialogs/SelectBloodDialog.dart b/lib/pages/Blood/dialogs/SelectBloodDialog.dart deleted file mode 100644 index 23e9e753..00000000 --- a/lib/pages/Blood/dialogs/SelectBloodDialog.dart +++ /dev/null @@ -1,328 +0,0 @@ -import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - - -class SelectBloodDialog extends StatefulWidget { - - final Blood bloodType; - final Function(Blood) onValueSelected; - - SelectBloodDialog({Key key, this.bloodType, this.onValueSelected}); - - - - @override - _SelectBloodDialogState createState() => _SelectBloodDialogState(this.bloodType); -} - -class _SelectBloodDialogState extends State { - _SelectBloodDialogState(this.bloodType); - Blood bloodType; - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Container( - child: Column( - children: [ - Divider(), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Oplus; - }); - }, - child: ListTile( - title: Text("O+"), - leading: Radio( - value: Blood.Oplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Ominus; - }); - }, - child: ListTile( - title: Text("O-"), - leading: Radio( - value: Blood.Ominus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.ABminus; - }); - }, - child: ListTile( - title: Text("AB-"), - leading: Radio( - value: Blood.ABminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.ABplus; - }); - }, - child: ListTile( - title: Text("AB+"), - leading: Radio( - value: Blood.ABplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Aplus; - }); - }, - child: ListTile( - title: Text("A+"), - leading: Radio( - value: Blood.Aplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Aminus; - }); - }, - child: ListTile( - title: Text("A-"), - leading: Radio( - value: Blood.Aminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Bplus; - }); - }, - child: ListTile( - title: Text("B+"), - leading: Radio( - value: Blood.Bplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Bminus; - }); - }, - child: ListTile( - title: Text("B-"), - leading: Radio( - value: Blood.Bminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(bloodType); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - ), - ], - ) - ], - ), - ) - ], - ); - } -} diff --git a/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart index 5808aed8..bb9afd6c 100644 --- a/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart +++ b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; diff --git a/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart index bea4f694..150d408e 100644 --- a/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart +++ b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart @@ -1,6 +1,4 @@ -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/Blood/new_text_Field.dart b/lib/pages/Blood/new_text_Field.dart index ad9eb580..8506ac6a 100644 --- a/lib/pages/Blood/new_text_Field.dart +++ b/lib/pages/Blood/new_text_Field.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/pages/Blood/user_agreement_page.dart b/lib/pages/Blood/user_agreement_page.dart index 36989ea5..319d868e 100644 --- a/lib/pages/Blood/user_agreement_page.dart +++ b/lib/pages/Blood/user_agreement_page.dart @@ -12,6 +12,8 @@ class UserAgreementPage extends StatelessWidget { onModelReady: (model) => model.getUserTermsAndConditions(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).userAgreement, body: SingleChildScrollView( child: Html( diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index fe9113cb..bdf387d6 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -4,23 +4,26 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.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:intl/intl.dart'; import 'package:provider/provider.dart'; -import 'package:rating_bar/rating_bar.dart'; -import 'BookSuccess.dart'; +import 'book_reminder_page.dart'; class BookConfirm extends StatefulWidget { DoctorList doctor; @@ -31,11 +34,7 @@ class BookConfirm extends StatefulWidget { String appoTimeFormatted = ""; bool isLiveCareAppointment; - BookConfirm( - {@required this.doctor, - @required this.selectedDate, - @required this.isLiveCareAppointment, - @required this.selectedTime}); + BookConfirm({@required this.doctor, @required this.selectedDate, @required this.isLiveCareAppointment, @required this.selectedTime}); DoctorsListService service; PatientShareResponse patientShareResponse; @@ -48,6 +47,8 @@ class BookConfirm extends StatefulWidget { class _BookConfirmState extends State { ToDoCountProviderModel toDoProvider; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override void initState() { widget.authUser = new AuthenticatedUser(); @@ -61,348 +62,193 @@ class _BookConfirmState extends State { Widget build(BuildContext context) { toDoProvider = Provider.of(context); return AppScaffold( - appBarTitle: TranslationBase.of(context).bookAppo, + appBarTitle: widget.doctor.doctorTitle + " " + widget.doctor.name, isShowDecPage: false, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.only(bottom: 5.0), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).confirmAppoHeading, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - color: new Color(0xFF60686b), - letterSpacing: 0.9))), - Divider( - color: Colors.grey[400], + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.doctor.name, + widget.doctor.doctorID, + widget.doctor.doctorImageURL, + widget.doctor.speciality, + "", + widget.doctor.projectName, + null, + null, + widget.doctor.nationalityFlagURL, + widget.doctor.doctorRate, + null, + widget.doctor.noOfPatientsRate, + "", + ), - Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).docInfo, - style: TextStyle( - fontSize: 22.0, - color: Colors.black, - letterSpacing: 0.9))), - Container( - child: Card( - color: Colors.white, - margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Container( - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.doctor.doctorImageURL, - fit: BoxFit.fill, height: 70.0, width: 70.0), - ), - Container( - width: MediaQuery.of(context).size.width * 0.58, - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Column( + isNeedToShowButton: false, + ), + Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).confirmAppoHeading, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(20), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 20, 16, 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).appoInfo, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + mHeight(16), + Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ - Text( - widget.doctor.doctorTitle + - "" + - widget.doctor.name, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(widget.doctor.clinicName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - widget.doctor.speciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget - .doctor.actualDoctorRate - .toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), + if (!widget.isLiveCareAppointment) showInfo(TranslationBase.of(context).hospital, widget.doctor.projectName), + showInfo(TranslationBase.of(context).clinic, widget.doctor.clinicName), + showInfo(TranslationBase.of(context).date, getDate()), + showInfo(TranslationBase.of(context).time, widget.selectedTime) ], ), - ), - ], + ], + ), ), ), - ), - ), - Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).appoInfo, - style: TextStyle( - fontSize: 22.0, - color: Colors.black, - letterSpacing: 0.9))), - Container( - child: Card( - color: Colors.white, - margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Container( - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - !widget.isLiveCareAppointment ? Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/icon_hospital.png"), - ), - Container( - margin: - EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Text( - TranslationBase.of(context).hospital + - ": " + - widget.doctor.projectName, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - ), - ], - ) : Container(), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/icon_hospital.png"), - ), - Container( - width: MediaQuery.of(context).size.width * 0.7, - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Text( - TranslationBase.of(context).clinic + - ": " + - widget.doctor.clinicName, - overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), + mHeight(12), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 20, 16, 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).patientInfo, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - child: Icon( - Icons.today, - color: Colors.grey[700], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text( - TranslationBase.of(context).date + - ": " + - getDate(), - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - child: Icon( - Icons.timer, - color: Colors.grey[700], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Text( - TranslationBase.of(context).time + - ": " + - widget.selectedTime, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - ), - ], - ), - ], - ), - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).patientInfo, - style: TextStyle( - fontSize: 22.0, - color: Colors.black, - letterSpacing: 0.9))), - Container( - child: Card( - color: Colors.white, - margin: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 16.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Container( - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(10.0), - child: Image.asset( - "assets/images/new-design/appointment_info.png", - fit: BoxFit.fill, - height: 60.0, - width: 60.0), - ), - Container( - width: MediaQuery.of(context).size.width * 0.58, - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), - child: Column( + ), + mHeight(16), + Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ - Text( - widget.authUser.firstName + - " " + - widget.authUser.lastName, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - TranslationBase.of(context).gender + - ": " + - widget.authUser.genderDescription, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text( - TranslationBase.of(context).age + - ": " + - widget.authUser.age.toString(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), + showInfo(TranslationBase.of(context).name, widget.authUser.firstName + " " + widget.authUser.lastName), + showInfo(TranslationBase.of(context).gender, widget.authUser.genderDescription), + showInfo(TranslationBase.of(context).age, widget.authUser.age.toString()) ], ), - ), - ], + ], + ), ), ), - ), + ], ), - SizedBox( - height: 120.0, - ), - ], - ), + ), + SizedBox( + height: 120.0, + ), + ], ), ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, + color: CustomColors.appBackgroudGreyColor, + child: Container( + width: MediaQuery.of(context).size.width, height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (!widget.isLiveCareAppointment) { - insertAppointment(context, widget.doctor); - } else { - insertLiveCareScheduledAppointment(context, widget.doctor); - } - }, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), + margin: EdgeInsets.all(16), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 40.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { + insertAppointment(context, widget.doctor); + } else { + insertLiveCareScheduledAppointment(context, widget.doctor); + } + }, + child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), + ), ), ), ), ); } - cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, - BuildContext context) { + Widget showInfo(String title, String des) { + return Container( + child: Row( + children: [ + Text( + title + ": ", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + letterSpacing: -0.4, + ), + ), + Text( + des, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.black, + letterSpacing: -0.48, + ), + ), + ], + ), + ); + } + + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - if (!widget.isLiveCareAppointment) { + Future.delayed(new Duration(milliseconds: 1500), () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -420,23 +266,13 @@ class _BookConfirmState extends State { insertAppointment(context, DoctorList docObject) { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service - .insertAppointment( - docObject.doctorID, - docObject.clinicID, - docObject.projectID, - widget.selectedTime, - widget.selectedDate, - context) - .then((res) { + widget.service.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, context).then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast( - message: TranslationBase.of(context).bookedSuccess); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); getToDoCount(); }); } else { @@ -472,23 +308,13 @@ class _BookConfirmState extends State { insertLiveCareScheduledAppointment(context, DoctorList docObject) { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service - .insertLiveCareScheduleAppointment( - docObject.doctorID, - docObject.clinicID, - docObject.projectID, - docObject.serviceID, - widget.selectedTime, - widget.selectedDate, - context) - .then((res) { + widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { - getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], - docObject.clinicID, docObject.projectID, docObject); + getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); getToDoCount(); }); } else { @@ -522,23 +348,20 @@ class _BookConfirmState extends State { } getToDoCount() { - toDoProvider.setState(0, true); + toDoProvider.setState(0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true); + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); }); } - getPatientShare(context, String appointmentNo, int clinicID, int projectID, - DoctorList docObject) { - widget.service - .getPatientShare(appointmentNo, clinicID, projectID, context) - .then((res) { + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + widget.service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); navigateToBookSuccess(context, docObject, widget.patientShareResponse); @@ -550,12 +373,8 @@ class _BookConfirmState extends State { }); } - getLiveCareAppointmentPatientShare(context, String appointmentNo, - int clinicID, int projectID, DoctorList docObject) { - widget.service - .getLiveCareAppointmentPatientShare( - appointmentNo, clinicID, projectID, context) - .then((res) { + getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); @@ -578,26 +397,26 @@ class _BookConfirmState extends State { } String getDate() { - var dateObj = new DateTime( - int.parse(widget.selectedDate.split("-")[0]), - int.parse(widget.selectedDate.split("-")[1]), - int.parse(widget.selectedDate.split("-")[2]), - 0, - 0, - 0, - 0); + var dateObj = new DateTime(int.parse(widget.selectedDate.split("-")[0]), int.parse(widget.selectedDate.split("-")[1]), int.parse(widget.selectedDate.split("-")[2]), 0, 0, 0, 0); setState(() { - widget.appoDateFormatted = DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString(); + widget.appoDateFormatted = DateUtil.getWeekDay(dateObj.weekday) + ", " + dateObj.day.toString() + " " + DateUtil.getMonth(dateObj.month) + " " + dateObj.year.toString(); }); - return widget.appoDateFormatted; + return DateUtil.getDayMonthYearDateFormatted(dateObj); + } + + DateTime getDateTime() { + var parts = widget.selectedTime.split(':'); + + try { + var dateObj = new DateTime(int.parse(widget.selectedDate.split("-")[0]), int.parse(widget.selectedDate.split("-")[1]), int.parse(widget.selectedDate.split("-")[2]), int.parse(parts[0].trim()), + int.parse(parts[1].trim()), 0, 0); + return dateObj; + } catch (e) { + var dateObj = new DateTime(int.parse(widget.selectedDate.split("-")[0]), int.parse(widget.selectedDate.split("-")[1]), int.parse(widget.selectedDate.split("-")[2]), 0, 0, 0, 0); + return dateObj; + } } String getDoctorSpeciality(List docSpecial) { @@ -611,8 +430,7 @@ class _BookConfirmState extends State { getPatientData() async { AppSharedPreferences sharedPref = AppSharedPreferences(); if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); setState(() { print(data); widget.authUser = data; @@ -624,16 +442,20 @@ class _BookConfirmState extends State { Navigator.of(context).popAndPushNamed(HOME); } - Future navigateToBookSuccess(context, DoctorList docObject, - PatientShareResponse patientShareResponse) async { + Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); + this.sharedPref.remove(IS_LIVECARE_APPOINTMENT); Navigator.push( - context, - FadePage( - page: BookSuccess( - docObject: docObject, - patientShareResponse: patientShareResponse, - appoDateFormatted: widget.appoDateFormatted, - appoTimeFormatted: widget.selectedTime))); + context, + FadePage( + page: BookReminderPage( + docObject: docObject, + patientShareResponse: patientShareResponse, + appoDateFormatted: widget.appoDateFormatted, + appoTimeFormatted: widget.selectedTime, + dateTime: getDateTime(), + ), + ), + ); } } diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index fb8b1ac9..04086ee3 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -3,15 +3,20 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.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_inappwebview/flutter_inappwebview.dart'; @@ -23,17 +28,12 @@ class BookSuccess extends StatefulWidget { DoctorList docObject; MyInAppBrowser browser; - final ChromeSafariBrowser chromeBrowser = - new MyChromeSafariBrowser(new MyInAppBrowser()); + final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser()); String appoDateFormatted; String appoTimeFormatted; - BookSuccess( - {@required this.patientShareResponse, - @required this.docObject, - @required this.appoDateFormatted, - @required this.appoTimeFormatted}); + BookSuccess({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted}); @override _BookSuccessState createState() => _BookSuccessState(); @@ -45,119 +45,53 @@ class _BookSuccessState extends State { @override Widget build(BuildContext context) { - return Scaffold( + return AppScaffold( + appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.docObject.name, + widget.docObject.doctorID, + widget.docObject.doctorImageURL, + widget.docObject.speciality, + "", + widget.docObject.projectName, + null, + null, + widget.docObject.nationalityFlagURL, + widget.docObject.doctorRate, + null, + widget.docObject.noOfPatientsRate, + "", + ), + isNeedToShowButton: false, + ), Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.only(bottom: 10.0), - color: new Color(0xFF20bc44), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 40.0), - child: Text(TranslationBase.of(context).bookSuccess, - style: TextStyle( - color: Colors.white, - fontSize: 18.0, - fontWeight: FontWeight.bold, - letterSpacing: 0.9)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 20.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(10.0), - child: Image.asset( - "assets/images/new-design/check-icon.png", - fit: BoxFit.fill, - height: 80.0, - width: 80.0), - ), - Container( - width: MediaQuery.of(context).size.width * 0.62, - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Text(widget.docObject.projectName, - overflow: TextOverflow.clip, - style: _getTextStyling()), - Container( - margin: EdgeInsets.only(top: 5.0), - child: - Text("Insurance", style: _getTextStyling()), - ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text(widget.docObject.clinicName, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text( - widget.appoDateFormatted + - ", " + - widget.appoTimeFormatted, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - Container( - width: MediaQuery.of(context).size.width * 0.65, - margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text( - widget.docObject.doctorTitle + - " " + - widget.docObject.name, - overflow: TextOverflow.clip, - style: _getTextStyling()), - ), - ], - ), - ), - ], - ), + alignment: Alignment.center, + color: CustomColors.green, + child: Table( + border: TableBorder(verticalInside: BorderSide(width: 0.5, color: Colors.white)), + children: [ + TableRow( + children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShare)), + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareWithTax)), + ], ), - Container( - alignment: Alignment.center, - decoration: BoxDecoration( - border: Border.all(color: Colors.white, width: 0.5)), - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), - child: Table( - border: TableBorder( - verticalInside: - BorderSide(width: 0.5, color: Colors.white)), - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientShare)), - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareWithTax)), - ]), - TableRow(children: [ - TableCell( - child: _getHeadingText("SR " + - widget.patientShareResponse.patientShare - .toString())), - TableCell( - child: _getHeadingText("SR " + - widget - .patientShareResponse.patientShareWithTax - .toString())), - ]), - ], - ), + TableRow( + children: [ + TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShare.toString())), + TableCell(child: _getHeadingText("SR " + widget.patientShareResponse.patientShareWithTax.toString())), + ], ), ], ), @@ -166,7 +100,7 @@ class _BookSuccessState extends State { ], ), ), - bottomNavigationBar: getBottomContainer(), + bottomSheet: getBottomContainer(), ); } @@ -209,14 +143,14 @@ class _BookSuccessState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { // navigateToQR(context); getAppoQR(context); }, - child: Text(TranslationBase.of(context).viewQR.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).viewQR.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), ), ], @@ -226,112 +160,122 @@ class _BookSuccessState extends State { Widget _getPayNowButtons() { return Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - startPaymentProcess(); - }, - child: Text(TranslationBase.of(context).payNow.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), + color: CustomColors.appBackgroudGreyColor, + child: Container( + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + startPaymentProcess(); + }, + child: Text(TranslationBase.of(context).payNow.toUpperCase(), style: TextStyle(fontSize: 18.0)), + ), + ), ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xffc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text(TranslationBase.of(context).payLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xffc5272d), + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + navigateToHome(context); + }, + child: Text(TranslationBase.of(context).payLater.toUpperCase(), style: TextStyle(fontSize: 18.0)), + ), + ), ), - ), - ], + ], + ), ), ); } Widget _getConfirmAppoButtons() { return Container( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(bottom: 5.0), - height: MediaQuery.of(context).size.height * 0.15, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); - appo.clinicID = widget.docObject.clinicID; - appo.projectID = widget.docObject.projectID; - appo.appointmentNo = widget.patientShareResponse.appointmentNo; - appo.serviceID = widget.patientShareResponse.serviceID; - appo.isLiveCareAppointment = - widget.patientShareResponse.isLiveCareAppointment; - appo.doctorID = widget.patientShareResponse.doctorID; - confirmAppointment(appo); - }, - child: Text( - widget.patientShareResponse.isLiveCareAppointment - ? TranslationBase.of(context) - .confirmLiveCare - .toUpperCase() - : TranslationBase.of(context).confirm.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), + color: CustomColors.appBackgroudGreyColor, + child: Container( + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: new Color(0xffc5272d), + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + navigateToHome(context); + }, + child: Text(TranslationBase.of(context).confirmLater, style: TextStyle(fontSize: 18.0)), + ), + ), ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFFc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text( - TranslationBase.of(context).confirmLater.toUpperCase(), - style: TextStyle(fontSize: 18.0)), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + appo.clinicID = widget.docObject.clinicID; + appo.projectID = widget.docObject.projectID; + appo.appointmentNo = widget.patientShareResponse.appointmentNo; + appo.serviceID = widget.patientShareResponse.serviceID; + appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; + appo.doctorID = widget.patientShareResponse.doctorID; + confirmAppointment(appo); + }, + child: Text(widget.patientShareResponse.isLiveCareAppointment ? TranslationBase.of(context).confirmLiveCare : TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 18.0)), + ), + ), ), - ), - ], + ], + ), ), ); } @@ -390,8 +334,7 @@ class _BookSuccessState extends State { Container( margin: EdgeInsets.only(top: 30.0, bottom: 40.0), alignment: Alignment.center, - child: Text(TranslationBase.of(context).confirmAppo, - style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), + child: Text(TranslationBase.of(context).confirmAppo, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), ), Flex( direction: Axis.horizontal, @@ -406,9 +349,7 @@ class _BookSuccessState extends State { _getBulletPoint("1"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text(TranslationBase.of(context).upcomingConfirm, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).upcomingConfirm, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -429,10 +370,7 @@ class _BookSuccessState extends State { _getBulletPoint("2"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).upcomingConfirmMore, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).upcomingConfirmMore, overflow: TextOverflow.clip, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -440,10 +378,7 @@ class _BookSuccessState extends State { ), ], ), - Container( - margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Image.asset("assets/images/new-design/payment-method.png"), - ), + Container(margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), child: getPaymentMethods()), ], ); } @@ -455,10 +390,7 @@ class _BookSuccessState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service - .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, - appo.isLiveCareAppointment, context) - .then((res) { + service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); @@ -480,10 +412,7 @@ class _BookSuccessState extends State { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { 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, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); @@ -499,77 +428,46 @@ class _BookSuccessState extends State { } Widget _getPayNowAppo() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.only(top: 20.0, bottom: 0.0), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).payNowBookSuccess, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 0.8, - fontWeight: FontWeight.bold)), - ), - Container( - alignment: Alignment.center, - child: Image.asset("assets/images/new-design/no-wait-queue.png", - width: 120.0, height: 120.0), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - _getBulletPoint("1"), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).payNowBookSuccesstext1, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), - ), - ], - ), - ), + return Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + TranslationBase.of(context).payNowBookSuccess, + style: TextStyle( + fontSize: 24.0, + letterSpacing: -1.44, + fontWeight: FontWeight.bold, ), - ], - ), - Container( - margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Image.asset("assets/images/new-design/payment-method.png"), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(top: 0.0, left: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - _getBulletPoint("2"), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).payNowBookSuccesstext2, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 13.0)), - ), - ], - ), - ), + ), + Text( + TranslationBase.of(context).neverWait, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.54, + fontWeight: FontWeight.w600, ), - ], - ), - ], + ), + mHeight(24), + Text(TranslationBase.of(context).payNowBookSuccesstext1, + overflow: TextOverflow.fade, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + )), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), + Text( + TranslationBase.of(context).payNowBookSuccesstext2, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + ), + ), + ], + ), ); } @@ -577,11 +475,9 @@ class _BookSuccessState extends State { navigateToPaymentMethod(context, widget.patientShareResponse); } - Future navigateToPaymentMethod( - context, PatientShareResponse patientShareResponse) async { + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); @@ -592,65 +488,41 @@ class _BookSuccessState extends State { appo.clinicID = widget.patientShareResponse.clinicID; appo.appointmentNo = widget.patientShareResponse.appointmentNo; - Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { - print(value); + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { if (value != null) { - openPayment( - value, - authUser, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, - appo); + openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { - if (paymentMethod == "ApplePay") { - await widget.chromeBrowser.open( - url: "https://applepay-datatrans-sample.herokuapp.com/", - options: ChromeSafariBrowserClassOptions( - android: AndroidChromeCustomTabsOptions( - addDefaultShareMenuItem: false), - ios: IOSSafariOptions(barCollapsingEnabled: true))); - } else { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); - - widget.browser.openPaymentBrowser( - amount, - "Appointment check in", - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - appo.projectID.toString(), - authenticatedUser.emailAddress, - paymentMethod, - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - widget.browser, - widget.patientShareResponse.isLiveCareAppointment, - null, - null, - widget.patientShareResponse.appointmentDate, - widget.patientShareResponse.appointmentNo, - widget.patientShareResponse.clinicID, - widget.patientShareResponse.doctorID); - } + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); + + widget.browser.openPaymentBrowser( + amount, + "Appointment check in", + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName, + authenticatedUser.patientID, + authenticatedUser, + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + "2", + "", + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); + // } } onBrowserLoadStart(String url) { - print("onBrowserLoadStart"); print(url); MyInAppBrowser.successURLS.forEach((element) { @@ -671,21 +543,13 @@ class _BookSuccessState extends State { } onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { - print("onBrowserExit Called!!!!"); if (isPaymentMade) checkPaymentStatus(appo); } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { - print("Printing Payment Status Reponse!!!!"); - print(res); + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { createAdvancePayment(res, appo); @@ -703,15 +567,9 @@ class _BookSuccessState extends State { getApplePayAPQ(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print("Printing Payment Status Reponse!!!!"); - print(res); + String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { createAdvancePayment(res, appo); @@ -728,15 +586,8 @@ class _BookSuccessState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], context) - .then((res) { - print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString()); + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) { + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString()); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -744,13 +595,9 @@ class _BookSuccessState extends State { }); } - addAdvancedNumberRequest( - String advanceNumber, String paymentReference, String appointmentID) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { print(res); getAppoQR(context); }).catchError((err) { @@ -768,13 +615,11 @@ class _BookSuccessState extends State { Container( margin: EdgeInsets.only(top: 30.0, bottom: 40.0), alignment: Alignment.center, - child: Text(TranslationBase.of(context).noNeedToWaitInLine, - style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), + child: Text(TranslationBase.of(context).noNeedToWaitInLine, style: TextStyle(fontSize: 18.0, letterSpacing: 0.8)), ), Container( alignment: Alignment.center, - child: Image.asset("assets/images/new-design/device_icon.png", - width: 120.0, height: 120.0), + child: Image.asset("assets/images/new-design/device_icon.png", width: 120.0, height: 120.0), ), Flex( direction: Axis.horizontal, @@ -793,10 +638,7 @@ class _BookSuccessState extends State { _getBulletPoint("1"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).useQRAppoAttend, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).useQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -808,10 +650,7 @@ class _BookSuccessState extends State { _getBulletPoint("2"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).passQRAppoAttend, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).passQRAppoAttend, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -823,10 +662,7 @@ class _BookSuccessState extends State { _getBulletPoint("3"), Container( width: MediaQuery.of(context).size.width * 0.8, - child: Text( - TranslationBase.of(context).sitWaitingQR, - overflow: TextOverflow.fade, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).sitWaitingQR, overflow: TextOverflow.fade, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -891,14 +727,18 @@ class _BookSuccessState extends State { _getHeadingText(text) { return Container( - padding: EdgeInsets.only(bottom: 10.0), - child: Text(text, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 26.0, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.white))); + padding: EdgeInsets.only(bottom: 10.0, left: 20, right: 20), + child: Text( + text, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + ), + ); } Future navigateToHome(context) async { @@ -907,9 +747,7 @@ class _BookSuccessState extends State { getAppoQR(context) { DoctorsListService service = new DoctorsListService(); - service - .generateAppointmentQR(widget.patientShareResponse, context) - .then((res) { + service.generateAppointmentQR(widget.patientShareResponse, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); navigateToQR(context, res['AppointmentQR']); @@ -932,15 +770,16 @@ class _BookSuccessState extends State { _getNormalText(text) { return Container( - margin: EdgeInsets.only(top: 5.0), - padding: EdgeInsets.only(top: 5.0, bottom: 5.0), + margin: EdgeInsets.only(top: 5.0, left: 20, right: 20), + padding: EdgeInsets.only(top: 5.0, bottom: 0), child: Text(text, - textAlign: TextAlign.center, + textAlign: TextAlign.start, style: TextStyle( - fontSize: 12, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.white)), + fontSize: 12, + letterSpacing: -0.36, + color: Colors.white, + fontWeight: FontWeight.w600, + )), ); } } diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 0fbfa624..4fb1b581 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -7,10 +7,12 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplai import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; 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/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -48,32 +50,42 @@ class _DentalComplaintsState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: "Symptoms", + appBarTitle: TranslationBase.of(context).chiefComplaints, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: CustomColors.appBackgroudGreyColor, body: Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: !hasDentalPlan - ? ListView.builder( + ? ListView.separated( itemCount: complaintsList.length, itemBuilder: (BuildContext context, int index) { return Container( - margin: EdgeInsets.only(bottom: 10.0), child: DentalComplaintCard( listDentalChiefComplain: complaintsList[index], languageID: languageID, ), ); }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.only(left: 14, right: 14), + child: mDivider(CustomColors.devider), + ); + }, ) : Container( child: SingleChildScrollView( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).dentalProcedureList, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold, letterSpacing: 0.5)), + margin: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0), + child: Text(TranslationBase.of(context).dentalProcedureList, style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, letterSpacing: -0.46)), ), Container( - margin: EdgeInsets.only(top: 20.0), + decoration: cardRadius(10), + margin: EdgeInsets.all(12.0), child: Table( children: getProceduresData(), ), @@ -102,6 +114,34 @@ class _DentalComplaintsState extends State { ); } + getLanguageID() async { + languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + } + + checkIfHasDentalPlan() { + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.checkIfHasDentalPlan(widget.searchInfo.ProjectID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + if (res['List_IsPatientHasOnGoingEstimation'].length != 0) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).continuePlan, + okText: TranslationBase.of(context).yes, + cancelText: TranslationBase.of(context).no, + okFunction: () => {Navigator.of(context).pop(), continueDentalPlan()}, + cancelFunction: () => {getChiefComplaintsList()}); + dialog.showAlertDialog(context); + } else { + getChiefComplaintsList(); + } + } + }).catchError((err) { + print(err); + }); + } + List getProceduresData() { List tableRow = []; @@ -110,17 +150,14 @@ class _DentalComplaintsState extends State { children: [ Container( child: Container( - child: Center( - child: Text(TranslationBase.of(context).procedureName, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), - ), + margin: EdgeInsets.all(12.0), + child: Text(TranslationBase.of(context).procedureName, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), ), Container( child: Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Center( - child: Text(TranslationBase.of(context).timeNeeded, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), - ), + margin: EdgeInsets.all(12.0), + child: Text(TranslationBase.of(context).timeNeeded, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), ), ], @@ -129,18 +166,12 @@ class _DentalComplaintsState extends State { dentalProceduresModel.listIsPatientHasOnGoingEstimation.forEach((procedure) { tableRow.add(TableRow(children: [ Container( - child: Container( - child: Center( - child: Text(procedure.procedureName, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 14.0)), - ), - ), + margin: EdgeInsets.all(12.0), + child: Text(procedure.procedureName, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), Container( - child: Container( - child: Center( - child: Text(procedure.neededTime.toString() + " mins", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 14.0)), - ), - ), + margin: EdgeInsets.all(12.0), + child: Text(procedure.neededTime.toString() + " " + TranslationBase.of(context).minute, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), ])); }); @@ -148,19 +179,12 @@ class _DentalComplaintsState extends State { TableRow( children: [ Container( - child: Container( - child: Center( - child: Text(TranslationBase.of(context).totalTimeNeeded, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), - ), - ), + margin: EdgeInsets.all(12.0), + child: Text(TranslationBase.of(context).totalTimeNeeded, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), Container( - child: Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Center( - child: Text(totalAppointmentTime.toString() + " mins", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 14.0)), - ), - ), + margin: EdgeInsets.all(12.0), + child: Text(totalAppointmentTime.toString() + " " + TranslationBase.of(context).minute, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46)), ), ], ), @@ -168,34 +192,6 @@ class _DentalComplaintsState extends State { return tableRow; } - getLanguageID() async { - languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - } - - checkIfHasDentalPlan() { - DoctorsListService service = new DoctorsListService(); - GifLoaderDialogUtils.showMyDialog(context); - service.checkIfHasDentalPlan(widget.searchInfo.ProjectID, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['MessageStatus'] == 1) { - if (res['List_IsPatientHasOnGoingEstimation'].length != 0) { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).continuePlan, - okText: TranslationBase.of(context).yes, - cancelText: TranslationBase.of(context).no, - okFunction: () => {Navigator.of(context).pop(), continueDentalPlan()}, - cancelFunction: () => {getChiefComplaintsList()}); - dialog.showAlertDialog(context); - } else { - getChiefComplaintsList(); - } - } - }).catchError((err) { - print(err); - }); - } - continueDentalPlan() { DoctorsListService service = new DoctorsListService(); diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 9c52adef..87941ed5 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -3,19 +3,23 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/doctor_post_pre_images_page.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.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_material_pickers/flutter_material_pickers.dart'; import 'package:rating_bar/rating_bar.dart'; import 'BookConfirm.dart'; @@ -28,11 +32,7 @@ class DoctorProfile extends StatefulWidget { final bool isOpenAppt; bool isLiveCareAppointment; - DoctorProfile( - {@required this.doctor, - @required this.docProfileList, - @required this.isLiveCareAppointment, - this.isOpenAppt = false}); + DoctorProfile({@required this.doctor, @required this.docProfileList, @required this.isLiveCareAppointment, this.isOpenAppt = false}); AuthenticatedUser authUser; @@ -40,22 +40,18 @@ class DoctorProfile extends StatefulWidget { _DoctorProfileState createState() => _DoctorProfileState(); } -class _DoctorProfileState extends State - with TickerProviderStateMixin { +class _DoctorProfileState extends State with TickerProviderStateMixin { TabController _tabController; bool showFooterButton = false; var event = RobotProvider(); - + dynamic doctorSchedule; AppSharedPreferences sharedPref = AppSharedPreferences(); List doctorDetailsList = List(); @override void initState() { - _tabController = new TabController( - length: 2, - vsync: this, - initialIndex: widget.isOpenAppt == true ? 1 : 0); + _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.isOpenAppt == true ? 1 : 0); _tabController = new TabController(length: 2, vsync: this); widget.authUser = new AuthenticatedUser(); widget.doctor.speciality = widget.docProfileList.specialty; @@ -66,162 +62,127 @@ class _DoctorProfileState extends State @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).bookAppo, + appBarTitle: widget.doctor.doctorTitle + " " + widget.doctor.name, isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, bottomSheet: showFooterButton ? Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, + color: CustomColors.appBackgroudGreyColor, + child: Container( + width: MediaQuery.of(context).size.width, height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: goToBookConfirm, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), + color: CustomColors.appBackgroudGreyColor, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 40.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: goToBookConfirm, + child: Text(TranslationBase.of(context).reviewAppointment, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48, fontWeight: FontWeight.w600)), + ), ), ), ) : null, body: Container( - color: new Color(0xFFf6f6f6), + color: new Color(0xFFF8F8F8), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(top: 20.0), - alignment: Alignment.center, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.doctor.doctorImageURL, - fit: BoxFit.fill, height: 120.0, width: 120.0), - ), - ), - Container( - margin: EdgeInsets.only(top: 20.0), - alignment: Alignment.center, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.asset('assets/images/drSchedul.png'), - ), - ) - ], - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text( - widget.doctor.doctorTitle + " " + widget.doctor.name, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text(widget.doctor.projectName, - style: TextStyle( - fontSize: 15.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text(widget.doctor.clinicName, - style: TextStyle( - fontSize: 13.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: RatingBar.readOnly( - initialRating: - widget.doctor.actualDoctorRate.toDouble(), - size: 35.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), + DoctorHeader( + headerModel: HeaderModel( + widget.doctor.name, + widget.doctor.doctorID, + widget.doctor.doctorImageURL, + widget.doctor.speciality, + "", + widget.doctor.projectName, + null, + null, + widget.doctor.nationalityFlagURL, + widget.doctor.doctorRate, + widget.doctor.actualDoctorRate, + widget.docProfileList.noOfPatientsRate, + "", + decimalDoctorRate: widget.docProfileList.decimalDoctorRate.toString(), + ), + buttonIcon: 'assets/images/new/Boo_ Appointment.svg', + showConfirmMessageDialog: false, + isNeedToShowButton: !widget.isLiveCareAppointment, + onTap: () { + Navigator.push( + context, + FadePage( + page: SchedulePage(doctorList: widget.doctor), ), - InkWell( - onTap: () { - getDoctorRatingsDetails(); - }, - child: Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: Text( - "(" + - widget.docProfileList.noOfPatientsRate - .toString() + - " " + - TranslationBase.of(context).reviews + - ")", - style: TextStyle( - fontSize: 14.0, - color: Colors.blue[800], - letterSpacing: 1.0, - decoration: TextDecoration.underline, - )), + ).then((value) { + setState(() { + if (_tabController.index == 0) { + _tabController.animateTo((_tabController.index + 1) % 2); + showFooterButton = true; + } + this.doctorSchedule = value; + }); + }); + }, + onRatingAndReviewTap: () { + getDoctorRatingsDetails(); + }, + buttonTitle: TranslationBase.of(context).schedule, + ), + mDivider(Colors.grey[300]), + if (widget.docProfileList.isDoctorHasPrePostImages == true) Container(height: 50, alignment: Alignment.center, child: prePostImagesButton(context)), + TabBar( + onTap: (index) { + setState(() { + if (index == 1) { + if (widget.doctor.clinicID == 17 || widget.doctor.clinicID == 23 || widget.doctor.clinicID == 47 || widget.isLiveCareAppointment) { + _tabController.index = _tabController.previousIndex; + showFooterButton = false; + } else { + showFooterButton = true; + } + } + print(showFooterButton); + }); + }, + tabs: [ + Tab( + child: Text( + TranslationBase.of(context).docInfo, + style: TextStyle( + color: Colors.black, + fontSize: 12, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, ), ), - if (widget.docProfileList.isDoctorHasPrePostImages == true) - Container( - height: 50, - alignment: Alignment.center, - child: prePostImagesButton(context)), - Container( - child: Divider( - color: Colors.grey[500], + ), + Tab( + child: Text( + TranslationBase.of(context).availableAppo, + style: TextStyle( + color: widget.isLiveCareAppointment ? Colors.grey : Colors.black, + fontSize: 12, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, ), ), - TabBar( - onTap: (index) { - setState(() { - index == 1 - ? showFooterButton = true - : showFooterButton = false; - print(showFooterButton); - }); - }, - tabs: [ - Tab( - child: Text(TranslationBase.of(context).docInfo, - style: TextStyle(color: Colors.black))), - Tab( - child: Text(TranslationBase.of(context).availableAppo, - style: TextStyle(color: Colors.black)), - ) - ], - controller: _tabController, - ), - ], - ), + ) + ], + controller: _tabController, ), Container( height: MediaQuery.of(context).size.height, @@ -230,8 +191,10 @@ class _DoctorProfileState extends State children: [ DoctorInformation(docProfileList: widget.docProfileList), DocAvailableAppointments( - doctor: widget.doctor, - isLiveCareAppointment: widget.isLiveCareAppointment) + doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, + doctorSchedule: doctorSchedule, + ), ], controller: _tabController, ), @@ -279,9 +242,7 @@ class _DoctorProfileState extends State getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .getDoctorsRatingDetails(widget.doctor.doctorID, context) - .then((res) { + service.getDoctorsRatingDetails(widget.doctor.doctorID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); @@ -301,9 +262,7 @@ class _DoctorProfileState extends State openDoctorPrePostImages() { GifLoaderDialogUtils.showMyDialog(context); - DoctorsListService() - .getDoctorPrePostImages(widget.docProfileList, context) - .then((images) { + DoctorsListService().getDoctorPrePostImages(widget.docProfileList, context).then((images) { GifLoaderDialogUtils.hideDialog(context); showDialog( context: context, @@ -349,30 +308,14 @@ class _DoctorProfileState extends State color: Theme.of(context).primaryColor, margin: EdgeInsets.only(bottom: 5.0), padding: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).doctorRating, - style: TextStyle( - fontSize: 22.0, color: Colors.white))), + child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.white))), Container( - margin: EdgeInsets.only(top: 0.0), - child: Text( - this - .widget - .doctor - .actualDoctorRate - .ceilToDouble() - .toString(), - style: TextStyle( - fontSize: 32.0, color: Colors.black))), + margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.doctor.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, child: RatingBar.readOnly( - initialRating: this - .widget - .doctor - .actualDoctorRate - .toDouble(), + initialRating: this.widget.doctor.actualDoctorRate.toDouble(), size: 35.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], @@ -384,34 +327,19 @@ class _DoctorProfileState extends State ), Container( margin: EdgeInsets.only(top: 10.0), - child: Text( - this - .widget - .doctor - .noOfPatientsRate - .toString() + - " " + - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 14.0, color: Colors.black))), + child: Text(this.widget.doctor.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: Row( children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).excellent, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[0].patientNumber), + width: getRatingWidth(doctorDetailsList[0].patientNumber), height: 6.0, child: Container( color: Colors.green[700], @@ -426,18 +354,12 @@ class _DoctorProfileState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).v_good, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[1].patientNumber), + width: getRatingWidth(doctorDetailsList[1].patientNumber), height: 6.0, child: Container( color: Color(0xffB7B723), @@ -452,18 +374,12 @@ class _DoctorProfileState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).good, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[2].patientNumber), + width: getRatingWidth(doctorDetailsList[2].patientNumber), height: 6.0, child: Container( color: Color(0xffEBA727), @@ -478,18 +394,12 @@ class _DoctorProfileState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).average, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[3].patientNumber), + width: getRatingWidth(doctorDetailsList[3].patientNumber), height: 6.0, child: Container( color: Color(0xffEB7227), @@ -504,19 +414,12 @@ class _DoctorProfileState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context) - .below_average, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[4].patientNumber), + width: getRatingWidth(doctorDetailsList[4].patientNumber), height: 6.0, child: Container( color: Color(0xffE20C0C), @@ -526,9 +429,7 @@ class _DoctorProfileState extends State ], ), ), - Container( - margin: EdgeInsets.only(top: 40.0), - child: Divider()), + Container(margin: EdgeInsets.only(top: 40.0), child: Divider()), Container( margin: EdgeInsets.only(top: 0.0), child: Align( @@ -550,9 +451,7 @@ class _DoctorProfileState extends State onPressed: () { Navigator.of(context).pop(); }, - child: Text( - TranslationBase.of(context).cancel, - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), ), ), ), @@ -574,15 +473,13 @@ class _DoctorProfileState extends State } double getRatingWidth(int patientNumber) { - var width = - (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; + var width = (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; return width; } getPatientData() async { if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); setState(() { print(data); widget.authUser = data; @@ -605,7 +502,7 @@ class _DoctorProfileState extends State dialog.showAlertDialog(context); } } else - AppToast.showErrorToast(message: "Please select Time Slot to continue"); + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); } navigateToLogin() { @@ -617,12 +514,15 @@ class _DoctorProfileState extends State Future navigateToBookConfirm(context) async { Navigator.push( - context, - FadePage( - page: BookConfirm( - doctor: widget.doctor, - isLiveCareAppointment: widget.isLiveCareAppointment, - selectedDate: DocAvailableAppointments.selectedDate, - selectedTime: DocAvailableAppointments.selectedTime))); + context, + FadePage( + page: BookConfirm( + doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, + selectedDate: DocAvailableAppointments.selectedDate, + selectedTime: DocAvailableAppointments.selectedTime, + ), + ), + ); } } diff --git a/lib/pages/BookAppointment/LaserBooking.dart b/lib/pages/BookAppointment/LaserBooking.dart new file mode 100644 index 00000000..942e5e18 --- /dev/null +++ b/lib/pages/BookAppointment/LaserBooking.dart @@ -0,0 +1,15 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class LaserBooking extends StatefulWidget { + @override + _LaserBookingState createState() => _LaserBookingState(); +} + +class _LaserBookingState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold(isShowDecPage: false, isShowAppBar: true, showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).laserClinic, body: Container()); + } +} diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index ff7224be..3c3c1402 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/nfc/nfc_reader_sheet.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -43,7 +44,6 @@ class _QRCodeState extends State { widget.authUser = new AuthenticatedUser(); NFC.isNDEFSupported.then((supported) { setState(() { - print("nfc supprted"); _supportsNFC = true; }); }); @@ -56,6 +56,8 @@ class _QRCodeState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).attendRegisterCode, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, body: SingleChildScrollView( child: Container( child: Column( @@ -83,15 +85,11 @@ class _QRCodeState extends State { border: Border.all(color: Colors.black), borderRadius: BorderRadius.circular(10), ), - child: Image.asset( - "assets/images/nfc/ic_nfc.png"), + child: Image.asset("assets/images/nfc/ic_nfc.png"), ), onTap: () { - showNfcReader(context, - onNcfScan: (String nfcId) { - Future.delayed( - const Duration(milliseconds: 100), - () { + showNfcReader(context, onNcfScan: (String nfcId) { + Future.delayed(const Duration(milliseconds: 100), () { sendNfcCheckInRequest(nfcId); }); }); @@ -125,23 +123,14 @@ class _QRCodeState extends State { child: Row( children: [ Container( - margin: - EdgeInsets.only(top: 10.0, left: 40.0, bottom: 10.0), - child: Image.asset( - "assets/images/new-design/device_icon.png", - width: MediaQuery.of(context).size.width / 3.4, - height: MediaQuery.of(context).size.width / 3.4), + margin: EdgeInsets.only(top: 10.0, left: 40.0, bottom: 10.0), + child: Image.asset("assets/images/new-design/device_icon.png", width: MediaQuery.of(context).size.width / 3.4, height: MediaQuery.of(context).size.width / 3.4), ), Expanded( child: Container( width: double.infinity, - margin: EdgeInsets.only( - top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(TranslationBase.of(context).scanQRHospital, - style: TextStyle( - color: Colors.red[700], - fontSize: 18.0, - fontWeight: FontWeight.bold)), + margin: EdgeInsets.only(top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text(TranslationBase.of(context).scanQRHospital, style: TextStyle(color: Colors.red[700], fontSize: 18.0, fontWeight: FontWeight.bold)), ), ), ], @@ -155,16 +144,11 @@ class _QRCodeState extends State { ), ), Container( - margin: EdgeInsets.only( - top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(TranslationBase.of(context).appoInfo, - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700], - fontWeight: FontWeight.bold)), + margin: EdgeInsets.only(top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text(TranslationBase.of(context).appoInfo, style: TextStyle(fontSize: 18.0, color: Colors.grey[700], fontWeight: FontWeight.bold)), ), Container( - margin: EdgeInsets.only(left: 20.0, bottom: 20.0), + margin: EdgeInsets.only(left: 20.0, bottom: 20.0, right: 20.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.grey[200], @@ -176,97 +160,32 @@ class _QRCodeState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only( - top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(widget.patientShareResponse.doctorNameObj, - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700], - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only( - bottom: 10.0, left: 20.0, right: 20.0), - child: Text( - getDoctorSpeciality( - widget.patientShareResponse.doctorSpeciality), - style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + margin: EdgeInsets.only(top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text(widget.patientShareResponse.doctorNameObj, style: TextStyle(fontSize: 18.0, color: Colors.grey[700], fontWeight: FontWeight.bold)), ), + if (getDoctorSpeciality(widget.patientShareResponse.doctorSpeciality) != "null\n") + Container( + margin: EdgeInsets.only(bottom: 10.0, left: 20.0, right: 20.0), + child: Text(getDoctorSpeciality(widget.patientShareResponse.doctorSpeciality), style: TextStyle(fontSize: 18.0, color: Colors.grey[700])), + ), Container( - margin: EdgeInsets.only( - top: 0.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(widget.patientShareResponse.projectName, - style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + margin: EdgeInsets.only(top: 0.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text(widget.patientShareResponse.projectName, style: TextStyle(fontSize: 18.0, color: Colors.grey[700])), ), Container( - margin: EdgeInsets.only( - top: 0.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text( - getDate(widget.patientShareResponse.appointmentDate), - style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + margin: EdgeInsets.only(top: 0.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text(getDate(widget.patientShareResponse.appointmentDate), style: TextStyle(fontSize: 18.0, color: Colors.grey[700])), ), ], ), ), Container( - margin: EdgeInsets.zero, + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 15.0), alignment: Alignment.bottomCenter, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { -// navigateToQR(context); -// getAppoQR(context); - sendEmail(); - }, - child: Text( - TranslationBase.of(context).sendEmail.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), - ], - ), - ), - Container( - alignment: Alignment.bottomCenter, - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(bottom: 20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - navigateToHome(context); - }, - child: Text( - TranslationBase.of(context).close.toUpperCase(), - style: TextStyle(fontSize: 18.0)), - ), - ), + DefaultButton(TranslationBase.of(context).sendEmail.toUpperCase(), () => {sendEmail()}) ], ), ), @@ -281,8 +200,7 @@ class _QRCodeState extends State { DoctorsListService service = new DoctorsListService(); if (await widget.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await widget.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await widget.sharedPref.getObject(USER_PROFILE)); setState(() { widget.authUser = data; }); @@ -290,24 +208,14 @@ class _QRCodeState extends State { ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: "Send a copy of this QR to the email " + - widget.authUser.emailAddress + - "?", + confirmMessage: "Send a copy of this QR to the email " + widget.authUser.emailAddress + "?", okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () { GifLoaderDialogUtils.showMyDialog(context); service - .sendAppointmentQREmail( - widget.authUser.emailAddress, - widget.patientShareResponse.appointmentDate, - widget.patientShareResponse.appointmentNo.toString(), - widget.patientShareResponse.doctorNameObj, - widget.patientShareResponse.projectName, - widget.appoQR, - getDoctorSpeciality( - widget.patientShareResponse.doctorSpeciality), - context) + .sendAppointmentQREmail(widget.authUser.emailAddress, widget.patientShareResponse.appointmentDate, widget.patientShareResponse.appointmentNo.toString(), + widget.patientShareResponse.doctorNameObj, widget.patientShareResponse.projectName, widget.appoQR, getDoctorSpeciality(widget.patientShareResponse.doctorSpeciality), context) .then((res) { GifLoaderDialogUtils.hideDialog(context); ConfirmDialog.closeAlertDialog(context); @@ -326,8 +234,7 @@ class _QRCodeState extends State { Navigator.of(context).pushNamed(HOME); } - getPatientShare(context, String appointmentNo, int clinicID, int projectID, - DoctorList docObject) {} + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) {} String getDate(String appoDate) { var appoDateFormatted = ""; @@ -367,10 +274,7 @@ class _QRCodeState extends State { DoctorsListService service = new DoctorsListService(); - service - .sendCheckinNfcRequest(widget.patientShareResponse.appointmentNo, nfcId, - widget.patientShareResponse.projectID, context) - .then((res) { + service.sendCheckinNfcRequest(widget.patientShareResponse.appointmentNo, nfcId, widget.patientShareResponse.projectID, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 6dee1076..d4942ccf 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,17 +1,20 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'components/SearchByClinic.dart'; class Search extends StatefulWidget { final int type; final List clnicIds; + Function onBackClick; - Search({this.type = 0, this.clnicIds}); + Search({this.type = 0, this.clnicIds, this.onBackClick}); @override _SearchState createState() => _SearchState(); @@ -22,8 +25,7 @@ class _SearchState extends State with TickerProviderStateMixin { @override void initState() { - _tabController = - new TabController(length: 2, vsync: this, initialIndex: widget.type); + _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); super.initState(); } @@ -31,43 +33,50 @@ class _SearchState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { AppGlobal.context = context; + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowAppBar: true, - isShowDecPage: false, - appBarTitle: TranslationBase.of(context).bookAppo, - body: Container( - child: Column( - children: [ - TabBar( - tabs: [ - Tab( - child: Text(TranslationBase.of(context).clinicName, - style: TextStyle(color: Colors.black))), - Tab( - child: Text(TranslationBase.of(context).doctorName, - style: TextStyle(color: Colors.black)), - ) - ], - controller: _tabController, - ), - Divider( - color: Colors.grey[600], - thickness: 0.5, - ), - Expanded( - child: new TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - SearchByClinic( - clnicIds: widget.clnicIds, - ), - SearchByDoctor() - ], - controller: _tabController, - ), - ) - ], + isShowAppBar: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bookAppo, + backgroundColor: Color(0xFFF7F7F7), + onTap: widget.onBackClick, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).clinicName), Text(TranslationBase.of(context).doctorName)], ), - )); + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + SearchByClinic(clnicIds: widget.clnicIds), + SearchByDoctor(), + ], + controller: _tabController, + ), + ) + ], + ), + ); } } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index e5f219f0..0a654e22 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; // import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; @@ -11,8 +12,7 @@ class SearchResults extends StatefulWidget { List patientDoctorAppointmentListHospital; bool isLiveCareAppointment; - SearchResults( - {@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment}); + SearchResults({@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment}); @override _SearchResultsState createState() => _SearchResultsState(); @@ -28,40 +28,38 @@ class _SearchResultsState extends State { appBarTitle: TranslationBase.of(context).bookAppo, isShowDecPage: false, isShowAppBar: true, - body: Container( - margin: EdgeInsets.all(10.0), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - widget.patientDoctorAppointmentListHospital.length, - (index) => AppExpandableNotifier( - // isExpand: index == 0 ? true : false, - title: widget.patientDoctorAppointmentListHospital[index] - .filterName + - " - " + - widget.patientDoctorAppointmentListHospital[index] - .distanceInKMs + - " " + - TranslationBase.of(context).km, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - .patientDoctorAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return DoctorView( - doctor: doctor, - isLiveCareAppointment: widget.isLiveCareAppointment, - ); - }).toList(), - )), - ) - ], - ), - ), + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: ListView.separated( + physics: BouncingScrollPhysics(), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + title: (widget.patientDoctorAppointmentListHospital[index].distanceInKMs != "0") ? widget.patientDoctorAppointmentListHospital[index].filterName + " - " + widget.patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km : widget.patientDoctorAppointmentListHospital[index].filterName, + isTitleSingleLine: false, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21), + itemBuilder: (context, _index) { + //widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList[_index].speciality = null; + return DoctorView( + doctor: widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList[_index], + isLiveCareAppointment: widget.isLiveCareAppointment, + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList.length), + ); + }, + itemCount: widget.patientDoctorAppointmentListHospital.length, ), ); } diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart new file mode 100644 index 00000000..39f1648f --- /dev/null +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -0,0 +1,234 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.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_inappwebview/flutter_inappwebview.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import 'BookSuccess.dart'; + +class BookReminderPage extends StatefulWidget { + PatientShareResponse patientShareResponse; + DoctorList docObject; + + String appoDateFormatted; + String appoTimeFormatted; + DateTime dateTime; + + BookReminderPage({@required this.patientShareResponse, @required this.docObject, @required this.appoDateFormatted, @required this.appoTimeFormatted, this.dateTime}); + + @override + _BookReminderPageState createState() => _BookReminderPageState(); +} + +class _BookReminderPageState extends State { + MyInAppBrowser browser; + + final ChromeSafariBrowser chromeBrowser = new MyChromeSafariBrowser(new MyInAppBrowser()); + + String selectedTime; + bool isSuccessShow = true; + + @override + void initState() { + // TODO: implement initState + super.initState(); + Future.delayed(const Duration(seconds: 2), () { +// Here you can write your code + + setState(() { + isSuccessShow = false; + }); + }); + } + + @override + Widget build(BuildContext context) { + // print("selectedTime "+selectedTime??""); + print("appointmentNo1 " + widget.patientShareResponse.appointmentNo.toString() ?? ""); + return AppScaffold( + appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.docObject.name, + widget.docObject.doctorID, + widget.docObject.doctorImageURL, + widget.docObject.speciality, + "", + widget.docObject.projectName, + null, + null, + widget.docObject.nationalityFlagURL, + widget.docObject.doctorRate, + null, + widget.docObject.noOfPatientsRate, + "", + ), + isNeedToShowButton: false, + ), + Expanded( + child: Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.only(bottom: 70), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + Icons.notifications_active, + size: 60, + ), + Text( + TranslationBase.of(context).appointmentCalendar, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + mFlex(1), + if (isSuccessShow) + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.all(10), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + circularAviator( + 30, + icon: Icons.done_rounded, + iconColor: Colors.white, + bcColor: CustomColors.green, + brColor: CustomColors.green, + ), + mWidth(10), + Expanded( + child: AutoSizeText( + TranslationBase.of(context).appointmentSuccess, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.65, + ), + ), + ) + ], + ), + ), + ), + ), + ], + ), + ), + ), + ), + ], + ), + bottomSheet: Container( + color: CustomColors.appBackgroudGreyColor, + child: Container( + color: CustomColors.white, + margin: EdgeInsets.all(14), + height: 45.0, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFEAEAEA), + onPressed: () { + navigateToBookSuccess(context); + }, + child: Text(TranslationBase.of(context).no, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), + ), + ), + ), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: CustomColors.green, + onPressed: () async { + print(widget.patientShareResponse.appointmentNo); + showReminderDialog( + context, + widget.dateTime, + widget.docObject.name, + widget.patientShareResponse.appointmentNo.toString(), + widget.appoDateFormatted, + widget.appoTimeFormatted, + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + navigateToBookSuccess(context); + }, + ); + }, + child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), + ), + ), + ), + ], + ), + ), + ), + ); + } + + Future navigateToBookSuccess(BuildContext context) async { + Navigator.push( + context, + FadePage( + page: + BookSuccess(docObject: widget.docObject, patientShareResponse: widget.patientShareResponse, appoDateFormatted: widget.appoDateFormatted, appoTimeFormatted: widget.appoTimeFormatted))); + } + + Future> requestPermissions() async { + var permissionResults = [Permission.calendar].request(); + return permissionResults; + } +} diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index f5c0f81e..8e576c99 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -3,13 +3,16 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import 'package:table_calendar/table_calendar.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -22,18 +25,14 @@ class DocAvailableAppointments extends StatefulWidget { static String selectedTime; bool isLiveCareAppointment; final dynamic doctorSchedule; - DocAvailableAppointments( - {@required this.doctor, - this.doctorSchedule, - @required this.isLiveCareAppointment}); + + DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment}); @override - _DocAvailableAppointmentsState createState() => - _DocAvailableAppointmentsState(); + _DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState(); } -class _DocAvailableAppointmentsState extends State - with TickerProviderStateMixin { +class _DocAvailableAppointmentsState extends State with TickerProviderStateMixin { Map _events; AnimationController _animationController; CalendarController _calendarController; @@ -55,6 +54,15 @@ class _DocAvailableAppointmentsState extends State var language; + @override + void didUpdateWidget(covariant DocAvailableAppointments oldWidget) { + if (oldWidget.doctorSchedule != widget.doctorSchedule) { + _onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])); + _calendarController.selectedDate = DateUtil.convertStringToDate(widget.doctorSchedule['Date']); + } + super.didUpdateWidget(oldWidget); + } + @override void initState() { // TODO: implement initState @@ -70,7 +78,7 @@ class _DocAvailableAppointmentsState extends State WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (widget.isLiveCareAppointment) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); @@ -93,66 +101,60 @@ class _DocAvailableAppointmentsState extends State super.dispose(); } - void _onDaySelected(DateTime day, List events) { + void _onDaySelected(DateTime day) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); setState(() { - this.selectedDate = - DateUtil.getWeekDayMonthDayYearDateFormatted(day, language); + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, language); openTimeSlotsPickerForDate(day, docFreeSlots); DocAvailableAppointments.selectedDate = formatter.format(day); - print(DocAvailableAppointments.selectedDate); + _calendarController.selectedDate = day; + print(_calendarController.selectedDate); }); } - void _onVisibleDaysChanged( - DateTime first, DateTime last, CalendarFormat format) { - print('CALLBACK: _onVisibleDaysChanged'); - } - - void _onCalendarCreated( - DateTime first, DateTime last, CalendarFormat format) {} - @override Widget build(BuildContext context) { return SingleChildScrollView( child: Container( - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - margin: EdgeInsets.all(20.0), - padding: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Column( mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(selectedDate, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), - Container( - height: 50, - margin: EdgeInsets.all(20.0), - child: ListView.builder( - controller: _scrollController, - scrollDirection: Axis.horizontal, - itemCount: dayEvents.length, - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.only(right: 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0), - side: BorderSide( - color: Color(0xff76cfb7), //Color of the border - style: BorderStyle.solid, //Style of the border - width: 1.5, //width of the border - ), - ), - minWidth: MediaQuery.of(context).size.width * 0.2, - child: index == selectedButtonIndex - ? getSelectedButton(index) - : getNormalButton(index)), - ); - }, - ), - ), _buildTableCalendarWithBuilders(), + Padding( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16), + child: Text(selectedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + ), + DocAvailableAppointments.areSlotsAvailable + ? Container( + height: 40, + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 16 : 5.0, left: index == 0 ? 16 : 5), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: MediaQuery.of(context).size.width * 0.18, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), + ); + }, + ), + ) + : Center( + child: Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0), + child: Text(TranslationBase.of(context).noSlotsError, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.grey)), + )), ], ), ), @@ -160,118 +162,60 @@ class _DocAvailableAppointmentsState extends State } Widget _buildTableCalendarWithBuilders() { - return TableCalendar( - locale: language == "en" ? 'en_US' : 'ar_SA', - calendarController: _calendarController, - events: _events, - initialCalendarFormat: CalendarFormat.month, - startDay: DateTime.now(), - formatAnimation: FormatAnimation.slide, - startingDayOfWeek: StartingDayOfWeek.sunday, - weekendDays: [DateTime.friday, DateTime.saturday], - availableGestures: AvailableGestures.horizontalSwipe, - availableCalendarFormats: const { - CalendarFormat.month: '', - CalendarFormat.week: '', - }, - calendarStyle: CalendarStyle( - outsideDaysVisible: false, - weekendStyle: TextStyle().copyWith(color: Colors.blue[800]), - holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), - ), - daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), - weekdayStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), - ), - headerStyle: HeaderStyle( - centerHeaderTitle: true, - formatButtonVisible: false, - ), - builders: CalendarBuilders( - selectedDayBuilder: (context, date, _) { - return FadeTransition( - opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), - child: Container( - margin: const EdgeInsets.all(4.0), - padding: const EdgeInsets.only(top: 5.0, left: 5.0), - color: Colors.transparent, - width: 0, - height: 0, - child: Text( - '${date.day}', - style: TextStyle().copyWith(fontSize: 16.0), - ), - ), - ); - }, - todayDayBuilder: (context, date, _) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Colors.green[400] - : _calendarController.isToday(date) - ? Colors.transparent - : Color(0xff76cfb7), - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, - ), - ), + return Container( + decoration: cardRadius(12), + margin: EdgeInsets.all(16), + clipBehavior: Clip.antiAlias, + child: Padding( + padding: const EdgeInsets.only(bottom: 12), + child: Container( + child: SfCalendar( + controller: _calendarController, + minDate: DateTime.now(), + showNavigationArrow: true, + headerStyle: CalendarHeaderStyle(textAlign: TextAlign.center, textStyle: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46)), + viewHeaderStyle: ViewHeaderStyle(dayTextStyle: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black)), + view: CalendarView.month, + todayHighlightColor: CustomColors.green, + selectionDecoration: containerColorRadiusBorderWidthCircular(Colors.transparent, 4, CustomColors.green, 2.5), + cellBorderColor: Colors.white, + dataSource: MeetingDataSource(_getDataSource()), + monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date); + }, ), - ); - }, - markersBuilder: (context, date, events, _) { - final children = []; - if (events.isNotEmpty) { - children.add( - Positioned( - right: 4, - bottom: 4, - child: _buildEventsMarker(date, events), - ), - ); - } - - return children; - }, - ), - onDaySelected: (date, event, _) { - _onDaySelected(date, event); - _animationController.forward(from: 0.0); - }, - onVisibleDaysChanged: _onVisibleDaysChanged, - onCalendarCreated: _onCalendarCreated, - ); + ), + )); + } + + List _getDataSource() { + final List meetings = []; + + _events.forEach((key, value) { + final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0); + final DateTime endTime = startTime.add(const Duration(hours: 2)); + meetings.add(Meeting("", startTime, endTime, CustomColors.green, false)); + }); + return meetings; } openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { dayEvents.clear(); - DateTime dateStartObj = new DateTime( - dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); freeSlots.forEach((v) { if (v.start == dateStartObj) dayEvents.add(v); }); setState(() { - if (dayEvents.length != 0) + if (dayEvents.length != 0) { DocAvailableAppointments.areSlotsAvailable = true; - else + selectedButtonIndex = 0; + DocAvailableAppointments.selectedTime = dayEvents[selectedButtonIndex].isoTime; + } else DocAvailableAppointments.areSlotsAvailable = false; - - selectedButtonIndex = 0; - - DocAvailableAppointments.selectedTime = - dayEvents[selectedButtonIndex].isoTime; - -// _scrollController.animateTo(0.0, duration: new Duration(seconds: 1), curve: Curves.ease); }); } @@ -284,30 +228,23 @@ class _DocAvailableAppointmentsState extends State for (var i = 0; i < freeSlotsResponse.length; i++) { date = DateUtil.convertStringToDate(freeSlotsResponse[i]); 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)); + 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); + _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - DocAvailableAppointments.selectedDate = dateFormatter - .format(DateUtil.convertStringToDate(freeSlotsResponse[0])); - selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate(freeSlotsResponse[0]), language); + DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); + selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language); selectedDateJSON = freeSlotsResponse[0]; }); - openTimeSlotsPickerForDate( - DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); - _calendarController - .setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON)); + openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); return _eventsParsed; } Widget getNormalButton(int index) { return RaisedButton( color: Colors.white, + elevation: 0, textColor: new Color(0xFF60686b), onPressed: () { setState(() { @@ -316,15 +253,16 @@ class _DocAvailableAppointmentsState extends State print(DocAvailableAppointments.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), ); } Widget getSelectedButton(int index) { return RaisedButton( - color: Color(0xff76cfb7), //Color of the border + color: CustomColors.green, + //Color of the border textColor: Colors.white, + elevation: 0, onPressed: () { setState(() { selectedButtonIndex = index; @@ -332,18 +270,14 @@ class _DocAvailableAppointmentsState extends State print(DocAvailableAppointments.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0)), ); } getDoctorFreeSlots(context, DoctorList docObject) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, - docObject.projectID, context) - .then((res) { + service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { @@ -357,20 +291,12 @@ class _DocAvailableAppointmentsState extends State _events.clear(), _events = value, if (widget.doctorSchedule != null) - { - _calendarController.setSelectedDay( - DateUtil.convertStringToDate( - widget.doctorSchedule['Date']), - isProgrammatic: true), - _onDaySelected( - DateUtil.convertStringToDate( - widget.doctorSchedule['Date']), - List()) - } + {_onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])), _calendarController.selectedDate = DateUtil.convertStringToDate(widget.doctorSchedule['Date'])} }); }); } else { DocAvailableAppointments.areAppointmentsAvailable = false; + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -385,17 +311,12 @@ class _DocAvailableAppointmentsState extends State getDoctorScheduledFreeSlots(context, DoctorList docObject) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, - docObject.projectID, docObject.serviceID, context) - .then((res) { + service.getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['PatientER_DoctorFreeSlots'].length != 0) { DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['PatientER_DoctorFreeSlots']; - print("res['PatientER_DoctorFreeSlots']"); - print(res['PatientER_DoctorFreeSlots'].length); _getJSONSlots().then((value) => { setState(() => {_events.clear(), _events = value}) }); @@ -413,34 +334,59 @@ class _DocAvailableAppointmentsState extends State } getCurrentLanguage() async { - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { this.language = languageID; }); } +} - Widget _buildEventsMarker(DateTime date, List events) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Color(0xffB8382C) - : _calendarController.isToday(date) - ? Colors.brown[300] - : Color(0xff76cfb7), - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, - ), - ), - ), - ); +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List source) { + appointments = source; + } + + @override + DateTime getStartTime(int index) { + return _getMeetingData(index).from; + } + + @override + DateTime getEndTime(int index) { + return _getMeetingData(index).to; + } + + @override + String getSubject(int index) { + return _getMeetingData(index).eventName; + } + + @override + Color getColor(int index) { + return _getMeetingData(index).background; + } + + @override + bool isAllDay(int index) { + return _getMeetingData(index).isAllDay; + } + + Meeting _getMeetingData(int index) { + final dynamic meeting = appointments[index]; + Meeting meetingData; + if (meeting is Meeting) { + meetingData = meeting; + } + return meetingData; } } + +class Meeting { + Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay); + + String eventName; + DateTime from; + DateTime to; + Color background; + bool isAllDay; +} diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index 89b9e4d0..041a021f 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -1,8 +1,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; class DoctorInformation extends StatelessWidget { DoctorProfileList docProfileList; @@ -16,138 +15,107 @@ class DoctorInformation extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - AppExpandableNotifier( - isExpand: true, - headerWidget: Container( - margin: EdgeInsets.all(10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_information_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text(TranslationBase.of(context).docInfo, - style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], - ), - ), - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), - child: Table( - children: [ - TableRow(children: [ - TableCell( - child: _getHeadingText( - TranslationBase.of(context).gender)), - TableCell( - child: _getHeadingText( - TranslationBase.of(context).nationality)), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - docProfileList.genderDescription)), - TableCell( - child: _getNormalTextWithIcon( - docProfileList.nationalityName, - docProfileList.nationalityFlagURL)), - ]), - ], - ), - ), - Divider( - color: Colors.grey[400], + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).docInfo, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(10), + Row( + children: [ + Text( + TranslationBase.of(context).gender + ":", + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + ), + mWidth(2), + Text( + docProfileList.genderDescription, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).nationality + ":", + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + ), + mWidth(2), + Text( + docProfileList.nationalityName, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ], ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _getHeadingText(TranslationBase.of(context).clinic), - _getNormalText(docProfileList.clinicDescription) - ], - ), - ) - ], - ), - ), - // ), - AppExpandableNotifier( - isExpand: true, - headerWidget: Container( - margin: EdgeInsets.all(10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_qualification_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text(TranslationBase.of(context).docQualifications, - style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], ), ), - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 10.0, 5.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - _getNormalText(docProfileList.doctorProfileInfo) - ], - ), - ) - ], - ), ), - ], - ), - ); - } - - _getHeadingText(text) { - return Text(text, - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.bold, - letterSpacing: 0.5, - color: Colors.grey[800])); - } - - _getNormalText(text) { - return Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(text, - maxLines: 16, - style: TextStyle( - fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), - ); - } - - _getNormalTextWithIcon(String text, icon) { - return Container( - margin: EdgeInsets.only(top: 5.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Text(text.trim(), - style: TextStyle( - fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), + mHeight(8), Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: Image.network(icon, width: 18.0, height: 18.0), + width: double.infinity, + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).docQualifications, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(10), + Text( + docProfileList.doctorProfileInfo, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + ), ), ], ), diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart new file mode 100644 index 00000000..b1b8a154 --- /dev/null +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -0,0 +1,452 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/laser_body_parts_data.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class LaserClinic extends StatefulWidget { + LaserClinic({Key key}) : super(key: key); + + @override + _LaserClinicState createState() { + return _LaserClinicState(); + } +} + +class _LaserClinicState extends State with SingleTickerProviderStateMixin { + List _laserCategoryList = [1, 2, 11]; + List _selectedBodyPartList = []; + bool _isFullBody = false; + LaserBodyPart fullBody; + int _selectedCategoryIndex = 0; + List laserBodyPartsList = []; + + TabController _tabController; + int _duration = 0; + + List maleLaserCategory = []; + List femaleLaserCategory = []; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(() { + if (_tabController.indexIsChanging) { + } else { + _selectedBodyPartList = List(); + laserBodyPartsList = List(); + _selectedCategoryIndex = 0; + setState(() {}); + if (_tabController.index == 0) { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + } else { + callLaserBodyPartsAPI(femaleLaserCategory[_selectedCategoryIndex].laserCategoryID); + } + } + }); + Future.delayed(Duration.zero, () { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }); + } + + callLaserBodyPartsAPI(int laserCategoryId) async { + GifLoaderDialogUtils.showMyDialog(context); + + DoctorsListService service = new DoctorsListService(); + service.getLaserBodyPartsList(laserCategoryId).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { + List _tempList = List(); + res['Laser_GetBodyPartsByCategoryList'].forEach((v) { + _tempList.add(LaserBodyPart.fromJson(v)); + }); + if (_tempList[0].category == 1 || _tempList[0].category == 11 || _tempList[0].category == 2 || _tempList[0].category == 10) { + fullBody = _tempList[0]; + _tempList.removeAt(0); + } + laserBodyPartsList = _tempList; + } else {} + setState(() {}); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + bool lastIndexIsFirst = false; + bool isLastIndexIsBack = false; + ProjectViewModel projectViewModel; + + bool get isMale => _tabController.index == 0; + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + maleLaserCategory = [ + LaserCategoryType(1, TranslationBase.of(context).bodyString), + LaserCategoryType(2, TranslationBase.of(context).face), + LaserCategoryType(11, TranslationBase.of(context).retouch), + ]; + femaleLaserCategory = [ + LaserCategoryType(1, TranslationBase.of(context).bodyString), + LaserCategoryType(2, TranslationBase.of(context).face), + LaserCategoryType(10, TranslationBase.of(context).bikini), + LaserCategoryType(11, TranslationBase.of(context).retouch), + ]; + return AppScaffold( + appBarTitle: TranslationBase.of(context).laserClinic, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: Color(0xfff7f7f7), + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).male), Text(TranslationBase.of(context).female)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [male(), female()], + ), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).totalMinutes + ":", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, + ), + ), + Text( + "${getDuration()} / 90", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + ], + ), + ), + Expanded( + child: DefaultButton( + TranslationBase.of(context).continues, + () {}, + color: Color(0xff359846), + ), + ), + ], + ).insideContainer, + ], + ), + ); + } + + int getDuration() { + int duration = 0; + if (_isFullBody) { + _duration = int.parse(fullBody.timeDuration); + return _duration; + } + + var lowerUpperLegsList = _selectedBodyPartList.where((element) => element.mappingCode == "47" || element.mappingCode == "48")?.toList() ?? []; + var upperLowerArmsList = _selectedBodyPartList.where((element) => element.mappingCode == "40" || element.mappingCode == "41")?.toList() ?? []; + + if (_selectedBodyPartList.length > 0) { + duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration)); + } + print("duration:$duration"); + if (lowerUpperLegsList.length == 2) { + duration -= 30; + } + print("duration1:$duration"); + if (upperLowerArmsList.length == 2) { + duration -= 15; + } + print("duration2:$duration"); + // for (int i = 0; i < _selectedBodyPartList.length; i++) { + // if ( + // + // (lowerUpperLegsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "47" || _selectedBodyPartList[i].mappingCode == "48")) || + // (upperLowerArmsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "40" || _selectedBodyPartList[i].mappingCode == "41")) + // + // + // ) { + // print("duration:$duration"); + // + // duration += 15; + // print("duration1:$duration"); + // } else { + // duration += int.parse(_selectedBodyPartList[i].timeDuration); + // } + // } + print(duration); + _duration = duration; + return duration; + } + + Widget laserCategoryWidget(List list, VoidCallback onTap) { + return SizedBox( + height: 40, + child: ListView.separated( + itemCount: list.length, + physics: BouncingScrollPhysics(), + scrollDirection: Axis.horizontal, + separatorBuilder: (cxt, index) => SizedBox(width: 8), + itemBuilder: (cxt, index) { + return InkWell( + onTap: () { + // setState(() { + _selectedCategoryIndex = index; + // }); + onTap(); + }, + child: Container( + decoration: BoxDecoration( + color: _selectedCategoryIndex == index ? Color(0xffD02127) : Colors.white, + borderRadius: BorderRadius.circular(36), + border: Border.all( + width: 1, + color: _selectedCategoryIndex == index ? Colors.transparent : Color(0xffEAEAEA), + ), + ), + padding: EdgeInsets.symmetric(vertical: 11, horizontal: 26), + child: Text( + list[index].title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: _selectedCategoryIndex == index ? Colors.white : Color(0xff535353), + letterSpacing: -0.48, + ), + ), + ), + ); + }, + ), + ); + } + + Widget bodyPartsGridView() { + return Container( + padding: EdgeInsets.symmetric(vertical: 21, horizontal: 14), + margin: EdgeInsets.only(top: 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (fullBody != null) + Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Theme( + data: Theme.of(context).copyWith( + unselectedWidgetColor: Color(0xffEAEAEA), + ), + child: Checkbox( + value: _isFullBody, + onChanged: (value) { + setState(() { + if (value) { + _selectedBodyPartList.clear(); + } + _isFullBody = !_isFullBody; + }); + }, + activeColor: Color(0xffD02127), + ), + ), + ), + SizedBox(width: 12), + Text( + projectViewModel.isArabic ? fullBody.bodyPartN : fullBody.bodyPart, + style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.6, height: 21 / 14), + ), + ], + ), + GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 85 / 107, crossAxisSpacing: 4, mainAxisSpacing: 21), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: laserBodyPartsList.length, + padding: fullBody != null ? EdgeInsets.only(top: 16) : EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + bool _isSelected = _selectedBodyPartList.any((file) => file.id == laserBodyPartsList[index].id); + return InkWell( + onTap: _isFullBody + ? null + : () { + if (_duration >= 90) { + if (_isSelected) { + _selectedBodyPartList.removeWhere((element) => element.id == laserBodyPartsList[index].id); + + // _selectedBodyPartList.remove(laserBodyPartsList[index]); + setState(() {}); + return; + } + AppToast.showToast(message: TranslationBase.of(context).laserMaxLimitReach); + return; + } + if (_isSelected) { + _selectedBodyPartList.removeWhere((element) => element.id == laserBodyPartsList[index].id); + // _selectedBodyPartList.remove(laserBodyPartsList[index]); + } else { + if (_duration + int.parse(laserBodyPartsList[index].timeDuration) > 90) { + AppToast.showToast(message: TranslationBase.of(context).laserMaxLimitReach); + return; + } + _selectedBodyPartList.add(laserBodyPartsList[index]); + } + setState(() {}); + }, + child: AnimatedOpacity( + opacity: _isFullBody ? 0.25 : 1.0, + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 97 / 97, + child: FittedBox( + fit: BoxFit.fitWidth, + child: Stack( + alignment: Alignment.topRight, + children: [ + Container( + margin: EdgeInsets.only(top: 5, right: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + border: Border.all(color: _isSelected ? Color(0xffD02127) : Color(0xffEAEAEA), width: 2), + ), + child: LaserBodyParts() + .getCategoryImage(isMale, (isMale ? maleLaserCategory : femaleLaserCategory)[_selectedCategoryIndex].laserCategoryID, laserBodyPartsList[index].mappingCode), + ), + if (_isSelected) + Container( + width: 18, + height: 18, + child: Icon(Icons.done, color: Colors.white, size: 12), + decoration: BoxDecoration( + color: Color(0xffD02127), + borderRadius: BorderRadius.circular(30.0), + ), + ), + ], + ), + ), + ), + SizedBox(height: 6), + Expanded( + child: Text( + projectViewModel.isArabic ? laserBodyPartsList[index].bodyPartN : laserBodyPartsList[index].bodyPart, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.48, + ), + ), + ), + ], + ), + ), + ); + }, + ), + ], + ), + ); + } + + Widget male() { + return ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + laserCategoryWidget(maleLaserCategory, () { + callLaserBodyPartsAPI(maleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }), + if (laserBodyPartsList.isNotEmpty) bodyPartsGridView() + ], + ); + } + + Widget female() { + return ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + laserCategoryWidget(femaleLaserCategory, () { + callLaserBodyPartsAPI(femaleLaserCategory[_selectedCategoryIndex].laserCategoryID); + }), + if (laserBodyPartsList.isNotEmpty) bodyPartsGridView() + ], + ); + } +} + +class LaserCategoryType { + int laserCategoryID; + String title; + + LaserCategoryType(this.laserCategoryID, this.title); +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index fb646728..1703f183 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,24 +1,31 @@ import "dart:collection"; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/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_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'; import 'LiveCareBookAppointment.dart'; class SearchByClinic extends StatefulWidget { @@ -47,6 +54,13 @@ class _SearchByClinicState extends State { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); + final GlobalKey clinicDropdownKey = GlobalKey(); + final GlobalKey projectDropdownKey = GlobalKey(); + TextEditingController ageController = new TextEditingController(); + ProjectViewModel projectViewModel; + + String radioValue = null; + @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); @@ -55,126 +69,428 @@ class _SearchByClinicState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + if (projectViewModel.isLogin) { + if (radioValue == null) { + if (projectViewModel.user.gender == 1) { + radioValue = TranslationBase.of(context).male; + } else { + radioValue = TranslationBase.of(context).female; + } + } + } else if (radioValue == null) { + radioValue = TranslationBase.of(context).female; + } + if (ageController.text.isEmpty) { + ageController.text = projectViewModel.isLogin ? projectViewModel.user.age.toString() : ""; + ageController.selection = TextSelection.fromPosition(TextPosition(offset: ageController.text.length)); + } + return Container( - margin: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Checkbox( - activeColor: new Color(0xFF40ACC9), - value: nearestAppo, - onChanged: (bool value) { - setState(() { - nearestAppo = value; - print(nearestAppo); - if (nearestAppo) - getProjectsList(); - else - isProjectLoaded = false; - }); - }, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (projectViewModel.isLogin) + Column( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + ), + child: Text( + TranslationBase + .of(context) + .doctorFilter, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + ), + mHeight(30), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Text( + TranslationBase + .of(context) + .gender, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + ), + ), + Container( + padding: EdgeInsets.only(left: 6, right: 6), + child: Row( + children: [ + Flexible( + child: Row( + children: [ + Radio( + value: TranslationBase + .of(context) + .female, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase + .of(context) + .female, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), + Flexible( + child: Row( + children: [ + Radio( + value: TranslationBase + .of(context) + .male, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase + .of(context) + .male, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), + ], + ), + ), + ], + ), + Container( + child: inputWidget("Age", "", ageController), + margin: EdgeInsets.only(left: 20, right: 20), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 6, right: 6, top: 16), + child: Row( + children: [ + Checkbox( + activeColor: CustomColors.accentColor, + value: nearestAppo, + onChanged: (bool value) { + setState(() { + nearestAppo = value; + print(nearestAppo); + if (nearestAppo) + getProjectsList(); + else + isProjectLoaded = false; + }); + }, + ), + Text(TranslationBase + .of(context) + .nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), + ], ), - Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), - ], - ), - widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: clinicsList.map((result) { - return RoundedContainer( - child: ListTile( - onTap: () { - // setState(() { - dropdownValue = result.clinicID.toString(); + ), + widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: clinicsList.map((result) { + return RoundedContainer( + child: ListTile( + onTap: () { + // setState(() { + dropdownValue = result.clinicID.toString(); setState(() { if (!isDentalSelectedAndSupported()) { projectDropdownValue = ""; getDoctorsList(context); } else {} }); - }, - title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); - }).toList()) - : Container( - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey[400], - width: 1.0, - ), - borderRadius: BorderRadius.circular(10), - ), - // margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0), - padding: EdgeInsets.all(8.0), - width: MediaQuery.of(context).size.width, - child: DropdownButtonHideUnderline( - child: DropdownButton( - hint: new Text(TranslationBase.of(context).selectClinic), - value: dropdownValue, - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString() + "-" + item.isLiveCareClinicAndOnline.toString() + "-" + item.liveCareClinicID.toString() + "-" + item.liveCareServiceID.toString(), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(item.clinicDescription), - item.isLiveCareClinicAndOnline ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 15, width: 15, fit: BoxFit.cover) : Container(), - ]), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - print(newValue); - dropdownValue = newValue; - if (!isDentalSelectedAndSupported() && !nearestAppo) { - projectDropdownValue = ""; - getDoctorsList(context); - } else { - print("Dental"); - } - }); - }, + }, + title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); + }).toList()) + : InkWell( + onTap: () { + // dropdownKey.currentState; + openDropdown(clinicDropdownKey); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + 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) + .selectClinic, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + onTap: () { + print("Clicked"); + }, + key: clinicDropdownKey, + hint: new Text( + TranslationBase + .of(context) + .selectClinic, + ), + value: dropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + items: clinicsList.map((item) { + return new DropdownMenuItem( + value: item.clinicID.toString() + + "-" + + item.isLiveCareClinicAndOnline.toString() + + "-" + + item.liveCareClinicID.toString() + + "-" + + item.liveCareServiceID.toString(), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text(item.clinicDescription), + item.isLiveCareClinicAndOnline + ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 12, width: 12, fit: BoxFit.cover) + : Container(), + ]), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + print(newValue); + dropdownValue = newValue; + if (dropdownValue == "253-false-0-0") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else + if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } else { + print("Dental"); + } + }); + }, + ), + ), + ), + ], + ), ), + Icon(Icons.keyboard_arrow_down), + ], + ), + ), + ), + mHeight(20), + isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded) + ? InkWell( + onTap: () { + openDropdown(projectDropdownKey); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + 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).selectHospital, + 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: projectDropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString(), + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + getDoctorsList(context); + }); + }, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], )), - isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded) - ? Container( - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey[400], - width: 1.0, + ) + : Container(), + ], + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - borderRadius: BorderRadius.circular(10), ), - padding: EdgeInsets.all(8.0), - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.only(top: 15.0), - child: DropdownButtonHideUnderline( - child: DropdownButton( - hint: new Text("Select Project"), - value: projectDropdownValue, - items: projectsList.map((item) { - return new DropdownMenuItem( - value: item.mainProjectID.toString(), - child: new Text(item.name), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - projectDropdownValue = newValue; - getDoctorsList(context); - }); - }, + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - )) - : Container(), - ], + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), ), ); } + void openDropdown(GlobalKey key) { + GestureDetector detector; + void searchForGestureDetector(BuildContext element) { + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget; + return false; + } else { + searchForGestureDetector(element); + } + + return true; + }); + } + + searchForGestureDetector(key.currentContext); + assert(detector != null); + + detector.onTap(); + } + bool isDentalSelectedAndSupported() { if (dropdownValue != null) return dropdownValue != "" && (dropdownValue.split("-")[0] == "17") && isMobileAppDentalAllow; @@ -182,24 +498,36 @@ class _SearchByClinicState extends State { return false; } - getClinicsList() { + getClinicsList() async { GifLoaderDialogUtils.showMyDialog(context); - ClinicListService service = new ClinicListService(); - service.getClinicsList(context).then((res) { - if (res['MessageStatus'] == 1) { - setState(() { - isMobileAppDentalAllow = res['ISMobileAppDentalAllow']; - res['ListClinicCentralized'].forEach((v) { - clinicsList.add(new ListClinicCentralized.fromJson(v)); - }); + if (await sharedPref.getObject(CLINICS_LIST) != null) { + dynamic res = await sharedPref.getObject(CLINICS_LIST); + setState(() { + isMobileAppDentalAllow = res['ISMobileAppDentalAllow']; + res['ListClinicCentralized'].forEach((v) { + clinicsList.add(new ListClinicCentralized.fromJson(v)); }); - getProjectsList(); - GifLoaderDialogUtils.hideDialog(context); - } else {} - }).catchError((err) { - print(err); + }); + getProjectsList(); GifLoaderDialogUtils.hideDialog(context); - }); + } else { + ClinicListService service = new ClinicListService(); + service.getClinicsList(context).then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + isMobileAppDentalAllow = res['ISMobileAppDentalAllow']; + res['ListClinicCentralized'].forEach((v) { + clinicsList.add(new ListClinicCentralized.fromJson(v)); + }); + }); + getProjectsList(); + GifLoaderDialogUtils.hideDialog(context); + } else {} + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); + } } getProjectsList() { @@ -232,6 +560,9 @@ class _SearchByClinicState extends State { searchInfo.date = DateTime.now(); navigateToDentalComplaints(context, searchInfo); + } else if (dropdownValue.split("-")[0] == "253") { + navigateToLaserClinic(context); + // callDoctorsSearchAPI(); } else if (dropdownValue.split("-")[1] == "true" // && authProvider.isLogin && // authUser.patientType == 1 @@ -242,8 +573,10 @@ class _SearchByClinicState extends State { page: LiveCareBookAppointment(clinicName: "Family Medicine", liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]), ), ).then((value) { - print(value); - if (value == "false") dropdownValue = ""; + setState(() { + print(value); + if (value == "false") dropdownValue = null; + }); if (value == "livecare") { Navigator.push(context, FadePage(page: LiveCareHome())); } @@ -279,7 +612,7 @@ class _SearchByClinicState extends State { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { @@ -311,13 +644,33 @@ class _SearchByClinicState extends State { FadePage( page: DentalComplaints(searchInfo: searchInfo), ), - ); + ).then((value) { + setState(() { + dropdownValue = null; + }); + }); + } + + Future navigateToLaserClinic(BuildContext context) async { + Navigator.push( + context, + FadePage( + page: LaserBooking(), + ), + ).then((value) { + setState(() { + dropdownValue = null; + }); + }); } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { isProjectLoaded = false; Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) .then((value) { + setState(() { + dropdownValue = null; + }); getProjectsList(); }); } diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 3289fd74..6bfac9a7 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.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'; @@ -25,60 +26,60 @@ class _SearchByDoctorState extends State { @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 15.0), - child: Text(TranslationBase.of(context).searchByDocText, - style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), - ), - Container( - decoration: BoxDecoration(color: Colors.white), - child: TextField( - controller: doctorNameController, - onChanged: (content) { - _onDocTextChanged(content); - }, - decoration: InputDecoration( - labelText: TranslationBase.of(context).enterDocName, - fillColor: Colors.white, - prefixIcon: Icon(Icons.search), - border: OutlineInputBorder())), - ), - Expanded( - child: Align( - alignment: FractionalOffset.bottomCenter, - child: _buildCounterButton(), + return Column( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 15.0), + child: Text( + TranslationBase.of(context).searchByDocText, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.9, + fontWeight: FontWeight.w600, + ), + ), + ), + inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController), + ], ), ), - ], - ), + ), + _buildCounterButton(), + ], ); } Widget _buildCounterButton() { - return new ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (_isButtonDisabled == false) { - _searchDoctor(context); - } - }, - child: Text(TranslationBase.of(context).search, - style: TextStyle(fontSize: 18.0)), + return Container( + width: double.infinity, + padding: EdgeInsets.all(16), + color: Colors.white, + child: new ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + if (_isButtonDisabled == false) { + _searchDoctor(context); + } + }, + child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0)), + ), ), ); } @@ -88,13 +89,10 @@ class _SearchByDoctorState extends State { List doctorsList = []; DoctorsListService service = new DoctorsListService(); - List _patientDoctorAppointmentListHospital = - List(); + List _patientDoctorAppointmentListHospital = List(); - service - .getDoctorsListByName(doctorNameController.text, context) - .then((res) { - GifLoaderDialogUtils.hideDialog(context); + service.getDoctorsListByName(doctorNameController.text, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { @@ -103,27 +101,13 @@ class _SearchByDoctorState extends State { }); doctorsList.forEach((element) { - List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital.add( - PatientDoctorAppointmentList( - filterName: element.projectName, - distanceInKMs: - element.projectDistanceInKiloMeters.toString(), - patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else { @@ -132,8 +116,7 @@ class _SearchByDoctorState extends State { } }); GifLoaderDialogUtils.hideDialog(context); - navigateToSearchResults( - context, doctorsList, _patientDoctorAppointmentListHospital); + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); } else { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -163,18 +146,89 @@ class _SearchByDoctorState extends State { getDoctorsList(context); } - Future navigateToSearchResults( - context, - List docList, - List - patientDoctorAppointmentListHospital) async { - Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))); + navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.text, + controller: _controller, + onChanged: (value) => {_onDocTextChanged(value)}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } } diff --git a/lib/pages/BookAppointment/doctor_post_pre_images_page.dart b/lib/pages/BookAppointment/doctor_post_pre_images_page.dart index 85e37308..eddae9d2 100644 --- a/lib/pages/BookAppointment/doctor_post_pre_images_page.dart +++ b/lib/pages/BookAppointment/doctor_post_pre_images_page.dart @@ -1,6 +1,4 @@ import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index 02d40b3f..3c56aa24 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -12,8 +12,7 @@ class DentalComplaintCard extends StatefulWidget { final ListDentalChiefComplain listDentalChiefComplain; var languageID; - DentalComplaintCard( - {@required this.listDentalChiefComplain, this.languageID}); + DentalComplaintCard({@required this.listDentalChiefComplain, this.languageID}); @override _DentalComplaintCardState createState() => _DentalComplaintCardState(); @@ -27,36 +26,22 @@ class _DentalComplaintCardState extends State { onTap: () { getChiefComplaintsList(); }, - child: Card( - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Row( + child: Container( + width: double.infinity, + padding: EdgeInsets.all(14.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ Container( - width: MediaQuery.of(context).size.width * 0.85, - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - child: Text(widget.listDentalChiefComplain.name, - style: - TextStyle(fontSize: 16.0, color: Colors.black)), - ), - ], - ), - ), - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Icon(Icons.arrow_forward_ios, - size: 20.0, color: Colors.black54), - ], + child: Text( + widget.listDentalChiefComplain.name, + style: TextStyle( + fontSize: 16.0, + color: Colors.black, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), ), ), ], @@ -68,15 +53,11 @@ class _DentalComplaintCardState extends State { getChiefComplaintsList() { List doctorsList = []; - List _patientDoctorAppointmentListHospital = - List(); + List _patientDoctorAppointmentListHospital = List(); GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); - service - .getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, - widget.listDentalChiefComplain.projectID, context) - .then((res) { + service.getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, widget.listDentalChiefComplain.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['List_DentalDoctorChiefComplaintMapping']); @@ -87,31 +68,20 @@ class _DentalComplaintCardState extends State { }); doctorsList.forEach((element) { - List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - _patientDoctorAppointmentListHospital.add( - PatientDoctorAppointmentList( - filterName: element.projectName, - distanceInKMs: - element.projectDistanceInKiloMeters.toString(), - patientDoctorAppointment: element)); + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); - navigateToSearchResults( - context, doctorsList, _patientDoctorAppointmentListHospital); + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -122,17 +92,7 @@ class _DentalComplaintCardState extends State { }); } - Future navigateToSearchResults( - context, - List docList, - List - patientDoctorAppointmentListHospital) async { - Navigator.push( - context, - FadePage( - page: SearchResults( - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))); + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } } diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 7cdf7ed0..1e2e48df 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -1,11 +1,17 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import '../DoctorProfile.dart'; @@ -14,116 +20,99 @@ class DoctorView extends StatelessWidget { final DoctorList doctor; bool isLiveCareAppointment; bool isShowFlag; + final VoidCallback onTap; - DoctorView({@required this.doctor, @required this.isLiveCareAppointment, this.isShowFlag = true}); + DoctorView({@required this.doctor, @required this.isLiveCareAppointment, this.isShowFlag = true, this.onTap}); + + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return InkWell( - onTap: () { - if(isShowFlag) - getDoctorsProfile(context, doctor); - }, - child: Card( - margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - decoration: BoxDecoration(), - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(this.doctor.doctorImageURL, - fit: BoxFit.fill, height: 60.0, width: 60.0), - ), + onTap: onTap ?? + () { + if (isShowFlag) getDoctorsProfile(context, doctor, isAppo: true); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), ), - Expanded( - flex: 4, - child: Container( - width: MediaQuery.of(context).size.width * 0.55, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (doctor.doctorTitle != null) - Text(this.doctor.doctorTitle + " " + this.doctor.name, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text( - this.doctor.clinicName != null - ? this.doctor.clinicName - : "", - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(this.doctor.projectName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - if (doctor.speciality != null) - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(this.doctor.speciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - this.doctor.nearestFreeSlot != null - ? Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDate(this.doctor.nearestFreeSlot), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.green[600], - letterSpacing: 1.0)), - ) - : Container(), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: - this.doctor.actualDoctorRate.toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + ], + color: Colors.white), + child: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + doctor.name, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + if (doctor.doctorTitle != null) SizedBox(height: 6), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: doctor.name, + url: doctor.doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (doctor.clinicName != null) MyRichText(TranslationBase.of(context).clinic + ":", doctor.clinicName, projectViewModel.isArabic), + if (doctor.projectName != null) MyRichText(TranslationBase.of(context).branch, doctor.projectName, projectViewModel.isArabic), + if (doctor.speciality != null) + Text( + this.doctor.speciality[0].trim(), + // getDoctorSpeciality(this.doctor.speciality).trim(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), - isShowFlag ? Container( - child: Image.network(this.doctor.nationalityFlagURL, - width: 25.0, height: 25.0), - ) : Container(), - ], - ), - ], + if (doctor.nearestFreeSlot != null) + Text( + getDate(doctor.nearestFreeSlot), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff359846), letterSpacing: -0.48, height: 18 / 12), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: this.doctor.actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + if (isShowFlag) + Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ), + // if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0) + ], + ), + ], + ), ), - ), + ], ), ], ), @@ -144,10 +133,7 @@ class DoctorView extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); List docProfileList = []; DoctorsListService service = new DoctorsListService(); - service - .getDoctorsProfile(docObject.doctorID, docObject.clinicID, - docObject.projectID, context) - .then((res) { + service.getDoctorsProfile(docObject.doctorID, docObject.clinicID, docObject.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['DoctorProfileList'].length != 0) { @@ -155,12 +141,13 @@ class DoctorView extends StatelessWidget { docProfileList.add(new DoctorProfileList.fromJson(v)); }); } else {} - navigateToDoctorProfile(context, docObject, docProfileList[0], - isAppo: isAppo); + navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); }); } @@ -188,16 +175,17 @@ class DoctorView extends StatelessWidget { } } - Future navigateToDoctorProfile(context, docObject, docProfile, - {isAppo}) async { + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { Navigator.push( - context, - FadePage( - page: DoctorProfile( + context, + FadePage( + page: DoctorProfile( doctor: docObject, isLiveCareAppointment: isLiveCareAppointment, docProfileList: docProfile, isOpenAppt: isAppo, - ))); + ), + ), + ); } } diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart new file mode 100644 index 00000000..43038658 --- /dev/null +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -0,0 +1,227 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.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:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; +import 'package:manage_calendar_events/manage_calendar_events.dart'; +import 'package:permission_handler/permission_handler.dart'; + +Future> requestPermissions() async { + var permissionResults = [Permission.calendar].request(); + return permissionResults; +} + +showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, + {Function onSuccess, String title, String description}) async { + if (await Permission.calendar.request().isGranted) { + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + } else { + requestPermissions().then((results) { + if (results[Permission.calendar].isGranted) { + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + } + }); + } +} + +final CalendarPlugin _myPlugin = CalendarPlugin(); + +Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, + {Function onSuccess, String title, String description}) async { + return showDialog( + context: context, + barrierDismissible: true, // user must tap button! + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0.0)), + insetPadding: EdgeInsets.all(21), + child: ReminderDialog( + onClick: (int i) async { + if (i == 0) { + // Before 30 mints + dateTime = Jiffy(dateTime).subtract(minutes: 30); + // dateTime.add(new Duration(minutes: -30)); + } else if (i == 1) { + // Before 1 hour + // dateTime.add(new Duration(minutes: -60)); + dateTime = Jiffy(dateTime).subtract(hours: 1); + } else if (i == 2) { + // Before 1 hour and 30 mints + // dateTime.add(new Duration(minutes: -90)); + dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30); + } else if (i == 3) { + // Before 2 hours + // dateTime.add(new Duration(minutes: -120)); + dateTime = Jiffy(dateTime).subtract(hours: 2); + } + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + calendarUtils + .createOrUpdateEvent( + title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, + description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + scheduleDateTime: dateTime, + eventId: eventId) + .then((value) {}); + + onSuccess(); + }, + ), + ); + }, + ); +} + +class ReminderDialog extends StatefulWidget { + Function onClick; + + ReminderDialog({this.onClick}); + + @override + _ReminderDialogState createState() => _ReminderDialogState(); +} + +class _ReminderDialogState extends State { + int i = 0; + + @override + Widget build(BuildContext context) { + return Container( + //width: MediaQuery.of(context).size.width / 0.8, + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + Icons.notifications_active, + color: Color(0xff2B353E), + size: 50, + ), + IconButton( + icon: Icon(Icons.clear), + color: Color(0xff2B353E), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + mHeight(20), + Text( + TranslationBase.of(context).appointmentReminder, + style: TextStyle( + fontSize: 16, + color: Color(0xff2B353E), + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + mHeight(20), + Text( + TranslationBase.of(context).pleaseSelectFromBelowOptions, + style: TextStyle( + fontSize: 12, + color: Color(0xff2B353E), + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Radio( + value: 0, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder30, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder60, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], + ), + Row( + children: [ + Radio( + value: 2, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder90, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], + ), + Row( + children: [ + Radio( + value: 3, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text( + TranslationBase.of(context).appoReminder120, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + ], + ), + mHeight(12), + DefaultButton( + TranslationBase.of(context).save, + () { + widget.onClick(i); + Navigator.pop(context); + }, + color: CustomColors.green, + ), + ], + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index 3c0d072b..fa526360 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -4,22 +4,16 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; -import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; -import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; -import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:flutter_datetime_picker/flutter_datetime_picker.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; enum Gender { Male, Female, NON } enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } @@ -31,15 +25,7 @@ class AddNewChildPage extends StatefulWidget { String dateAdd; List _scheduleList = List(); - List daysOfWeek = [ - DayOfWeek.Monday, - DayOfWeek.Tuesday, - DayOfWeek.Wednesday, - DayOfWeek.Thursday, - DayOfWeek.Friday, - DayOfWeek.Saturday, - DayOfWeek.Sunday - ]; + List daysOfWeek = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday]; DateTime startDay; DateTime endDay; @@ -47,13 +33,11 @@ class AddNewChildPage extends StatefulWidget { //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { startDay = DateTime.now(); - endDay = - DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); + endDay = DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); int hour = 24; //(24 / frequency).round(); int durations = 24 ~/ hour; for (int count = 0; count < durations; count++) { - _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, (hour * count))); + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, (hour * count))); } } @@ -85,197 +69,207 @@ class _AddNewChildPageState extends State { @override Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).vaccination, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 20, - ), - Texts( - TranslationBase.of(context).vaccinationAddChildMsg, - //+model.user.firstName, - textAlign: TextAlign.center, - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).firstName, - controller: _firstTextController, - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).middleName, - controller: _secondTextController, - ), - SizedBox( - height: 12, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).gender, - textAlign: TextAlign.end, - ), - ], - ), - Container( - width: double.infinity, - height: size.height * 0.12, + showNewAppBarTitle: true, + showNewAppBar: true, + body: Container( + child: Column( + children: [ + Expanded( + child: Padding( padding: EdgeInsets.all(12), - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.center, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Container( - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 1 ? Colors.white : Colors.black, - color: checkedValue == 1 ? Colors.red : Colors.white, - label: TranslationBase.of(context).male, - onTap: () { - setState(() { - checkedValue = 1; - print("checkedValue=" + checkedValue.toString()); - }); + Text( + TranslationBase.of(context).vaccinationAddChildMsg, + //+model.user.firstName, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).firstName, "", _firstTextController), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).middleName, "", _secondTextController), - // bloodDetails. - }, - ), + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).selectGender, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), ), - Expanded( - child: Container( - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 2 ? Colors.white : Colors.black, - color: checkedValue == 2 ? Colors.red : Colors.white, - label: TranslationBase.of(context).female, - // - onTap: () { + Row( + children: [ + Expanded( + child: Row( + children: [ + Radio( + value: checkedValue, + groupValue: 1, + onChanged: (v) { + setState(() { + checkedValue = 1; + }); + }), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: checkedValue, + groupValue: 2, + onChanged: (v) { + setState(() { + checkedValue = 2; + }); + }), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ], + ), + + //========== + SizedBox( + height: 6, + ), + + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + // minTime: DateTime( + // DateTime.now().year, DateTime.now().month - 1, 1), + minTime: DateTime(1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { setState(() { - checkedValue = 2; - print("checkedValue=" + checkedValue.toString()); + widget.startDay = date; }); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. }, + currentTime: widget.startDay, + // locale: projectViewModel.localeType + ); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dob, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + //getStartDay() + // DateUtil.yearMonthDay(DateTime.now()) + getStartDay(), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + Icon( + Icons.calendar_today, + color: Color(0xff575757), + size: 18, + ) + ], ), ), - ) + ), + SizedBox( + height: 12, + ), + + //========= ], ), ), - //========== - SizedBox( - height: 6, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).dob, - textAlign: TextAlign.end, - ), - ], - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - // minTime: DateTime( - // DateTime.now().year, DateTime.now().month - 1, 1), - minTime: DateTime(1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - setState(() { - widget.startDay = date; - }); - }, - currentTime: widget.startDay, - // locale: projectViewModel.localeType - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(//getStartDay() - // DateUtil.yearMonthDay(DateTime.now()) - getStartDay()), - Icon( - Icons.calendar_today, - color: Colors.black, - ) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: TranslationBase.of(context).add, - // - onTap: () async { - newChild.babyName = _firstTextController.text + - " " + - _secondTextController.text; - newChild.gender = checkedValue.toString(); - newChild.strDOB = getStartDay(); - newChild.tempValue = true; - newChild.isLogin = true; + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(16), + color: Colors.white, + child: DefaultButton( + TranslationBase.of(context).add, + () async { + newChild.babyName = _firstTextController.text + " " + _secondTextController.text; + newChild.gender = checkedValue.toString(); + newChild.strDOB = getStartDay(); + newChild.tempValue = true; + newChild.isLogin = true; - await model.createNewBabyOrders(newChild: newChild); - if (model.isAdded) { - AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully); - Navigator.pop(context, model.isAdded); - } else { - //TODO handling error - } - }, - ), + await model.createNewBabyOrders(newChild: newChild); + if (model.isAdded) { + AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully); + Navigator.pop(context, model.isAdded); + } else { + //TODO handling error + } + }, ), - //========= - ], - ), + ), + ], ), ), // bottomSheet: @@ -317,4 +311,77 @@ class _AddNewChildPageState extends State { ), ); } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } } diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart index c08749b8..40d8d1fa 100644 --- a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/ChildVaccines/dialogs/delete_child.dart b/lib/pages/ChildVaccines/dialogs/delete_child.dart index 250f40d3..9eb49d27 100644 --- a/lib/pages/ChildVaccines/dialogs/delete_child.dart +++ b/lib/pages/ChildVaccines/dialogs/delete_child.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/ChildVaccines/new/child_initial_page.dart b/lib/pages/ChildVaccines/new/child_initial_page.dart new file mode 100644 index 00000000..a0deec0c --- /dev/null +++ b/lib/pages/ChildVaccines/new/child_initial_page.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.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 'child_vaccine_page.dart'; + +class ChildInitialPage extends StatefulWidget { + @override + _ChildVaccinesPageState createState() => _ChildVaccinesPageState(); +} + +class _ChildVaccinesPageState extends State with SingleTickerProviderStateMixin { + TextEditingController titleController = TextEditingController(); + var checkedValue = false; + String addEmail = ""; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getUserInformationRequestOrders(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isShowDecPage: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).childVaccineInfo, + imagesInfo: [ + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/0.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/0.png'), + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/1.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/1.png') + ], + appBarTitle: TranslationBase.of(context).vaccination, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).welcomeBack, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 16, + ), + Text( + TranslationBase.of(context).msg_email_address_up_to_date, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 20, + ), + TextFields( + fillColor: Colors.red, + hintText: model.user != null ? model.user.emailAddress : "", + controller: titleController, + fontSize: 14, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + suffixIcon: checkedValue ? Icons.check_box : Icons.check_box_outline_blank, + onSuffixTap: () { + setState(() { + checkedValue = !checkedValue; + }); + }, + onChanged: (text) { + addEmail = text; + model.user.emailAddress == addEmail ? checkedValue = false : checkedValue = true; + }, + validator: (value) { + if (value == null) { + return model.user.emailAddress; + } else { + return model.user.emailAddress; + } + }, + ), + ], + ), + ), + mFlex(1), + Container( + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(16), + child: Column( + children: [ + if (checkedValue) + SecondaryButton( + textColor: Colors.white, + color: checkedValue == false ? Colors.white24 : CustomColors.green, + label: TranslationBase.of(context).updateEmail, + // + onTap: () { + model.user.emailAddress = addEmail.toString(); + AppToast.showSuccessToast(message: TranslationBase.of(context).updateEmailMsg); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + ), + if (checkedValue) mHeight(16), + DefaultButton( + TranslationBase.of(context).viewListChildren, + () => Navigator.push( + context, + FadePage( + page: ChildVaccinePage(), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/new/child_vaccine_page.dart b/lib/pages/ChildVaccines/new/child_vaccine_page.dart new file mode 100644 index 00000000..4d8b878c --- /dev/null +++ b/lib/pages/ChildVaccines/new/child_vaccine_page.dart @@ -0,0 +1,206 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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/rendering.dart'; + +import '../add_newchild_page.dart'; +import '../vaccinationtable_page.dart'; + +class ChildVaccinePage extends StatefulWidget { + @override + _ChildPageState createState() => _ChildPageState(); +} + +class _ChildPageState extends State with SingleTickerProviderStateMixin { + DeleteBaby deleteBaby = DeleteBaby(); + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double height = (size.height - kToolbarHeight - 60); + final double itemWidth = size.width / 2; + final double itemHeight = height / 2 + 40; + + var checkedValue = true; + return BaseView( + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).vaccination, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + Color selectedColor = model.babyInformationModelList[index].gender == 1 ? Color(0xFF5A282E) : Colors.white; + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 0, bottom: index == model.babyInformationModelList.length - 1 ? 16 : 0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(12)), + color: Colors.white, + gradient: LinearGradient( + colors: model.babyInformationModelList[index].gender == 2 + ? [ + Color(0xFFFDA4B0), + Color(0xFFFBC8CC), + ] + : [ + Color(0xFF6EA8FF), + Color(0xFF7AB8FD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.all(12), + //double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + model.babyInformationModelList[index].babyName.trim(), + style: TextStyle( + fontSize: 14, + letterSpacing: -0.46, + fontWeight: FontWeight.bold, + color: selectedColor, + ), + ), + Text( + model.babyInformationModelList[index].genderDescription, + style: TextStyle( + fontSize: 11, + color: selectedColor, + ), + ), + Row( + children: [ + Text( + TranslationBase.of(context).dob, + style: TextStyle( + fontSize: 11, + color: selectedColor, + ), + ), + Text(" " + DateUtil.getDayMonthYearDateFormatted(model.babyInformationModelList[index].dOB), + style: TextStyle( + fontSize: 11, + color: selectedColor, + )), + ], + ), + mHeight(20), + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Icon( + Icons.arrow_forward, + size: 18, + ), + mHeight(12), + InkWell( + onTap: () async { + await model.deleteBabyOrders(newChild: deleteBaby); + + deleteBaby.babyID = model.babyInformationModelList[index].babyID; + + await model.deleteBabyOrders(newChild: deleteBaby); + if (model.isDeleted) { + AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + Navigator.pop(context, model.isDeleted); + } else { + //TODO handling error + } + }, + child: Container( + decoration: containerRadius(Colors.grey.withOpacity(0.2), 2000), + padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8), + child: Row( + children: [ + Image.asset( + 'assets/images/new-design/garbage.png', + width: 16, + color: selectedColor, + ), + mWidth(8), + Text( + TranslationBase.of(context).deleteView, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.33, + color: selectedColor, + ), + ), + ], + ), + ), + ), + ], + ), + ], + ), + ), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mHeight(12); + }, + itemCount: model.babyInformationModelList.length, + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(16), + color: Colors.white, + child: DefaultButton( + TranslationBase.of(context).addNewChild, + () { + Navigator.push( + context, + FadePage( + page: AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index 7b8499e0..45a63414 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -1,18 +1,21 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.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/date_uitl.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:provider/provider.dart'; import 'dialogs/SelectGenderDialog.dart'; @@ -25,6 +28,7 @@ class VaccinationTablePage extends StatelessWidget { Widget build(BuildContext context) { var size = MediaQuery.of(context).size; final double height = (size.height - kToolbarHeight - 60); + ProjectViewModel projectViewModel = Provider.of(context); var checkedValue; return BaseView( @@ -33,147 +37,164 @@ class VaccinationTablePage extends StatelessWidget { isShowAppBar: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).vaccination, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Container( - height: height * 0.85, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 16, right: 16, top: 16), - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Texts(TranslationBase.of(context).childName), - ), - Expanded( - child: Texts(TranslationBase.of(context).dob), - ), - ], - ), - SizedBox( - height: 10, - ), - Row( - children: [ - Expanded( - child: Texts(babyInfo.babyName), - ), - Expanded( - child: Texts(DateUtil.getFormattedDate( - babyInfo.dOB, "MMM dd,yyyy")), - ), - ], - ), - SizedBox( - height: 10, - ), - Divider( - color: Colors.black, - ), - Row( - children: [ - Text(TranslationBase.of(context).visit), - SizedBox( - width: 25, - ), - Expanded( - child: Text(TranslationBase.of(context).description)), - Text(TranslationBase.of(context).dueDate), - ], - ), - ...List.generate( - model.creteVaccinationTableModelList.length, - (index) => Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - // border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - // color: Colors.white, - ), + height: double.infinity, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: 16), + child: Column( + children: [ + Container( + decoration: containerRadius(Colors.white, 12), padding: EdgeInsets.all(12), - width: double.infinity, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Text( + babyInfo.babyName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(8), Row( children: [ - Text(model - .creteVaccinationTableModelList[index] - .visit), - SizedBox( - width: 10, + Text( + TranslationBase.of(context).gender + " :", + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.textColor, + ), ), - Expanded( - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Html( - // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription - data: model - .creteVaccinationTableModelList[ - index] - .vaccinesDescription, - ), - ], + Text( + babyInfo.gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.black, ), ), - Text(model - .creteVaccinationTableModelList[index] - .givenAt), ], ), - Divider( - color: Colors.black, + Row( + children: [ + Text( + TranslationBase.of(context).dateOfBirth + " :", + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.textColor, + ), + ), + Text( + DateUtil.getFormattedDate(babyInfo.dOB, "MMM dd,yyyy"), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.black, + ), + ), + ], ), ], - ))) - ], - ), - ), - ), - ), - bottomSheet: Container( - height: height * 0.15, - width: double.infinity, - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, + ), + ), + mHeight(12), + Container( + decoration: containerRadius(Colors.white, 12), + padding: EdgeInsets.all(12), + child: Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 1: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, model, projectViewModel), + ), + ), + ], ), - label: TranslationBase.of(context).sendEmail, - // - onTap: () { - //SelectGenderDialog(); -//=============== - showDialog( - context: context, - child: SelectGenderDialog( - okFunction: () async { - await model.getCreateVaccinationTable(babyInfo, true); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast( - message: TranslationBase.of(context) - .emailSentSuccessfully); - } else { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .EmailSentError); - } - }, ), - ); - //========= - }), + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(12), + color: Colors.white, + child: SecondaryButton( + textColor: Colors.white, + color: CustomColors.accentColor, + label: TranslationBase.of(context).sendEmail, + // + onTap: () { + //SelectGenderDialog(); +//=============== + showDialog( + context: context, + child: SelectGenderDialog( + okFunction: () async { + await model.getCreateVaccinationTable(babyInfo, true); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).EmailSentError); + } + }, + ), + ); + //========= + }, + ), + ), + ], + ), ), ), ); } + + List fullData(BuildContext context, VaccinationTableViewModel model, ProjectViewModel projectViewModel) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).visit), + Utils.tableColumnTitle(TranslationBase.of(context).description), + Utils.tableColumnTitle(TranslationBase.of(context).dueDate), + ], + ), + ); + model.creteVaccinationTableModelList.forEach( + (diabtec) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue(diabtec.visit, isCapitable: false, mProjectViewModel: projectViewModel), + // Utils.tableColumnValue(diabtec.vaccinesDescription, isCapitable: false, mProjectViewModel: projectViewModel), + Html( + // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription + data: diabtec.vaccinesDescription, + ), + Utils.tableColumnValue(diabtec.givenAt, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } } diff --git a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart index d85971bb..ceab7e45 100644 --- a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart @@ -1,16 +1,12 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import 'package:url_launcher/url_launcher.dart'; class HospitalsLiveChatPage extends StatefulWidget { @@ -37,182 +33,88 @@ class _HospitalsLiveChatPageState extends State { builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 70, - ), - Container( - width: double.infinity, - height: 230, + Text( + TranslationBase.of(context).instructions, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 20), + Text( + TranslationBase.of(context).selectHospitalDec + " :", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 20), + ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: model.LiveChatModelList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + tappedIndex = index; + chat = + "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.currentLanguage}&WorkGroup=${model.LiveChatModelList[index].value}"; + }); + }, + child: Container( + padding: EdgeInsets.only(right: 12, left: 18, top: 16, bottom: 16), decoration: BoxDecoration( - image: DecorationImage( - image: ExactAssetImage( - 'assets/images/dashboard_top_bg.png'), - fit: BoxFit.cover), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: projectViewModel.isArabic? 10:20, - ), - Texts( - TranslationBase.of(context).instructions, - color: Colors.white, - textAlign: TextAlign.start, - ), - SizedBox( - height:projectViewModel.isArabic? 8:25, - ), - Texts( - TranslationBase.of(context) - .selectHospitalDec + - " :", - color: Colors.white, - fontWeight: FontWeight.w700, - textAlign: TextAlign.start, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), ], - ), + color: tappedIndex == index ? Color(0xff28323A).withOpacity(.7) : Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + model.LiveChatModelList[index].projectName.toString() + "\n" + model.LiveChatModelList[index].distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: tappedIndex == index ? Colors.white : Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + ), + Icon( + Icons.arrow_forward, + color: tappedIndex == index ? Colors.white : Colors.black, + ), + ], ), ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.85, - ), - SizedBox( - height: 100, - ), - ], - ), - Positioned( - left: 13, - right: 13, - top: 200, - child: Container( - width: double.maxFinite, - child: Column( - children: [ - ...List.generate( - model.LiveChatModelList.length, - (index) => Container( - margin: EdgeInsets.only( - left: 0, right: 0, bottom: 20), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all( - Radius.circular(5)), - color: tappedIndex == index - ? Theme.of(context).primaryColor - : Colors.white, - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () { - setState(() { - tappedIndex = index; - chat = "http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.currentLanguage}&WorkGroup=${model.LiveChatModelList[index].value}"; - }); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - SizedBox( - width: 20, - ), - Expanded( - child: Container( - margin: - EdgeInsets.only( - left: 5, - right: 5), - child: Texts( - '${model.LiveChatModelList[index].projectName}', - color: - tappedIndex == - index - ? Colors - .white - : Colors - .black, - textAlign: TextAlign - .center, - ))), - //model.cOCItemList[index].cOCTitl - IconButton( - icon: Icon( - Icons.arrow_forward_ios, - color: - tappedIndex == index - ? Colors.white - : Colors.black, - ), - tooltip: '', - onPressed: () { - setState(() {}); - }, - ), - ], - ), - ) - ], - ), - ), - )), - ], - ), ), ), ], ), - Container( - height: MediaQuery.of(context).size.height * 0.20, - width: double.maxFinite, - ) - ], + ), ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - padding: EdgeInsets.all(8.0), - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.07, - width: MediaQuery.of(context).size.width * 0.8, - child: SecondaryButton( - label: TranslationBase.of(context).start, - loading: model.state == ViewState.BusyLocal, - textColor: Colors.white, - disabled: chat.isEmpty, - onTap: () { - launch(chat); - }, + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).start, + chat.isEmpty ? null : () => {launch(chat)}, + color: Color(0xffD02127), + textColor: chat.isEmpty ? Color(0xff000000) : Colors.white, + disabledColor: Color(0xffEAEAEA), ), ), - ), + ], ), ), ); diff --git a/lib/pages/ContactUs/LiveChat/livechat_page.dart b/lib/pages/ContactUs/LiveChat/livechat_page.dart index a747db3d..6070ab51 100644 --- a/lib/pages/ContactUs/LiveChat/livechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/livechat_page.dart @@ -1,9 +1,6 @@ -import 'dart:ui'; - import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -15,17 +12,19 @@ class LiveChatPage extends StatefulWidget { _LiveChatPageState createState() => _LiveChatPageState(); } -class _LiveChatPageState extends State - with SingleTickerProviderStateMixin { +class _LiveChatPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); @override void initState() { super.initState(); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/1.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/2.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/2.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/0.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/1.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/live-chat/ar/2.png')); _tabController = TabController(length: 2, vsync: this); } @@ -36,7 +35,6 @@ class _LiveChatPageState extends State _tabController.dispose(); } - @override @override Widget build(BuildContext context) { return AppScaffold( @@ -44,86 +42,11 @@ class _LiveChatPageState extends State imagesInfo: imagesInfo, title: TranslationBase.of(context).liveChat, description: TranslationBase.of(context).infoChat, - appBarTitle: TranslationBase.of(context).service, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, // 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Theme.of(context).primaryColor, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).hospitals), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).pharmacies), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - HospitalsLiveChatPage(), //SendFeedbackPage(), - PhamaciesLiveChatPage() - //StatusFeedbackPage() - ], - ), - ) - ], - ), - ), + appBarTitle: TranslationBase.of(context).liveChat, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: HospitalsLiveChatPage(), ); } -} +} \ No newline at end of file diff --git a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart index 26ccc1fc..2d99054e 100644 --- a/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/pharmaciesLivechat_page.dart @@ -1,33 +1,16 @@ -import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/contactus/livechat_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.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:provider/provider.dart'; - import 'package:url_launcher/url_launcher.dart'; -class PhamaciesLiveChatPage extends StatefulWidget { - @override - _PhamaciesLiveChatPageState createState() => _PhamaciesLiveChatPageState(); -} - -class _PhamaciesLiveChatPageState extends State { - int tappedIndex; - String chat; - - @override - void initState() { - super.initState(); - tappedIndex = -1; - chat = ""; - } +class PharmaciesLiveChatPage extends StatelessWidget { + PharmaciesLiveChatPage({Key key}) : super(key: key); @override Widget build(BuildContext context) { @@ -36,53 +19,41 @@ class _PhamaciesLiveChatPageState extends State { builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15, right: 15), - child: Column( - children: [ - SizedBox( - height: 20, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 20), + Text( + TranslationBase.of(context).instructions, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + ], ), - Container( - width: double.infinity, - height: 200, - - child: Texts( - TranslationBase.of(context).instructionsPharmacies, - color: Colors.black, - textAlign: TextAlign.center, - ), - ), - /////////// - - SizedBox( - height: 100, - ), - ], + ), ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.11, - width: double.infinity, - padding: EdgeInsets.all(8.0), - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: TranslationBase.of(context).start, - loading: model.state == ViewState.BusyLocal, - onTap: () { - print("chat=" + chat); - chat = - "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.isArabic? 1:2}"; - launch(chat); - }, + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).start, + null, + // () { + // String chat; + // chat = + // "http://chat.dshmg.com:7788/EPharmacyChat/EIndex.aspx?CustomerID=undefined&Name=${model.user.firstName}&MobileNo=${model.user.mobileNumber}&Language=${projectViewModel.isArabic ? 1 : 2}"; + // launch(chat); + // }, + disabledColor: Color(0xffEAEAEA), ), ), - ), + ], ), ), ); diff --git a/lib/pages/ContactUs/contact_us_page.dart b/lib/pages/ContactUs/contact_us_page.dart index d301df3e..43db6486 100644 --- a/lib/pages/ContactUs/contact_us_page.dart +++ b/lib/pages/ContactUs/contact_us_page.dart @@ -1,10 +1,13 @@ -import 'package:diplomaticquarterapp/pages/ContactUs/widgets/card_common_contat.dart'; +import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; - +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; + import '../../uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; +import 'LiveChat/livechat_page.dart'; +import 'findus/findus_page.dart'; class ContactUsPage extends StatefulWidget { @override @@ -12,76 +15,94 @@ class ContactUsPage extends StatefulWidget { } class _ContactUsPageState extends State { - LocationUtils locationUtils; @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance - .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); super.initState(); } + @override Widget build(BuildContext context) { + List myMedicalList = myOptionsList(context); + return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).hMGServiceLabel, + appBarTitle: TranslationBase.of(context).contactUs, isShowDecPage: false, - body: Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: CardCommonContact( - image: 'assets/images/new-design/find_us_icon.png', - text: TranslationBase.of(context).findUs, - subText: "", - type: 0, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), + body: Column( + children: [ + Container( + width: double.infinity, + height: 30, + ), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; + }, + ), + ), + ], + ), + ); + } - ), - ), - Expanded( - child: CardCommonContact( - image: 'assets/images/new-design/feedback_icon.png', - text: TranslationBase.of(context).feedback, - subText: "", - type: 1), + List myOptionsList(BuildContext context) { + List medical = List(); - ), - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: CardCommonContact( - image: 'assets/images/new-design/live_chat_icon.png', - text: TranslationBase.of(context).liveChat, - subText: TranslationBase.of(context).service, - type: 2, + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: FindUsPage()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).findUs, + imagePath: 'assets/images/new-design/find_us_icon.png', + subTitle: null, + isPngImage: true, + ), + )); - ), - ), - Expanded( - child: Container(), + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: FeedbackHomePage()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).feedback, + imagePath: 'assets/images/new-design/feedback_icon.png', + subTitle: null, + isPngImage: true, + ), + )); - ), - ], - ), - ], - ), + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: LiveChatPage()), ), - ); + child: MedicalProfileItem( + title: TranslationBase.of(context).liveChat, + imagePath: 'assets/images/new-design/live_chat_icon.png', + subTitle: null, + isPngImage: true, + ), + )); + + return medical; } } - diff --git a/lib/pages/ContactUs/findus/findus_page.dart b/lib/pages/ContactUs/findus/findus_page.dart index 80648292..882ee506 100644 --- a/lib/pages/ContactUs/findus/findus_page.dart +++ b/lib/pages/ContactUs/findus/findus_page.dart @@ -4,8 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model import 'package:diplomaticquarterapp/pages/ContactUs/findus/hospitrals_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/pharmacies_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; - -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -15,8 +14,7 @@ class FindUsPage extends StatefulWidget { _FindUsPageState createState() => _FindUsPageState(); } -class _FindUsPageState extends State - with SingleTickerProviderStateMixin { +class _FindUsPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override void initState() { @@ -39,90 +37,43 @@ class _FindUsPageState extends State builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: 'Locations', + appBarTitle: TranslationBase.of(context).location, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, // 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(' Hospitals '), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(' Pharmacies '), - ), - ), - ], - ), - ), - ), - ), - ], + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).hospitals), Text(TranslationBase.of(context).pharmacies)], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - HospitalsPage( - findusHospitalModelList: model.FindusHospitalModelList, - ), //SendFeedbackPage(), - PharmaciesPage( - findusPharmaciesModelList: - model.FindusPharmaciesModelList, - ) //StatusFeedbackPage() - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + HospitalsPage(findusHospitalModelList: model.FindusHospitalModelList), //SendFeedbackPage(), + PharmaciesPage(findusPharmaciesModelList: model.FindusPharmaciesModelList) //StatusFeedbackPage() + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index 2d257488..106ecb0d 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -1,14 +1,8 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; -import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:maps_launcher/maps_launcher.dart'; class HospitalsPage extends StatefulWidget { final List findusHospitalModelList; @@ -22,229 +16,81 @@ class HospitalsPage extends StatefulWidget { class _HospitalsPageState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - // margin: EdgeInsets.only(left: 15,right: 15,top: 70), - margin: EdgeInsets.only(left: 15, right: 15, top: 70), - child: Column( - children: [ - ...List.generate( - widget.findusHospitalModelList.length, - (index) => Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => - AssetGiffyDialog( - title: Text( - widget - .findusHospitalModelList[ - index] - .locationName, - style: TextStyle( - fontSize: 22.0, - fontWeight: - FontWeight - .w600), - ), - image: Image.network( - widget - .findusHospitalModelList[ - index] - .projectImageURL - .toString(), - fit: BoxFit.cover, - ), - buttonCancelText: - Text('cancel'), - buttonCancelColor: - Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container( - width: 70, - height: 70, - child: Image.network(widget - .findusHospitalModelList[ - index] - .projectImageURL - .toString())), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.only( - left: 5, - right: 5, - top: 10, - bottom: 1), - child: Texts( - '${widget.findusHospitalModelList[index].locationName}', - textAlign: TextAlign.start, - ))), //model.cOCItemList[index].cOCTitl - Expanded( - flex: 2, - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - IconButton( - icon: Icon( - Icons.location_on, - color: Theme.of(context) - .primaryColor, - size: 35, - ), - // icon: new Image.asset( - // 'assets/images/new-design/navigate.png'), - tooltip: '', - onPressed: () { - setState(() { - MapsLauncher.launchCoordinates( - double.parse(widget - .findusHospitalModelList[ - index] - .latitude), - double.parse(widget - .findusHospitalModelList[ - index] - .longitude), - widget - .findusHospitalModelList[ - index] - .locationName); - }); - }, - ), - IconButton( - icon: Icon( - Icons.phone, - color: Theme.of(context) - .primaryColor, - size: 35, - ), - // icon: new Image.asset( - // 'assets/images/new-design/call.png'), - tooltip: '', - onPressed: () { - setState(() { - // _volume += 10; - launch("tel://" + - widget - .findusHospitalModelList[ - index] - .phoneNumber); - }); - }, - ), - ], - ), - ), - ], - ), - ), - ], - ), - // Texts('${model.FindusHospitalModelList[index].locationName}'), - Divider( - height: 4.5, - color: Colors.grey[500], - ) - ], - ), - ), - )), - SizedBox( - height: 8, - ), - Container( - width: double.infinity, - height: 100, - color: Colors.white, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - IconButton( - icon: new Image.asset( - 'assets/images/new-design/youtube.png'), - iconSize: 70, - tooltip: 'Youtube', - onPressed: () { - setState(() { - launch( - "https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/linkedin.png'), - tooltip: 'LinkedIn', - iconSize: 70, - onPressed: () { - setState(() { - launch( - "https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/twitter.png'), - tooltip: 'Twitter', - iconSize: 70, - onPressed: () { - setState(() { - launch("https://twitter.com/HMG"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/facebook.png'), - tooltip: 'facebook', - iconSize: 70, - onPressed: () { - setState(() { - launch( - "https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); - }); - }, - ), - ], + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 21, top: 21, left: 21, right: 21), + child: Column( + children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) => HospitalLocation(widget.findusHospitalModelList[index]), + itemCount: widget.findusHospitalModelList.length, + ), + Container( + margin: EdgeInsets.only(top: 14), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/youtube.png'), + iconSize: 48, + tooltip: 'Youtube', + onPressed: () { + setState(() { + launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/linkedin.png'), + tooltip: 'LinkedIn', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/twitter.png'), + tooltip: 'Twitter', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://twitter.com/HMG"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/facebook.png'), + tooltip: 'facebook', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + }); + }, ), - ), - ], + ], + ), ), - ), + ], ), ); } diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index 6cf94728..72b2316c 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -1,20 +1,14 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; -import 'package:diplomaticquarterapp/core/viewModels/contactus/findus_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class PharmaciesPage extends StatefulWidget { final List findusPharmaciesModelList; PharmaciesPage({Key key, this.findusPharmaciesModelList}); + @override _PharmaciesPageState createState() => _PharmaciesPageState(); } @@ -22,239 +16,81 @@ class PharmaciesPage extends StatefulWidget { class _PharmaciesPageState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(left: 15, right: 15, top: 70), - child: Column( - children: [ - ...List.generate( - widget.findusPharmaciesModelList.length, - (index) => Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => - AssetGiffyDialog( - title: Text( - widget - .findusPharmaciesModelList[ - index] - .locationName, - style: TextStyle( - fontSize: 22.0, - fontWeight: - FontWeight - .w600), - ), - image: widget - .findusPharmaciesModelList[ - index] - .projectImageURL != - null - ? Image.network( - widget - .findusPharmaciesModelList[ - index] - .projectImageURL, - fit: BoxFit.cover, - ) - : Image.network( - 'https://hmgwebservices.com/Images/Hospitals/15.jpg', - fit: BoxFit.cover, - ), - buttonCancelText: - Text('cancel'), - // buttonCancelText:Text(model.user.projectID) , - buttonCancelColor: - Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container( - width: 70, - height: 70, - child: Image.network(widget - .findusPharmaciesModelList[ - index] - .projectImageURL != - null - ? widget - .findusPharmaciesModelList[ - index] - .projectImageURL - .toString() - : 'https://hmgwebservices.com/Images/Hospitals/15.jpg')), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.only( - left: 5, right: 5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - '${widget.findusPharmaciesModelList[index].locationName}', - textAlign: TextAlign.start, - ), - SizedBox( - height: 4, - ), - Texts( - '${widget.findusPharmaciesModelList[index].cityName}', - textAlign: TextAlign.center, - ), - ], - ), - ), - ), - //model.cOCItemList[index].cOCTitl - Expanded( - flex: 2, - child: Row( - children: [ - IconButton( - icon: Icon(Icons.location_on,color: Theme.of(context).primaryColor,size: 35,), - tooltip: '', - onPressed: () { - setState(() { - MapsLauncher.launchCoordinates( - double.parse(widget - .findusPharmaciesModelList[ - index] - .latitude), - double.parse(widget - .findusPharmaciesModelList[ - index] - .longitude), - widget - .findusPharmaciesModelList[ - index] - .locationName); - }); - }, - ), - IconButton( - icon: Icon(Icons.phone,color: Theme.of(context).primaryColor,size: 35,), - tooltip: 'I', - onPressed: () { - setState(() { - - launch("tel://" + - widget - .findusPharmaciesModelList[ - index] - .phoneNumber); - }); - }, - ), - ], - ), - ), - ], - ), - ), - ], - ), - Divider( - height: 4.5, - color: Colors.grey[500], - ) - ], - ), - ), - )), - SizedBox( - height: 8, - ), - Container( - width: double.infinity, - height: 100, - color: Colors.white, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - IconButton( - icon: new Image.asset( - 'assets/images/new-design/youtube.png'), - iconSize: 70, - tooltip: 'Youtube', - onPressed: () { - setState(() { - // _volume += 10; - launch( - "https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/linkedin.png'), - tooltip: 'LinkedIn', - iconSize: 70, - onPressed: () { - setState(() { - launch( - "https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/twitter.png'), - tooltip: 'Twitter', - iconSize: 70, - onPressed: () { - setState(() { - launch("https://twitter.com/HMG"); - }); - }, - ), - IconButton( - icon: new Image.asset( - 'assets/images/new-design/facebook.png'), - tooltip: 'facebook', - iconSize: 70, - onPressed: () { - setState(() { - launch( - "https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); - }); - }, - ), - ], + return SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 21, top: 21, left: 21, right: 21), + child: Column( + children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) => HospitalLocation(widget.findusPharmaciesModelList[index], showCity: true), + itemCount: widget.findusPharmaciesModelList.length, + ), + Container( + margin: EdgeInsets.only(top: 14), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/youtube.png'), + iconSize: 48, + tooltip: 'Youtube', + onPressed: () { + setState(() { + launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/linkedin.png'), + tooltip: 'LinkedIn', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/twitter.png'), + tooltip: 'Twitter', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://twitter.com/HMG"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/facebook.png'), + tooltip: 'facebook', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + }); + }, ), - ), - ], + ], + ), ), - ), + ], ), ); } diff --git a/lib/pages/ContactUs/widgets/card_common_contat.dart b/lib/pages/ContactUs/widgets/card_common_contat.dart index 8848e2ff..d6de807a 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -1,59 +1,61 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/Weight/WeightHomePage.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -import '../../../Constants.dart'; class CardCommonContact extends StatelessWidget { final image; final text; final subText; final type; - const CardCommonContact( - {@required this.image, - @required this.text, - @required this.subText, - @required this.type}); + final width; + final height; + final ProjectViewModel projectViewModel; + final ToDoCountProviderModel model; + + const CardCommonContact({@required this.image, @required this.text, @required this.subText, @required this.type, this.width, this.height, this.projectViewModel, this.model}); @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + // ProjectViewModel projectViewModel = Provider.of(context); + // ToDoCountProviderModel model = Provider.of(context); return GestureDetector( onTap: () { navigateToSearch(context, this.type); }, child: Container( - margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), - decoration: BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) - ], borderRadius: BorderRadius.circular(10), color: Colors.white), + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Texts(this.text, - // overflow: TextOverflow.clip, - color:secondaryColor, - fontWeight: FontWeight.w700, - fontSize: 20.0), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Texts(this.subText, - color: Colors.black, fontSize: 15.0), + Image.asset( + this.image, + width: width != null ? width : 42.0, + height: height != null ? height : 42.0, ), - Align( - alignment: projectViewModel.isArabic? Alignment.bottomLeft:Alignment.bottomRight, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: 60.0), - ), + Text( + text + "${subText.isEmpty ? "" : "\n$subText"}", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), ), ], ), @@ -62,15 +64,36 @@ class CardCommonContact extends StatelessWidget { } Future navigateToSearch(context, type) async { - if (type == 0) { Navigator.push(context, FadePage(page: FindUsPage())); } else if (type == 1) { Navigator.push(context, FadePage(page: FeedbackHomePage())); } else if (type == 2) { - //LiveChatPage Navigator.push(context, FadePage(page: LiveChatPage())); + } else if (type == 3) { + Navigator.push(context, FadePage(page: BloodSugarHomePage())); + } else if (type == 4) { + Navigator.push(context, FadePage(page: BloodPressureHomePage())); + } else if (type == 5) { + Navigator.push(context, FadePage(page: WeightHomePage())); + } else if (type == 6) { + Navigator.push(context, FadePage(page: AdvancePaymentPage())); + } else if (type == 7) { + navigateToToDoPage(context); + } else if (type == 8) { + Navigator.push(context, FadePage(page: MyBalancePage())); + } + } + navigateToToDoPage(BuildContext context) { + if (projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); } } } diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index c12dd877..672dae53 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -4,23 +4,27 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.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/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:intl/intl.dart'; import 'package:provider/provider.dart'; -import 'package:table_calendar/table_calendar.dart'; + +import 'package:syncfusion_flutter_calendar/calendar.dart'; class CovidTimeSlots extends StatefulWidget { int projectID; @@ -43,8 +47,7 @@ class CovidTimeSlots extends StatefulWidget { _CovidTimeSlotsState createState() => _CovidTimeSlotsState(); } -class _CovidTimeSlotsState extends State - with TickerProviderStateMixin { +class _CovidTimeSlotsState extends State with TickerProviderStateMixin { Map _events; AnimationController _animationController; CalendarController _calendarController; @@ -64,6 +67,8 @@ class _CovidTimeSlotsState extends State ScrollController _scrollController; + ToDoCountProviderModel toDoProvider; + @override void initState() { final _selectedDay = DateTime.now(); @@ -76,8 +81,7 @@ class _CovidTimeSlotsState extends State _selectedDay: ['Event A0'] }; - WidgetsBinding.instance.addPostFrameCallback( - (_) => getCovidFreeSlots(context, widget.projectID)); + WidgetsBinding.instance.addPostFrameCallback((_) => getCovidFreeSlots(context, widget.projectID)); _calendarController = CalendarController(); _animationController = AnimationController( @@ -96,296 +100,188 @@ class _CovidTimeSlotsState extends State super.dispose(); } - void _onDaySelected( - DateTime day, List events, ProjectViewModel projectViewModel) { + void _onDaySelected(DateTime day, ProjectViewModel projectViewModel) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); setState(() { - this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted( - day, projectViewModel.isArabic ? "ar" : "en"); + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en"); openTimeSlotsPickerForDate(day, docFreeSlots); CovidTimeSlots.selectedDate = formatter.format(day); + _calendarController.selectedDate = day; print(CovidTimeSlots.selectedDate); }); } - void _onVisibleDaysChanged( - DateTime first, DateTime last, CalendarFormat format) { - print('CALLBACK: _onVisibleDaysChanged'); - } - - void _onCalendarCreated( - DateTime first, DateTime last, CalendarFormat format) { - print('CALLBACK: _onCalendarCreated'); - } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 150.0, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/images/new-design/covid-19-big-banner-bg.png"), - fit: BoxFit.fill, - ), - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), - child: SvgPicture.asset( - 'assets/images/new-design/covid-19-car.svg', - width: 90.0, - height: 90.0), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 20.0, right: 20.0, top: 20.0), - child: Text(TranslationBase.of(context).covidTest, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 24.0)), - ), - Container( - margin: EdgeInsets.only( - left: 20.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).driveThru, - style: TextStyle( - color: Colors.white, fontSize: 24.0)), - ), - ], - ), - ], - ), - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: Colors.white), - margin: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 5.0), - padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0), - width: MediaQuery.of(context).size.width, - // height: MediaQuery.of(context).size.height * 0.65, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, children: [ Container( - margin: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).selectAppo, - style: - TextStyle(color: Colors.black, fontSize: 16.0)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text(selectedDate, - style: TextStyle( - fontSize: 18.0, fontWeight: FontWeight.bold)), - ), - Container( - height: 50, - margin: EdgeInsets.all(20.0), - child: ListView.builder( - controller: _scrollController, - scrollDirection: Axis.horizontal, - itemCount: dayEvents.length, - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.only(right: 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0), - side: BorderSide( - color: Colors.blue[400], - //Color of the border - style: BorderStyle.solid, - //Style of the border - width: 1.5, //width of the border + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + TranslationBase.of(context).selectAppo, + style: TextStyle( + color: Colors.black, + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(12), + Container( + decoration: cardRadius(12), + child: _buildTableCalendarWithBuilders(projectViewModel), + ), + mHeight(12), + Text( + selectedDate, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.64, + ), + ), + mHeight(8), + CovidTimeSlots.areSlotsAvailable + ? Container( + height: 40, + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: (index == dayEvents.length - 1) ? 0 : 5.0, left: index == 0 ? 0 : 5), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: index == selectedButtonIndex ? CustomColors.green : Colors.black, //Color of the border + style: BorderStyle.solid, //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex ? getSelectedButton(index) : getNormalButton(index)), + ); + }, ), - ), - minWidth: - MediaQuery.of(context).size.width * 0.2, - child: index == selectedButtonIndex - ? getSelectedButton(index) - : getNormalButton(index)), - ); - }, + ) + : Center( + child: Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12.0), + child: Text(TranslationBase.of(context).noSlotsError, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.grey)), + )), + ], ), ), - _buildTableCalendarWithBuilders(projectViewModel), + SizedBox( + height: 100.0, + ), ], ), ), - SizedBox( - height: 100.0, - ), - ], + ), ), - ), - ), - bottomSheet: Container( - margin: EdgeInsets.all(10.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: () { - bookCovidTestAppointment(); - }, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), + Container( + margin: EdgeInsets.zero, + decoration: cardRadius(0), + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: Colors.grey[500], + onPressed: () { + bookCovidTestAppointment(); + }, + child: Text( + TranslationBase.of(context).bookAppo, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + ), ), ), ), ), - ], - ), + ) + ], ), ); } Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { - return TableCalendar( - locale: projectViewModel.isArabic ? 'ar_SA' : 'en_US', - calendarController: _calendarController, - events: _events, - initialCalendarFormat: CalendarFormat.month, - startDay: DateTime.now(), - formatAnimation: FormatAnimation.slide, - startingDayOfWeek: StartingDayOfWeek.sunday, - weekendDays: [DateTime.friday, DateTime.saturday], - availableGestures: AvailableGestures.horizontalSwipe, - availableCalendarFormats: const { - CalendarFormat.month: '', - CalendarFormat.week: '', - }, - calendarStyle: CalendarStyle( - outsideDaysVisible: false, - weekendStyle: TextStyle().copyWith(color: Colors.blue[800]), - holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), - ), - daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Colors.blue[600]), - ), - headerStyle: HeaderStyle( - centerHeaderTitle: true, - formatButtonVisible: false, - ), - builders: CalendarBuilders( - selectedDayBuilder: (context, date, _) { - return FadeTransition( - opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), - child: Container( - margin: const EdgeInsets.all(4.0), - padding: const EdgeInsets.only(top: 5.0, left: 6.0), - color: Colors.transparent, - width: 0, - height: 0, - child: Text( - '${date.day}', - style: TextStyle().copyWith(fontSize: 16.0), - ), - ), - ); - }, - todayDayBuilder: (context, date, _) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Colors.green[400] - : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, - ), - ), - ), - ); - }, - markersBuilder: (context, date, events, holidays) { - final children = []; - - if (events.isNotEmpty) { - children.add( - Positioned( - right: 4, - bottom: 4, - child: _buildEventsMarker(date, events), - ), - ); - } - - return children; - }, - ), - onDaySelected: (date, event, _) { - _onDaySelected(date, event, projectViewModel); - _animationController.forward(from: 0.0); + return SfCalendar( + controller: _calendarController, + minDate: DateTime.now(), + showNavigationArrow: true, + headerStyle: CalendarHeaderStyle(textAlign: TextAlign.center, textStyle: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.46)), + viewHeaderStyle: ViewHeaderStyle(dayTextStyle: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: CustomColors.black)), + view: CalendarView.month, + todayHighlightColor: CustomColors.green, + selectionDecoration: containerColorRadiusBorderWidthCircular(Colors.transparent, 4, CustomColors.green, 2.5), + cellBorderColor: Colors.white, + dataSource: MeetingDataSource(_getDataSource()), + monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date, projectViewModel); }, - onVisibleDaysChanged: _onVisibleDaysChanged, - onCalendarCreated: _onCalendarCreated, ); } + List _getDataSource() { + final List meetings = []; + _events.forEach((key, value) { + final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0); + final DateTime endTime = startTime.add(const Duration(minutes: 20)); + meetings.add(Meeting("", startTime, endTime, CustomColors.green, false)); + }); + return meetings; + } + openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { dayEvents.clear(); - DateTime dateStartObj = new DateTime( - dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); freeSlots.forEach((v) { if (v.start == dateStartObj) dayEvents.add(v); }); setState(() { - if (dayEvents.length != 0) + if (dayEvents.length != 0) { CovidTimeSlots.areSlotsAvailable = true; - else + selectedButtonIndex = 0; + CovidTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime; + } else CovidTimeSlots.areSlotsAvailable = false; - - selectedButtonIndex = 0; - - CovidTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime; }); } @@ -396,57 +292,59 @@ class _CovidTimeSlotsState extends State final DateFormat formatter = DateFormat('HH:mm'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); for (var i = 0; i < freeSlotsResponse.length; i++) { - date = - DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']); + date = DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']); 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)); + 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); + _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - CovidTimeSlots.selectedDate = dateFormatter.format( - DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); - selectedDate = DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + CovidTimeSlots.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + selectedDate = DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); selectedDateJSON = freeSlotsResponse[0]['FreeTimeSlots']; }); - openTimeSlotsPickerForDate( - DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); - _calendarController - .setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON)); + openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON); return _eventsParsed; } - Widget _buildEventsMarker(DateTime date, List events) { - return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _calendarController.isSelected(date) - ? Colors.green[400] - : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], - ), - width: 40.0, - height: 40.0, - child: Center( - child: Text( - '${date.day}', - style: TextStyle().copyWith( - color: Colors.white, - fontSize: 14.0, - ), - ), - ), - ); - } + // Widget _buildEventsMarker(DateTime date, List events) { + // return Container( + // // decoration: BoxDecoration( + // // shape: BoxShape.circle, + // // color: _calendarController.isSelected(date) + // // ? Colors.green[400] + // // : _calendarController.isToday(date) + // // ? Colors.brown[300] + // // : Colors.blue[400], + // // ), + // + // decoration: containerColorRadiusBorderWidth( + // _calendarController.isSelected(date) + // ? CustomColors.green + // : _calendarController.isToday(date) + // ? CustomColors.green.withOpacity(0.5) + // : Colors.white, + // 200, + // _calendarController.isSelected(date) ? CustomColors.green : Colors.black, + // 2), + // width: 40.0, + // height: 40.0, + // child: Center( + // child: Text( + // '${date.day}', + // style: TextStyle().copyWith( + // color: _calendarController.isSelected(date) ? Colors.white : Colors.black, + // fontSize: 13.0, + // ), + // ), + // ), + // ); + // } Widget getNormalButton(int index) { return RaisedButton( color: Colors.white, + elevation: 0, textColor: new Color(0xFF60686b), onPressed: () { setState(() { @@ -455,14 +353,14 @@ class _CovidTimeSlotsState extends State print(CovidTimeSlots.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), ); } Widget getSelectedButton(int index) { return RaisedButton( - color: Colors.blue[400], + color: CustomColors.green, //Color of the border + elevation: 0, textColor: Colors.white, onPressed: () { setState(() { @@ -471,37 +369,33 @@ class _CovidTimeSlotsState extends State print(CovidTimeSlots.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), ); } bookCovidTestAppointment() { - GifLoaderDialogUtils.showMyDialog(context); - DoctorList docObject = new DoctorList(); - docObject.doctorID = widget.selectedDoctorID; - docObject.clinicID = widget.selectedClinicID; - docObject.projectID = widget.projectID; - insertAppointmentCovidTest(context, docObject); + if(CovidTimeSlots.areSlotsAvailable) { + GifLoaderDialogUtils.showMyDialog(context); + DoctorList docObject = new DoctorList(); + docObject.doctorID = widget.selectedDoctorID; + docObject.clinicID = widget.selectedClinicID; + docObject.projectID = widget.projectID; + insertAppointmentCovidTest(context, docObject); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); + } } insertAppointmentCovidTest(context, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment( - docObject.doctorID, - docObject.clinicID, - docObject.projectID, - CovidTimeSlots.selectedTime, - CovidTimeSlots.selectedDate, - context, - widget.selectedProcedure.procedureID) + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, context, widget.selectedProcedure.procedureID) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); + getToDoCount(); + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, docObject.projectID, docObject); } else { GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); @@ -532,8 +426,20 @@ class _CovidTimeSlotsState extends State }); } - cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, - BuildContext context) { + getToDoCount() { + toDoProvider.setState(0, true, toDoProvider.notificationsCount); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + } else {} + }).catchError((err) { + print(err); + }); + } + + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); @@ -551,12 +457,9 @@ class _CovidTimeSlotsState extends State }); } - getPatientShare(context, String appointmentNo, int clinicID, int projectID, - DoctorList docObject) { + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); - service - .getPatientShare(appointmentNo, clinicID, projectID, context) - .then((res) { + service.getPatientShare(appointmentNo, clinicID, projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); @@ -571,8 +474,7 @@ class _CovidTimeSlotsState extends State Navigator.push( context, FadePage( - page: CovidPaymentAlert( - patientShareResponse: widget.patientShareResponse), + page: CovidPaymentAlert(patientShareResponse: widget.patientShareResponse), ), ); } @@ -586,14 +488,7 @@ class _CovidTimeSlotsState extends State if (res['COVID19_FreeTimeSlots'].length != 0) { freeSlotsResponse = res['COVID19_FreeTimeSlots']; _getJSONSlots().then((value) => { - setState(() => { - widget.selectedClinicID = - freeSlotsResponse[0]['ClinicID'], - widget.selectedDoctorID = - freeSlotsResponse[0]['DoctorID'], - _events.clear(), - _events = value - }) + setState(() => {widget.selectedClinicID = freeSlotsResponse[0]['ClinicID'], widget.selectedDoctorID = freeSlotsResponse[0]['DoctorID'], _events.clear(), _events = value}) }); } else {} } else { @@ -601,7 +496,59 @@ class _CovidTimeSlotsState extends State AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); print(err); }); } } + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List source) { + appointments = source; + } + + @override + DateTime getStartTime(int index) { + return _getMeetingData(index).from; + } + + @override + DateTime getEndTime(int index) { + return _getMeetingData(index).to; + } + + @override + String getSubject(int index) { + return _getMeetingData(index).eventName; + } + + @override + Color getColor(int index) { + return _getMeetingData(index).background; + } + + @override + bool isAllDay(int index) { + return _getMeetingData(index).isAllDay; + } + + Meeting _getMeetingData(int index) { + final dynamic meeting = appointments[index]; + Meeting meetingData; + if (meeting is Meeting) { + meetingData = meeting; + } + return meetingData; + } +} + +class Meeting { + Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay); + + String eventName; + DateTime from; + DateTime to; + Color background; + bool isAllDay; +} diff --git a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart index 0f07081f..78ee36f0 100644 --- a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart +++ b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart @@ -1,16 +1,20 @@ import 'dart:convert'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.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_new.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'; import 'covid-payment-details.dart'; @@ -34,87 +38,230 @@ class CovidDirveThruQuestionsState extends State { } TranslationBase localize; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { localize = TranslationBase.of(context); var isArabic = localize.isArabic(); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(20), - child: Text(localize.covidSelectProcedure, style: TextStyle(fontSize: 17, letterSpacing: 1, fontWeight: FontWeight.bold)), - ), Expanded( - child: ListView.separated( - padding: EdgeInsets.symmetric(horizontal: 20), - itemCount: qa.length, - itemBuilder: (ctx, idx) { - var obj = qa[idx]; - var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; - - return Padding( - padding: const EdgeInsets.symmetric(vertical: 10), + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(qtext, style: TextStyle(fontSize: 15, letterSpacing: 1.5)), - Row( - children: [ - Radio( - value: 1, - groupValue: obj["ans"], - onChanged: (newValue) { - setState(() { - obj["ans"] = newValue; - }); - }), - Text(localize.yes), - ], + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).covidBookAppo, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + letterSpacing: -0.64, + ), + ), + mHeight(6), + Row( + children: [ + Text( + TranslationBase.of(context).patientName + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).nationalIdNumber + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.patientIdentificationNo, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ), + ), + ), + ), + mHeight(12), + Text( + TranslationBase.of(context).covidQuestionnaire, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, + ), + ), + mHeight(12), + ListView.separated( + itemCount: qa.length, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (ctx, idx) { + var obj = qa[idx]; + var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; + + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + qtext, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + Radio( + value: 1, + groupValue: obj["ans"], + onChanged: (newValue) { + setState(() { + obj["ans"] = newValue; + checkAllChecked(); + }); + }), + Text( + localize.yes, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 0, + groupValue: obj["ans"], + onChanged: (newValue) { + setState(() { + obj["ans"] = newValue; + checkAllChecked(); + }); + }), + Text( + localize.no, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ) + ], + ), + ], + ), + ); + }, + separatorBuilder: (ctx, idx) => Container(), ), - Row( - children: [ - Radio( - value: 0, - groupValue: obj["ans"], - onChanged: (newValue) { - setState(() { - obj["ans"] = newValue; - }); - }), - Text(localize.no), - ], - ) ], ), - ); - }, - separatorBuilder: (ctx, idx) => Divider(height: 0.25, color: Colors.grey.withOpacity(0.5)), - )), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), - child: FractionallySizedBox( - widthFactor: 1, - child: MaterialButton( + ), + ), + ), + Card( + margin: EdgeInsets.zero, + elevation: 0, + child: Container( + padding: EdgeInsets.all(12), + child: FractionallySizedBox( + widthFactor: 1, + child: MaterialButton( height: 50, - color: Theme.of(context).appBarTheme.color, + elevation: 0, + color: all2 ? CustomColors.accentColor : CustomColors.grey, disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), child: Text( localize.next, - style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.44, + color: Colors.white, + ), ), - onPressed: next), + onPressed: next, + ), + ), ), ), ], )); } + bool all2 = false; + + checkAllChecked() { + all2 = true; + qa.forEach((element) { + if (element["ans"] == 2 || element["ans"] == null) { + all2 = false; + } + }); + } + next() async { bool all = true; qa.forEach((element) { @@ -132,7 +279,7 @@ class CovidDirveThruQuestionsState extends State { openPassportUpdatePage() { Navigator.push(context, FadePage(page: PassportUpdatePage())).then((value) { print(value); - if(value != null && value == true) { + if (value != null && value == true) { getPaymentInfo(context, widget.projectId); } }); diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index 4040abf5..a0842a73 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -6,12 +6,15 @@ import 'package:diplomaticquarterapp/models/CovidDriveThru/DriveThroughTestingCe import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-details.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -34,6 +37,7 @@ class _CovidDrivethruLocationState extends State { List imagesInfo = List(); DriveThroughTestingCenterModel selectedProject; + final GlobalKey locationDropdownKey = GlobalKey(); ProjectViewModel projectViewModel; @@ -54,174 +58,200 @@ class _CovidDrivethruLocationState extends State { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/covid/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/covid/ar/0.png')); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).covidInfo, isShowDecPage: true, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).resultHeader, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22.0, color: Colors.black)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 16.0, color: Colors.black)), - ), - Container( - margin: EdgeInsets.only(top: 20.0), - alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.grey[700])), - ), - Container( - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey[400], - width: 1.0, - ), - borderRadius: BorderRadius.circular(10), - ), - padding: EdgeInsets.all(8.0), - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.only(top: 15.0), - child: DropdownButtonHideUnderline( - child: DropdownButton( - hint: new Text(TranslationBase.of(context).selectAddress), - value: selectedProject, - items: projectsList.map((DriveThroughTestingCenterModel item) { - return new DropdownMenuItem( - value: item, - child: new Text(item.projectName), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - selectedProject = newValue; - setProjectLocation(newValue); - }); - }, - ), - )), - isLocationSelected - ? Container( - margin: EdgeInsets.only(top: 15.0), - alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, - child: Text(TranslationBase.of(context).selectLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, letterSpacing: 0.8, color: Colors.black)), - ) - : Container(), - isLocationSelected - ? Container( - margin: EdgeInsets.only(top: 5.0), - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[400], width: 1.0), - ), - child: Image.network("https://maps.googleapis.com/maps/api/staticmap?center=" + - this.projectLat + - "," + - this.projectLong + - "&zoom=15&size=800x400&maptype=roadmap&markers=color:red%7C" + - this.projectLat + - "," + - this.projectLong + - "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"), - ) - : SizedBox( - height: MediaQuery.of(context).size.height * 0.35, - ), - Container( - height: MediaQuery.of(context).size.height * 0.15, - width: double.infinity, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( child: Column( + mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.91, - height: 45.0, - child: RaisedButton( - color: new Color(0xFFc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.red[300], - onPressed: () { - getDirections(); - }, - child: Text(TranslationBase.of(context).getDirections, style: TextStyle(fontSize: 18.0)), - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: () { - back(); - }, - child: Text(TranslationBase.of(context).back, style: TextStyle(fontSize: 18.0)), - ), - ), - ), + Padding( + padding: const EdgeInsets.only(left: 14, right: 14), + child: Column( + children: [ + Container( + alignment: projectViewModel.isArabic ? Alignment.centerRight : Alignment.centerLeft, + child: Text(TranslationBase.of(context).resultHeader, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0, color: Colors.black, letterSpacing: -1.14)), + ), + Container( + margin: EdgeInsets.only(top: 6.0), + child: Text(TranslationBase.of(context).covidInfo, style: TextStyle(fontSize: 14.0, color: Colors.black, letterSpacing: -0.56)), ), - Expanded( - flex: 1, + InkWell( + onTap: () { + // dropdownKey.currentState; + // openDropdown(clinicDropdownKey); + }, child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: () { - next(); - }, - child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), - ), + 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: new Text(item.projectName), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + selectedProject = newValue; + setProjectLocation(newValue); + }); + }, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], ), ), ), ], ), ), + mHeight(20), + isLocationSelected + ? Stack( + children: [ + Container( + margin: EdgeInsets.only(top: 5.0), + child: Image.network("https://maps.googleapis.com/maps/api/staticmap?center=" + + this.projectLat + + "," + + this.projectLong + + "&zoom=15&size=800x400&maptype=roadmap&markers=color:red%7C" + + this.projectLat + + "," + + this.projectLong + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"), + ), + 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, + ), + ) + ], + ), + ), + ), + ), + ], + ), + ], + ) + : SizedBox( + height: MediaQuery.of(context).size.height * 0.35, + ), + mHeight(12), ], ), ), - ], + ), + ), + Card( + elevation: 0, + margin: EdgeInsets.zero, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: CustomColors.accentColor, + elevation: 0, + onPressed: () { + next(); + }, + child: Text( + TranslationBase.of(context).next, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.44, + ), + ), + ), + )), ), - ), + ], ), ); } @@ -284,11 +314,8 @@ class _CovidDrivethruLocationState extends State { CovidDriveThruService service = new CovidDriveThruService(); GifLoaderDialogUtils.showMyDialog(context); - CovidTestProceduresResponse covidTestProceduresResponse = new CovidTestProceduresResponse(); - service.getCovidTestProceduresList(context).then((res) { if (res['MessageStatus'] == 1) { - print(res); setState(() { res['COVID19_TestProceduresList'].forEach((v) { proceduresList.add(new CovidTestProceduresResponse.fromJson(v)); diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart index ca6640c0..2b2121d0 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-alert.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -2,14 +2,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-summary.dart'; -import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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'; class CovidPaymentAlert extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -29,213 +29,135 @@ class _CovidPaymentAlertState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 200.0, - color: new Color(0xFFc5272d), - child: Row( + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(left: 50.0), - child: SvgPicture.asset( - 'assets/images/new-design/alert_icon.svg', - width: 80.0, - height: 80.0), - ), - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, + color: new Color(0xFFc5272d), + padding: EdgeInsets.all(20), + child: Row( children: [ - Container( - margin: EdgeInsets.only(left: 30.0, right: 20.0), - child: Text(TranslationBase.of(context).covidAlert, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 24.0)), + Icon( + Icons.warning_outlined, + color: Colors.white, ), - Container( - width: MediaQuery.of(context).size.width * 0.55, - margin: EdgeInsets.only( - left: 30.0, right: 20.0, top: 5.0), + mWidth(12), + Expanded( child: Text( - TranslationBase.of(context).covidAlertHeader, - // "Pay With-in 15 mins to confirm the appointment", - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.white, fontSize: 20.0)), - ), + TranslationBase.of(context).covidAlertHeader, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 16.0, + letterSpacing: -0.64, + ), + ), + ) ], ), ), - ], - ), - ), - Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).covidAlertMins, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - fontSize: 24.0, - fontWeight: FontWeight.bold)), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0), - child: Text( - TranslationBase.of(context).covidAlertInfo, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.grey[700], - fontSize: 18.0, - letterSpacing: 0.8)), - ), Container( - margin: EdgeInsets.only( - top: 40.0, bottom: 10.0, left: 0.0, right: 20.0), - child: Text(TranslationBase.of(context).appoInfo, - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700], - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(left: 0.0, bottom: 20.0), - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.grey[200], - boxShadow: [ - BoxShadow(color: Colors.grey, spreadRadius: 2), - ], - ), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only( - top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text(TranslationBase.of(context).covidTest, - style: TextStyle( - fontSize: 18.0, - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.local_hospital, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse.projectName != - null - ? widget - .patientShareResponse.projectName - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.date_range, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse - .appointmentDate != - null - ? getDate(widget.patientShareResponse - .appointmentDate) - .split(" ")[0] - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], + Text( + TranslationBase.of(context).covidAlertMins, + style: TextStyle( + fontSize: 19.0, + letterSpacing: -1.6, + fontWeight: FontWeight.bold, ), ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: Icon( - Icons.access_time, - size: 24, - color: Colors.grey[700], - )), - Container( - child: Text( - widget.patientShareResponse - .appointmentDate != - null - ? getDate(widget.patientShareResponse - .appointmentDate) - .split(" ")[1] - : "NULL", - style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), - ), - ], + Text( + TranslationBase.of(context).covidAlertInfo, + style: TextStyle( + color: Colors.grey[700], + fontSize: 14.0, + letterSpacing: -0.56, ), ), + mHeight(20), Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Row( - children: [ - Container( - margin: - EdgeInsets.only(left: 20.0, right: 20.0), - child: SvgPicture.asset( - "assets/images/new-design/track_icon.svg", - width: 20.0, - height: 20.0)), - Container( - child: Text( - widget.patientShareResponse.doctorNameObj != - null - ? widget - .patientShareResponse.doctorNameObj - : "NULL", + width: double.infinity, + child: Container( + margin: EdgeInsets.zero, + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).appoInfo, style: TextStyle( - fontSize: 18.0, - color: Colors.grey[700])), + fontSize: 16.0, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, + ), + ), + mHeight(16), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).hospital + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.projectName != null ? widget.patientShareResponse.projectName : "NULL", + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).date + ":", + ), + mWidth(6), + _getNormalText( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.patientShareResponse.appointmentDate)), + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).time + ":", + ), + mWidth(6), + _getNormalText( + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.patientShareResponse.appointmentDate), false), + isBold: true, + ), + ], + ), + mHeight(4), + Row( + children: [ + _getNormalText( + TranslationBase.of(context).route + ":", + ), + mWidth(6), + _getNormalText( + widget.patientShareResponse.doctorNameObj != null ? widget.patientShareResponse.doctorNameObj : "NULL", + isBold: true, + ), + ], + ), + ], ), - ], + ), ), ), ], @@ -244,39 +166,52 @@ class _CovidPaymentAlertState extends State { ], ), ), - ], - ), - ), - bottomSheet: Container( - margin: EdgeInsets.all(10.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: () { - startPaymentProcess(); - }, - child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), + ), + Card( + margin: EdgeInsets.zero, + elevation: 0, + child: Container( + margin: EdgeInsets.all(12), + width: double.infinity, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + elevation: 0, + onPressed: () { + startPaymentProcess(); + }, + child: Text( + TranslationBase.of(context).next, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + ), ), ), ), ), - ], - ), + ), + ], + ), + ); + } + + _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, ), ); } @@ -285,31 +220,31 @@ class _CovidPaymentAlertState extends State { navigateToPaymentMethod(context, widget.patientShareResponse); } - Future navigateToPaymentMethod( - context, PatientShareResponse patientShareResponse) async { + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse) async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); } Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { - print(value); - if (value != null) { - Navigator.push( - context, - FadePage( - page: CovidPaymentSummary( - patientShareResponse: widget.patientShareResponse, - selectedPaymentMethod: value.toString()), - ), - ); - } - }); + context, + FadePage( + page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: "MADA"), + ), + ); + // Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { + // print(value); + // if (value != null) { + // Navigator.push( + // context, + // FadePage( + // page: CovidPaymentSummary(patientShareResponse: widget.patientShareResponse, selectedPaymentMethod: value.toString()), + // ), + // ); + // } + // }); } String getDate(String appoDate) { diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index 67b973fe..2301de51 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -1,14 +1,18 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.dart'; import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/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:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; class CovidPaymentDetails extends StatefulWidget { CovidPaymentInfoResponse covidPaymentInfoResponse; @@ -16,10 +20,7 @@ class CovidPaymentDetails extends StatefulWidget { List proceduresList; CovidTestProceduresResponse selectedProcedure; - CovidPaymentDetails( - {@required this.covidPaymentInfoResponse, - @required this.projectID, - @required this.proceduresList}); + CovidPaymentDetails({@required this.covidPaymentInfoResponse, @required this.projectID, @required this.proceduresList}); @override _CovidPaymentDetailsState createState() => _CovidPaymentDetailsState(); @@ -36,79 +37,25 @@ class _CovidPaymentDetailsState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 100.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 150.0, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/images/new-design/covid-19-big-banner-bg.png"), - fit: BoxFit.fill, - ), - color: Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), - child: SvgPicture.asset( - 'assets/images/new-design/covid-19-car.svg', - width: 90.0, - height: 90.0), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - left: 20.0, right: 20.0, top: 20.0), - child: Text(TranslationBase.of(context).covidTest, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 24.0)), - ), - Container( - margin: EdgeInsets.only( - left: 20.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).driveThru, - style: TextStyle( - color: Colors.white, fontSize: 24.0)), - ), - ], - ), - ], - ), - ), - 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(10.0, 0.0, 10.0, 20.0), + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + // margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 100.0), + + child: Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(16), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - alignment: Alignment.center, - margin: - EdgeInsets.only(left: 0.0, right: 20.0, top: 10.0), - child: Text( - TranslationBase.of(context).covidSelectProcedure, - style: TextStyle( - color: Colors.black, - fontSize: 20.0, - fontWeight: FontWeight.bold)), - ), + Text(TranslationBase.of(context).covidSelectProcedure, style: TextStyle(color: Colors.black, fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.bold)), ...List.generate( widget.proceduresList.length, (index) => Column( @@ -124,33 +71,35 @@ class _CovidPaymentDetailsState extends State { child: InkWell( onTap: () { setState(() { - widget.selectedProcedure = - widget.proceduresList[index]; + widget.selectedProcedure = widget.proceduresList[index]; + getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); }); }, - child: ListTile( - title: Text( - widget.proceduresList[index] - .procedureName, - style: TextStyle(fontSize: 14.0)), - leading: Radio( - value: widget.proceduresList[index], - groupValue: widget.selectedProcedure, - activeColor: Colors.red[800], - toggleable: true, - onChanged: (value) { - setState(() { - widget.selectedProcedure = value; - print(widget - .selectedProcedure.procedureName); - getPaymentInfo( - context, - widget.projectID.toString(), - widget.selectedProcedure - .procedureID); - }); - }, - ), + child: Row( + children: [ + Radio( + value: widget.proceduresList[index], + groupValue: widget.selectedProcedure, + activeColor: Colors.red[800], + toggleable: true, + onChanged: (value) { + setState(() { + widget.selectedProcedure = value; + print(widget.selectedProcedure.procedureName); + getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); + }); + }, + + ), + Text( + projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ) @@ -159,148 +108,197 @@ class _CovidPaymentDetailsState extends State { ], ), ), - Divider(), + Container( - alignment: Alignment.center, - margin: - EdgeInsets.only(left: 0.0, right: 20.0, top: 10.0), - child: Text(TranslationBase.of(context).testFee, - style: TextStyle( - color: Colors.black, - fontSize: 22.0, - fontWeight: FontWeight.bold)), + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).testFee, + style: TextStyle( + 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(widget.covidPaymentInfoResponse.patientShareField.toString(), 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(widget.covidPaymentInfoResponse.patientTaxAmountField.toString(), 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(widget.covidPaymentInfoResponse.patientShareWithTaxField.toString(), isBold: true), + ) + ], + ), + ), + ], + ), + ), ), - Table( - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareToDo)), - TableCell( - child: _getNormalText(widget - .covidPaymentInfoResponse.patientShareField - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientTaxToDo)), - TableCell( - child: _getNormalText(widget - .covidPaymentInfoResponse - .patientTaxAmountField - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareTotalToDo)), - TableCell( - child: _getNormalText(widget - .covidPaymentInfoResponse - .patientShareWithTaxField - .toString())), - ]), - ], + + Container( + margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); + }, + activeColor: Color(0xffB8382C), + ), + Text( + TranslationBase.of(context).agreeTo, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + mWidth(3), + Text( + TranslationBase.of(context).termsConditoins, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: CustomColors.accentColor, + fontWeight: FontWeight.w600, + decoration: TextDecoration.underline, + ), + ), + ], + ), ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: isAgree, - onChanged: (value) { - setState(() { - isAgree = !isAgree; - }); - }, - activeColor: Color(0xffB8382C), + mFlex(1), + + Text( + TranslationBase.of(context).payOptions, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), - Texts(TranslationBase.of(context) - .iAgreeToTheTermsAndConditions), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), ], ), ), - Divider( - color: Colors.grey, - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 5.0), - child: Text(TranslationBase.of(context).payOptions, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans")), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset( - "assets/images/new-design/payment_options_invoice_confirmation.png", - width: 300), - ), - ], - ), - ), - ), - bottomSheet: Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 20.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: () { - cancel(); - }, - child: Text(TranslationBase.of(context).cancel, - style: TextStyle(fontSize: 18.0)), - ), - ), - ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.grey[500], - onPressed: isAgree ? next : null, - child: Text(TranslationBase.of(context).next, - style: TextStyle(fontSize: 18.0)), + Container( + width: double.infinity, + child: Card( + elevation: 0, + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12, left: 12, right: 12), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + cancel(); + }, + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + color: Colors.white, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + mWidth(12), + Expanded( + flex: 1, + child: Container( + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: isAgree ? next : null, + child: Text( + TranslationBase.of(context).next, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ), + ], ), ), ), - ), + ) ], ), ), @@ -321,19 +319,14 @@ class _CovidPaymentDetailsState extends State { Navigator.pop(context); } - getPaymentInfo( - BuildContext context, String projectID, String selectedProcedureID) { + getPaymentInfo(BuildContext context, String projectID, String selectedProcedureID) { CovidDriveThruService service = new CovidDriveThruService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getCovidPaymentInformation( - context, int.parse(projectID), selectedProcedureID) - .then((res) { + service.getCovidPaymentInformation(context, int.parse(projectID), selectedProcedureID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - widget.covidPaymentInfoResponse = - CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']); + widget.covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson(res['COVID19_PatientShare']); }); } else {} }).catchError((err) { @@ -341,16 +334,15 @@ class _CovidPaymentDetailsState extends State { }); } - _getNormalText(text) { - return Container( - margin: EdgeInsets.only(top: 20.0, right: 10.0), - child: Text(text, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 15, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[700])), + _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, + ), ); } } diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index c3c70578..84126109 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -2,33 +2,37 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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/data_display/text.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 { PatientShareResponse patientShareResponse; - final String selectedPaymentMethod; + String selectedPaymentMethod; MyInAppBrowser browser; AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; - CovidPaymentSummary( - {@required this.patientShareResponse, this.selectedPaymentMethod}); + CovidPaymentSummary({@required this.patientShareResponse, this.selectedPaymentMethod}); @override _CovidPaymentSummaryState createState() => _CovidPaymentSummaryState(); @@ -41,6 +45,9 @@ class _CovidPaymentSummaryState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -48,30 +55,65 @@ class _CovidPaymentSummaryState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( + Text( TranslationBase.of(context).confirmThePayment, - textAlign: TextAlign.center, - fontWeight: FontWeight.w500, - fontSize: 24, + style: TextStyle( + fontSize: 19, + fontWeight: FontWeight.bold, + letterSpacing: -1.46, + ), ), SizedBox( height: 12, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Text( + TranslationBase.of(context).totalBalance + ": ", + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, + ), + ), + Text( + '${widget.patientShareResponse.patientShareWithTax} ' + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.60, + ), + ) + ], + ), + SizedBox( + height: 12, + ), + Row( + children: [ + Container( + width: 20, + height: 20, + decoration: containerColorRadiusBorderWidth(CustomColors.accentColor, 200, Colors.white, 4), + ), Container( height: 100.0, padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: - Image.asset(getImagePath(widget.selectedPaymentMethod)), + child: Image.asset(getImagePath(widget.selectedPaymentMethod), width: 100, height: 100), ), - Texts( - '${widget.patientShareResponse.patientShareWithTax} ' + - TranslationBase.of(context).sar, - fontSize: 26, - bold: true, + mFlex(1), + InkWell( + onTap: () { + showDraggableDialog(context, PaymentMethod( + onSelectedMethod: (String metohd) { + widget.selectedPaymentMethod = metohd; + setState(() {}); + }, + )); + }, + child: Text( + TranslationBase.of(context).changePayment, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: -0.48, decoration: TextDecoration.underline, color: CustomColors.accentColor), + ), ) ], ), @@ -81,63 +123,74 @@ class _CovidPaymentSummaryState extends State { Row( children: [ Expanded( - child: Container( - margin: EdgeInsets.all(3), - child: NewTextFields( - hintText: TranslationBase.of(context).fileNumber, - initialValue: - projectViewModel.user.patientID.toString(), - isEnabled: false, - ), + flex: 1, + child: showDetail( + TranslationBase.of(context).fileNumber, + projectViewModel.user.patientID.toString(), ), ), + mWidth(6), Expanded( - child: Container( - margin: EdgeInsets.all(3), - child: NewTextFields( - hintText: TranslationBase.of(context).name, - initialValue: projectViewModel.user.firstName, - isEnabled: false, - ), + flex: 1, + child: showDetail( + TranslationBase.of(context).name, + projectViewModel.user.firstName.toString(), ), ), ], ), SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).mobileNumber, - initialValue: projectViewModel.user.mobileNumber, - isEnabled: false, + height: 6, ), + showDetail(TranslationBase.of(context).mobileNumber, projectViewModel.user.mobileNumber), SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).depositorName, - initialValue: projectViewModel.user.firstName + - " " + - projectViewModel.user.middleName + - " " + - projectViewModel.user.lastName, - isEnabled: false, + height: 6, ), + showDetail( + TranslationBase.of(context).depositorName, + projectViewModel.user.firstName + " " + projectViewModel.user.middleName + " " + projectViewModel.user.lastName, + ) ], ), ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.1, + color: Theme.of(context).scaffoldBackgroundColor, + margin: EdgeInsets.only(bottom: 5.0), width: double.infinity, padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).confirm.toUpperCase(), - onTap: () { + child: DefaultButton( + TranslationBase.of(context).confirm.toUpperCase(), + () { startPaymentProcess(projectViewModel.user); }, + color: CustomColors.green, + ), + ), + ); + } + + Widget showDetail(String title, String value) { + return Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + Text( + value, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.64, color: Colors.grey), + ), + ], + ), ), ), ); @@ -149,55 +202,31 @@ class _CovidPaymentSummaryState extends State { appo.clinicID = widget.patientShareResponse.clinicID; appo.appointmentNo = widget.patientShareResponse.appointmentNo; - openPayment( - widget.selectedPaymentMethod, - authenticatedUser, - double.parse( - widget.patientShareResponse.patientShareWithTax.toString()), - widget.patientShareResponse, - appo); + openPayment(widget.selectedPaymentMethod, authenticatedUser, double.parse(widget.patientShareResponse.patientShareWithTax.toString()), widget.patientShareResponse, appo); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { - if (paymentMethod == "ApplePay") { - // await widget.chromeBrowser.open( - // url: "https://applepay-datatrans-sample.herokuapp.com/", - // options: ChromeSafariBrowserClassOptions( - // android: AndroidChromeCustomTabsOptions( - // addDefaultShareMenuItem: false), - // ios: IOSSafariOptions(barCollapsingEnabled: true))); - } else { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - widget.browser.openPaymentBrowser( - amount, - "Appointment check in", - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - appo.projectID.toString(), - authenticatedUser.emailAddress, - paymentMethod, - authenticatedUser.patientType, - authenticatedUser.firstName, - authenticatedUser.patientID, - authenticatedUser, - widget.browser, - widget.patientShareResponse.isLiveCareAppointment, - null, - null, - widget.patientShareResponse.appointmentDate, - widget.patientShareResponse.appointmentNo, - widget.patientShareResponse.clinicID, - widget.patientShareResponse.doctorID); - } + widget.browser.openPaymentBrowser( + amount, + "Appointment check in", + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName, + authenticatedUser.patientID, + authenticatedUser, + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + "2", + "", + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); } onBrowserLoadStart(String url) { @@ -223,18 +252,22 @@ class _CovidPaymentSummaryState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); - if (isPaymentMade) checkPaymentStatus(appo); + if (isPaymentMade) { + checkPaymentStatus(appo); + } else { + print("onBrowserExit Payment Not made"); + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route route) => false, + ); + } } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -254,15 +287,9 @@ class _CovidPaymentSummaryState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], context) - .then((res) { + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString()); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString()); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -270,13 +297,9 @@ class _CovidPaymentSummaryState extends State { }); } - addAdvancedNumberRequest( - String advanceNumber, String paymentReference, String appointmentID) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { print(res); getAppoQR(context); }).catchError((err) { @@ -288,9 +311,7 @@ class _CovidPaymentSummaryState extends State { getAppoQR(context) { DoctorsListService service = new DoctorsListService(); - service - .generateAppointmentQR(widget.patientShareResponse, context) - .then((res) { + service.generateAppointmentQR(widget.patientShareResponse, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); navigateToQR(context, res['AppointmentQR']); @@ -314,22 +335,25 @@ class _CovidPaymentSummaryState extends State { String getImagePath(String paymentMethod) { switch (paymentMethod) { case "MADA": - return 'assets/images/new-design/mada.png'; - break; - case "SADAD": - return 'assets/images/new-design/sadad.png'; + return 'assets/images/new/payment/Mada.png'; break; + // case "SADAD": + // return 'assets/images/new-design/sadad.png'; + // break; case "VISA": - return 'assets/images/new-design/visa.png'; + return 'assets/images/new/payment/visa.png'; break; case "MASTERCARD": - return 'assets/images/new-design/mastercard.png'; + return 'assets/images/new/payment/Mastercard.png'; break; case "Installment": - return 'assets/images/new-design/installment.png'; + return 'assets/images/new/payment/installments.png'; + break; + case "ApplePay": + return 'assets/images/new/payment/Apple_Pay.png'; break; } - return 'assets/images/new-design/mada.png'; + return 'assets/images/new/payment/Mada.png'; } } diff --git a/lib/pages/DrawerPages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart index 35b19ccd..6d9064d7 100644 --- a/lib/pages/DrawerPages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -1,23 +1,23 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart'; -import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_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/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'add-family_type.dart'; @@ -39,6 +39,8 @@ class _AddMember extends State { var familyFileProvider = FamilyFilesProvider(); var patientShareRequestID; + var patientShareResponseID; + @override void initState() { super.initState(); @@ -47,79 +49,75 @@ class _AddMember extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).myFamilyFiles, - isShowAppBar: true, - body: isLoading == true - ? AppCircularProgressIndicator() - : SingleChildScrollView( - child: Container( - padding: - EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + appBarTitle: TranslationBase.of(context).myFamilyFiles, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + body: isLoading == true + ? AppCircularProgressIndicator() + : SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(21.0), height: SizeConfig.realScreenHeight * .9, width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 2, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - )), - Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Colors.red), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - )) - ], - ), - ), - Expanded( - flex: 3, + child: Column( + children: [ + Expanded( + flex: 1, + child: Text( + loginType == 1 ? TranslationBase.of(context).enterNationalId : TranslationBase.of(context).enterFile, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + )), + Expanded( + flex: 4, child: Column( - mainAxisAlignment: MainAxisAlignment.end, children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).add, - () => {this.addMember()}, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900], - textColor: Colors.white, - )) - ], + PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + SizedBox( + height: 12, ), + inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile), ], - )) - ]), - ))); + ), + ), + // Expanded( + // flex: 3, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Row( + // children: [ + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).add, + // () => {this.addMember()}, + // color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + // textColor: Colors.white, + // ), + // ) + // ], + // ), + // ], + // ), + // ) + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.all(21.0), + child: DefaultButton( + TranslationBase.of(context).add, + () => {this.addMember()}, + color: isButtonDisabled == true ? Colors.grey : CustomColors.accentColor, + textColor: Colors.white, + )), + ); } void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && - mobileNo.length >= 9 && - util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && mobileNo.length >= 9 && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); @@ -145,10 +143,7 @@ class _AddMember extends State { request.isRegister = false; request.patientStatus = 2; loading(true); - familyFileProvider - .addFamilyFile(request) - .then((value) => manageFamily(value)) - .catchError(() { + familyFileProvider.addFamilyFile(request).then((value) => manageFamily(value)).catchError((err) { loading(false); }); } @@ -160,49 +155,45 @@ class _AddMember extends State { confirmMessage: addMemberResult['ShareFamilyFileObj']['Message'], okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - insertFamilyData(addMemberResult), - ConfirmDialog.closeAlertDialog(context) - }, + okFunction: () => {insertFamilyData(addMemberResult), ConfirmDialog.closeAlertDialog(context)}, cancelFunction: () => {}); dialog.showAlertDialog(context); } insertFamilyData(addMemberResult) { - var request = InsertSharePatientFileReq(); - request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; - request.shareFamilyPatientName = - addMemberResult['ShareFamilyFileObj']['SharedPatientName']; - request.status = 2; - if (request.patientOutSA == 1) { - request.regionID = 2; - } else { - request.regionID = 1; - } - loading(true); - familyFileProvider - .insertNewMember(request) - .then((value) => sendActivationCode(value)); + sendActivationCode(addMemberResult); + // var request = InsertSharePatientFileReq(); + // request.responseID = addMemberResult['ShareFamilyFileObj']['ReponseID']; + // request.shareFamilyPatientName = addMemberResult['ShareFamilyFileObj']['SharedPatientName']; + // request.status = 2; + // if (request.patientOutSA == 1) { + // request.regionID = 2; + // } else { + // request.regionID = 1; + // } + // loading(true); + // familyFileProvider.insertNewMember(request).then((value) => sendActivationCode(value)).catchError((err) { + // loading(false); + // AppToast.showErrorToast(message: err); + // }); } sendActivationCode(result) { // var request = this.getCommonRequest(); loading(true); - patientShareRequestID = result['PatientShareRequestID']; - familyFileProvider - .sendActivationCode(mobileNo, countryCode, nationalIDorFile.text) - .then((result) => { - if (result != null && result['isSMSSent'] == true) - {this.startSMSService(1, result)} - // {loading(false), this.startSMSService(type)} - // else - // {loading(false)} - }); + patientShareResponseID = result['ShareFamilyFileObj']['ReponseID']; + familyFileProvider.sendActivationCode(mobileNo, countryCode, nationalIDorFile.text, patientShareResponseID).then((res) => { + patientShareRequestID = res['PatientShareRequestID'], + if (res != null && res['isSMSSent'] == true) {this.startSMSService(1, res)} + }); } + var tempType; + startSMSService(type, result) { + tempType = type; loading(false); - SMSOTP( + SMSOTP( context, type, mobileNo, @@ -210,30 +201,32 @@ class _AddMember extends State { this.checkActivationCode(value, result); }, () => { - print('Faild..'), + Navigator.pop(context), }, ).displayDialog(context); } checkActivationCode(value, result) { - familyFileProvider - .checkActivationCode( - result['LogInTokenID'], value, nationalIDorFile.text, mobileNo) - .then((result) => { - SMSOTP.hideSMSBox(context), - handleFamilyRequests(this.patientShareRequestID, 3) - }); + Navigator.pop(context); + GifLoaderDialogUtils.showMyDialog(context); + familyFileProvider.checkActivationCode(result['LogInTokenID'], value, nationalIDorFile.text, mobileNo, patientShareRequestID, patientShareResponseID).then((result) { + SMSOTP.hideSMSBox(context); + handleFamilyRequests(this.patientShareRequestID, 3); + }).catchError((err) { + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + startSMSService(tempType, result); + }); + }); } handleFamilyRequests(id, stauts) { - familyFileProvider - .acceptAndRejectRecievedRequests(id, stauts) - .then((result) => { - sharedPref.remove(FAMILY_FILE), - Navigator.of(context).pushNamed( - MY_FAMILIY, - ) - }); + // familyFileProvider.acceptAndRejectRecievedRequests(id, stauts).then((result) => { + sharedPref.remove(FAMILY_FILE); + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + // }); } loading(flag) { @@ -241,4 +234,86 @@ class _AddMember extends State { isLoading = flag; }); } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } } diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index e4a82cb4..60e396c6 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -1,13 +1,13 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/routes.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:diplomaticquarterapp/widgets/habib_logo_widget.dart'; class AddFamilyMemberType extends StatelessWidget { static int loginType = 0; @@ -16,139 +16,204 @@ class AddFamilyMemberType extends StatelessWidget { return AppScaffold( appBarTitle: TranslationBase.of(context).myFamilyFiles, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( - padding: EdgeInsets.all(20), - child: Column( - children: [ - Expanded( - flex: 6, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 80, - width: 80, - ), - Padding( - padding: EdgeInsets.all(20), - child: AppText( - TranslationBase.of(context).registerInfoFamily, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - ), - ), - Padding( - padding: EdgeInsets.all(20), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - AddFamilyMemberType.loginType = 1, - Navigator.of(context) - .pushNamed(ADD_FAMILY_MEMBER) - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 20, 10, 20, 10), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/id_card_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .idNo, - fontSize: SizeConfig - .textMultiplier * - 2, - ) - ], - ), - )))), - Expanded( - child: InkWell( - onTap: () => { - AddFamilyMemberType.loginType = 2, - Navigator.of(context) - .pushNamed(ADD_FAMILY_MEMBER) - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 25, 10, 25, 10), - child: Column( - children: [ - Image.asset( - 'assets/images/my_file_white_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .fileNo, - fontSize: SizeConfig - .textMultiplier * - 2, - ) - ], - ), - )))) - ], - )), - Divider( - color: Colors.grey, - height: 2, - ), - ]), - ), - // Expanded( - // flex: 2, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Row( - // children: [ - // Expanded( - // child: DefaultButton( - // TranslationBase.of(context).registerNow, - // () => { - // Navigator.of(context).pushNamed( - // REGISTER, - // ) - // }, - // )) - // ], - // ), - // ], - // )) - ], - ))); + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column(children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 21), + HabibLogoWidget(), + SizedBox(height: 21), + Text( + TranslationBase.of(context).registerInfoFamily, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 25), + shrinkWrap: true, + children: [ + getButton(context, TranslationBase.of(context).nationalIdNumber, 'assets/images/new/national_id.svg', 1), + getButton(context, TranslationBase.of(context).medicalFileNumber, 'assets/images/new/medical_file.svg', 2), + ], + ), + SizedBox(height: 20), + // RichText( + // text: TextSpan( + // 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 = () => Navigator.of(context).push(FadePage(page: ForgotPassword())), + // ), + // ), + ], + ), + ), + // SizedBox( + // height: 43, + // width: double.infinity, + // child: FlatButton( + // onPressed: () {}, + // child: Text( + // TranslationBase.of(context).registerNow, + // style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + // ), + // color: Color(0xffD02127), + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(6), + // ), + // ), + // ), + ]), + )); + // body: Padding( + // padding: EdgeInsets.all(20), + // child: Column( + // children: [ + // Expanded( + // flex: 6, + // child: Column( + // // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Image.asset( + // 'assets/images/habib-logo.png', + // height: 80, + // width: 80, + // ), + // Padding( + // padding: EdgeInsets.all(20), + // child: AppText( + // TranslationBase.of(context).registerInfoFamily, + // fontSize: SizeConfig.textMultiplier * 3.5, + // textAlign: TextAlign.left, + // ), + // ), + // Padding( + // padding: EdgeInsets.all(20), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Expanded( + // child: InkWell( + // onTap: () => {AddFamilyMemberType.loginType = 1, Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER)}, + // child: RoundedContainer( + // borderColor: Colors.grey, + // showBorder: true, + // child: Padding( + // padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // 'assets/images/id_card_icon.png', + // height: SizeConfig.imageSizeMultiplier * 12, + // width: SizeConfig.imageSizeMultiplier * 15, + // ), + // SizedBox( + // height: 20, + // ), + // AppText( + // TranslationBase.of(context).idNo, + // fontSize: SizeConfig.textMultiplier * 2, + // ) + // ], + // ), + // )))), + // Expanded( + // child: InkWell( + // onTap: () => {AddFamilyMemberType.loginType = 2, Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER)}, + // child: RoundedContainer( + // borderColor: Colors.grey, + // showBorder: true, + // child: Padding( + // padding: EdgeInsets.fromLTRB(25, 10, 25, 10), + // child: Column( + // children: [ + // Image.asset( + // 'assets/images/my_file_white_icon.png', + // height: SizeConfig.imageSizeMultiplier * 12, + // width: SizeConfig.imageSizeMultiplier * 15, + // ), + // SizedBox( + // height: 20, + // ), + // AppText( + // TranslationBase.of(context).fileNo, + // fontSize: SizeConfig.textMultiplier * 2, + // ) + // ], + // ), + // )))) + // ], + // )), + // Divider( + // color: Colors.grey, + // height: 2, + // ), + // ]), + // ), + // // Expanded( + // // flex: 2, + // // child: Column( + // // mainAxisAlignment: MainAxisAlignment.end, + // // children: [ + // // Row( + // // children: [ + // // Expanded( + // // child: DefaultButton( + // // TranslationBase.of(context).registerNow, + // // () => { + // // Navigator.of(context).pushNamed( + // // REGISTER, + // // ) + // // }, + // // )) + // // ], + // // ), + // // ], + // // )) + // ], + // ))); + } + + Widget getButton(BuildContext _context, String _title, String _icon, int _flag) { + return InkWell( + onTap: () { + AddFamilyMemberType.loginType = _flag; + Navigator.of(_context).pushNamed(ADD_FAMILY_MEMBER); + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: 38, + width: 38, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 7493dfc1..f3658fae 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,44 +1,47 @@ import 'dart:ui'; -import 'package:diplomaticquarterapp/config/size_config.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/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' - as list; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/routes.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; - MyFamily({this.isAppbarVisible = true}); + Function onBackClick; + + MyFamily({this.isAppbarVisible = true, this.onBackClick}); + @override _MyFamily createState() => _MyFamily(); } @@ -50,17 +53,16 @@ class _MyFamily extends State with TickerProviderStateMixin { var userID; TabController _tabController; int _tabIndex = 0; - AuthenticatedUserObject authenticatedUserObject = - locator(); - AppointmentRateViewModel appointmentRateViewModel = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); + AppointmentRateViewModel appointmentRateViewModel = locator(); ProjectViewModel projectViewModel; AuthenticatedUser user; VitalSignService _vitalSignService = locator(); - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); - + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + ToDoCountProviderModel toDoProvider; var isVaiable = false; + bool isSwitchUser = false; + @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -73,263 +75,211 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget build(BuildContext context) { imagesInfo.add( ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), ); imagesInfo.add( ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), ); projectViewModel = Provider.of(context); + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).myFamilyFiles, isShowAppBar: widget.isAppbarVisible, imagesInfo: imagesInfo, + showNewAppBar: true, + showNewAppBarTitle: true, + onTap: widget.isAppbarVisible == false ? widget.onBackClick : null, + icon: "assets/images/new/bottom_nav/family_files.svg", description: TranslationBase.of(context).familyInfo, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, // 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, - indicatorSize: TabBarIndicatorSize.tab, - - indicatorColor: Theme.of(context).primaryColor, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: AppText(TranslationBase.of(context).family), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: AppText(TranslationBase.of(context).request), - ), - ), - ], - ), - ), - ), - ), - ], + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).family), Text(TranslationBase.of(context).request)], ), - ), - body: Column( - children: [ - Expanded( - child: (user != null && projectViewModel.isLogin) - ? TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - myFamilyDetails(context), - myFamilyRequest(context) - ], - ) - : Container(child: AppText('Loading..')), - ) - ], + Expanded( + child: (user != null && projectViewModel.isLogin) + ? TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [myFamilyDetails(context), myFamilyRequest(context)], + ) + : Container(child: AppText('')), + ), + ], + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + width: double.infinity, + padding: EdgeInsets.all(14), + child: DefaultButton( + TranslationBase.of(context).addFamilyMember, + () async { + Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE); + }, ), ), ); - - // return AppScaffold( - // appBarTitle: TranslationBase.of(context).myFamilyFiles, - // isShowAppBar: widget.isAppbarVisible, - // body: SingleChildScrollView( - // child: Container( - // height: SizeConfig.screenHeight * .9, - // width: SizeConfig.realScreenWidth, - // padding: EdgeInsets.all(20), - // child: Stack( - // children: [ - // TabBar( - // controller: _tabController, - // indicatorColor: Colors.red, - // tabs: [ - // Tab( - // // padding: EdgeInsets.all(6), - // child: AppText(TranslationBase.of(context).family)), - // Tab( - // // padding: EdgeInsets.all(6), - // child: - // AppText(TranslationBase.of(context).request)), - // ], - // ), - // TabBarView( - // controller: _tabController, - // children: [ - // myFamilyDetails(context), - // myFamilyRequest(context) - // ], - // ) - // ], - // )))); } Widget myFamilyDetails(context) { return Container( - height: MediaQuery.of(context).size.height, - margin: EdgeInsets.fromLTRB(20.0, 25.0, 20.0, 0.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Column( children: [ Expanded( flex: 4, child: FutureBuilder( future: getFamilyFiles(), // async work - builder: (BuildContext context, - AsyncSnapshot - snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); + return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading...')); default: if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text( - TranslationBase.of(context).noDataAvailable)); + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); else - return Padding( - padding: EdgeInsets.only(top: 50), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Text( - TranslationBase.of(context).request)), - Expanded( - flex: 2, - child: Text( - TranslationBase.of(context).switchUser, - )), - Expanded( - flex: 1, - child: Text( - TranslationBase.of(context).deleteView, - )), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return result.status == 3 - ? Padding( + return checkActive(snapshot.data.getAllSharedRecordsByStatusList) > 0 + ? ListView.separated( + itemBuilder: (context, index) { + if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) + return Container( + margin: EdgeInsets.all(5), + decoration: cardRadius( + 15, + elevation: 0, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), + ), + child: Container( + // height: 130,0xffFDA4B0 + width: MediaQuery.of(context).size.width, padding: EdgeInsets.all(10), child: Row( - children: [ - Expanded( - flex: 3, - child: Text( - result.patientName)), - Expanded( - flex: 2, - child: IconButton( - icon: Icon(Icons.group), - color: Colors.black, - onPressed: () { - switchUser( - result, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteFamily( - result, context); - }, - )), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(), + fontSize: 12, color: Colors.white), + Texts( + snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() + + ' ' + + TranslationBase.of(context).years + + ', ' + + snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription, + fontSize: 12, + color: Colors.white), + ], + ), + Column( + children: [ + SizedBox(height: 10), + InkWell( + onTap: () { + switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/switch.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + // CupertinoSwitch( + // value: isSwitchUser, + // onChanged: (value) { + // setState(() { + // isSwitchUser = value; + // }); + // if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context); + // }, + // ), + Texts(TranslationBase.of(context).switchUser, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600) + ], + ))), + SizedBox( + height: 10, + ), + InkWell( + onTap: () { + deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context); + }, + child: Container( + decoration: BoxDecoration(color: Colors.black.withOpacity(0.1), borderRadius: BorderRadius.circular(20)), + padding: EdgeInsets.fromLTRB(15, 10, 15, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new-design/delete.svg", + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), + SizedBox( + width: 5, + ), + Texts(TranslationBase.of(context).delete, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, + fontSize: 12, + fontWeight: FontWeight.w600), + ], + ))), + SizedBox(height: 10), + ], + ), ], - )) - : SizedBox(); - }).toList()) - ])); + ))); + // else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0) + // return getNoDataWidget(context); + else + return SizedBox(height: 0); + }, + separatorBuilder: (context, index) => SizedBox(height: 0), + itemCount: snapshot.data.getAllSharedRecordsByStatusList.length) + : getNoDataWidget(context); } }, ), ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).addFamilyMember, - () => { - Navigator.of(context) - .pushNamed(ADD_FAMILY_MEMBER_TYPE) - }, - color: Colors.grey[900], - textColor: Colors.white, - )) - ], - ), - ], - ), - ) + SizedBox(height: 80.0) ], )); } + int checkActive(List list) { + return list.where((o) => o.status == 3).toList().length; + } + Widget myFamilyRequest(context) { return //Padding( // padding: const EdgeInsets.symmetric(horizontal: 10.0), @@ -337,299 +287,278 @@ class _MyFamily extends State with TickerProviderStateMixin { SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height, - margin: EdgeInsets.only(top: 65), + margin: EdgeInsets.only(top: 10), child: Column( children: [ - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).userViewRequest, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + FractionallySizedBox( + widthFactor: 1.0, + child: AppExpandableNotifier( + title: TranslationBase.of(context).userViewRequest, + bodyWidget: FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return SizedBox(); + + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); + else + return ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Column( + children: [ + Column(children: [ + Padding( + padding: EdgeInsets.all(10), + child: Row(children: [ + Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), + ])), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), + Column( + children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { + return Container( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Texts( + result.patientName, + fontWeight: FontWeight.w600, + fontSize: 12, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/allow.svg", height: 22), + onPressed: () { + acceptRemoveRequest(result.iD, 3, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: SvgPicture.asset("assets/images/new-design/reject.svg", height: 22), + color: Colors.white, + onPressed: () { + acceptRemoveRequest(result.iD, 4, context); + }, + )) + ], + )); + }).toList()) + ]) + ], + )); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: 1); + } + }, ), - children: [ - FutureBuilder( - future: getUserViewRequest(), // async work - builder: (BuildContext context, - AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text(TranslationBase.of(context) - .noDataAvailable)); - else - return Column( - children: [ - // Padding(padding: EdgeInsets.only(left:10, right:10), - // child: - // Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Expanded( - // flex: 3, - // child: Text(TranslationBase.of(context) - // .request)), - // Expanded( - // flex: 2, - // child: Text( - // TranslationBase.of(context) - // .switchUser, - // )), - // Expanded( - // flex: 1, - // child: Text( - // TranslationBase.of(context) - // .deleteView, - // )), - // ], - // )), - Column(children: [ - Padding( - padding: EdgeInsets.only( - left: 10, right: 10), - child: Row(children: [ - Expanded( - flex: 3, - child: AppText( - TranslationBase.of(context) - .name)), - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context) - .allow)), - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context) - .reject)), - ])), - Column( - children: familyFileProvider - .allSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: - Text(result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.check_circle, - color: Colors.black, - ), - onPressed: () { - acceptRemoveRequest( - result.iD, - 3, - context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - acceptRemoveRequest( - result.iD, - 4, - context); - }, - )) - ], - )); - }).toList()) - ]) - ], - ); - } - }) - ], ), ), - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).sentRequest, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - children: [ - FutureBuilder( - future: getSentRequest(), // async work - builder: (BuildContext context, - AsyncSnapshot - snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text(TranslationBase.of(context) - .noDataAvailable)); - else - return Container( - height: SizeConfig.screenHeight * .3, - child: SingleChildScrollView( + SizedBox(height: 15), + FractionallySizedBox( + widthFactor: 1.0, + child: AppExpandableNotifier( + title: TranslationBase.of(context).sentRequest, + bodyWidget: FutureBuilder( + future: getSentRequest(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return SizedBox(); + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); + else + return ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Row(children: [ + Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), + Expanded(flex: 1, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600)) + ])), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), + Column( + children: snapshot.data.getAllSharedRecordsByStatusList.map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Texts( + result.patientName, + fontWeight: FontWeight.w600, + fontSize: 12, + )), + Expanded( + flex: 1, + child: Card( + // shape: cardRadius(10), + color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), + child: Padding( + padding: EdgeInsets.all(5), + child: AppText( + result.statusDescription != null ? result.statusDescription : "", + color: Colors.white, + textAlign: TextAlign.center, + fontSize: 12, + ), + ), + ), + ), + ], + )); + }).toList(), + ) + ], + )); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: 1, + ); + } + }))), + SizedBox( + height: 15, + ), + FractionallySizedBox( + widthFactor: 1.0, + child: AppExpandableNotifier( + title: TranslationBase.of(context).userView, + bodyWidget: FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding(padding: EdgeInsets.only(top: 50), child: Text('')); + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable)); + else + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), child: Column( - children: [ - Padding( - padding: EdgeInsets.only( - left: 10, right: 10), - child: Row(children: [ - Expanded( - flex: 3, - child: AppText( - TranslationBase.of(context) - .theName)) - ])), - Column( - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ + children: [ + Column(children: [ + Padding( + padding: EdgeInsets.all(10), + child: Row(children: [ Expanded( flex: 3, - child: Text( - result.patientName)), + child: AppText( + TranslationBase.of(context).name, + fontWeight: FontWeight.w600, + )), Expanded( - flex: 2, + flex: 1, child: AppText( - result.statusDescription, - color: result.status == 3 - ? Colors.green - : Colors.red, + TranslationBase.of(context).delete, + fontWeight: FontWeight.w600, + textAlign: TextAlign.center, )), - ], - )); - }).toList(), - ) - ], - ))); - } - }) - ], - )), - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).userView, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - children: [ - FutureBuilder( - future: getUserViewRequest(), // async work - builder: (BuildContext context, - AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.only(top: 50), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text(TranslationBase.of(context) - .noDataAvailable)); - else - return Column( - children: [ - // Padding( - // padding:EdgeInsets.only(left:10, right:10), - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Expanded( - // flex: 3, - // child: AppText( - // TranslationBase.of(context).request), - // ), - // Expanded( - // flex: 2, - // child: AppText( - // TranslationBase.of(context).switchUser, - // )), - // Expanded( - // flex: 1, - // child: AppText( - // TranslationBase.of(context).deleteView, - // )), - // ], - // )), - Column(children: [ - Padding( - padding: - EdgeInsets.only(left: 10, right: 10), - child: Row(children: [ - Expanded( - flex: 3, - child: AppText( - TranslationBase.of(context) - .name)), - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context) - .delete)), - ])), - Column( - children: familyFileProvider - .allSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: AppText( - result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deactivateRequest( - result.iD, 5, context); - }, - )), - ], - )); - }).toList()) - ]) - ], - ); - } - }) - ], - )) + ])), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), + Column( + children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Texts( + result.patientName, + fontWeight: FontWeight.w600, + fontSize: 12, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.red, + ), + onPressed: () { + deactivateRequest(result.iD, 5, context); + }, + )), + ], + )); + }).toList()) + ]) + ], + )); + } + }))) ], ), ), @@ -646,14 +575,10 @@ class _MyFamily extends State with TickerProviderStateMixin { } Future getFamilyFiles() async { - if (user != null) { - if (await sharedPref.getObject(FAMILY_FILE) != null) { - // print(await sharedPref.getObject(FAMILY_FILE)); - return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( - await sharedPref.getObject(FAMILY_FILE))); - } else { - return familyFileProvider.getSharedRecordByStatus(); - } + if (await sharedPref.getObject(FAMILY_FILE) != null) { + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE))); + } else { + return familyFileProvider.getSharedRecordByStatus(); } } @@ -668,17 +593,15 @@ class _MyFamily extends State with TickerProviderStateMixin { } deleteFamily(family, context) { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).removeFamilyMember, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - ConfirmDialog.closeAlertDialog(context), - removeFamily(family, context) - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).removeFamilyMember, + onTap: () { + removeFamily(family, context); + }, + ), + ); } removeFamily(GetAllSharedRecordsByStatusList family, context) { @@ -687,10 +610,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request['ID'] = this.userID; request['IsActive'] = false; - this - .familyFileProvider - .deativateActivateMemberFile(request) - .then((value) => refreshFamily(context)); + this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context)); } refreshFamily(context) { @@ -708,55 +628,45 @@ class _MyFamily extends State with TickerProviderStateMixin { // .then((value) => loginAfter(value, context)); // Utils.showProgressDialog(context); - this - .familyFileProvider - .silentLoggin(user is AuthenticatedUser ? null : user, - mainUser: user is AuthenticatedUser) - .then((value) => loginAfter(value, context)) - .catchError((err) { + this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { print(err); - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); }); } loginAfter(result, context) async { - GifLoaderDialogUtils.hideDialog(context); var currentLang = await sharedPref.getString(APP_LANGUAGE); - Provider.of(context, listen: false) - .setPrivilege(privilegeList: result, isLoginChild: true); + Provider.of(AppGlobal.context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true); result = list.CheckActivationCode.fromJson(result); - var familyFile = await sharedPref.getObject(FAMILY_FILE); - result = list.CheckActivationCode.fromJson(result); - var mainUser = await sharedPref.getObject(MAIN_USER); + var familyFile = await sharedPref.getObject(FAMILY_FILE); var bloodType = await sharedPref.getString(BLOOD_TYPE); + var mainUser = await sharedPref.getObject(MAIN_USER); + var loginType = await sharedPref.getInt(LAST_LOGIN); this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setString(APP_LANGUAGE, currentLang); + this.sharedPref.setInt(LAST_LOGIN, loginType); this.sharedPref.setObject(MAIN_USER, mainUser); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); + _vitalSignService.heightCm = ""; + _vitalSignService.weightKg = ""; await authenticatedUserObject.getUser(getUser: true); - Provider.of(context, listen: false).user = - authenticatedUserObject.user; - Provider.of(context, listen: false) - .setUser(authenticatedUserObject.user); - - await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - if (pharmacyModuleViewModel.error.isNotEmpty) - await pharmacyModuleViewModel.createUser(); - }); + Provider.of(AppGlobal.context, listen: false).user = authenticatedUserObject.user; + Provider.of(AppGlobal.context, listen: false).setUser(authenticatedUserObject.user); appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { - //getToDoCount(), - // Utils.hideProgressDialog(), + getToDoCount(), + GifLoaderDialogUtils.hideDialog(context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { Navigator.pushAndRemoveUntil( @@ -767,19 +677,12 @@ class _MyFamily extends State with TickerProviderStateMixin { (r) => false) } else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - } + {Navigator.pushAndRemoveUntil(AppGlobal.context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false)} }) .catchError((err) { print(err); // Utils.hideProgressDialog(); - // GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); }); } @@ -788,8 +691,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.deactivateFamily(request).then((value) => - {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); + this.familyFileProvider.deactivateFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); } acceptRemoveRequest(ID, status, context) { @@ -797,21 +699,30 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.acceptRejectFamily(request).then((value) => - {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); + this.familyFileProvider.acceptRejectFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); } checkUserData() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - var data2 = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(MAIN_USER)); - print(data2); + var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); setState(() { this.user = data; }); } } + + getToDoCount() { + toDoProvider.setState(0, true, toDoProvider.notificationsCount); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + } else {} + }).catchError((err) { + print(err); + }); + } } diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 3858c940..4e249e53 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -34,28 +34,31 @@ class NotificationsDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).notificationDetails, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 25, - ), - Container( - // margin: EdgeInsets.only(left: 30), - width: double.infinity, - color: Colors.grey[400], - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - getDateForm(notification.createdOn), - fontSize: 16, + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).notificationDetails, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 25, + ), + Container( + width: double.infinity, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), + style: TextStyle( + fontSize: 18.0, + color: Colors.black, + fontWeight: FontWeight.w600 + ), ), ), ), @@ -87,7 +90,7 @@ class NotificationsDetailsPage extends StatelessWidget { children: [ Expanded( child: Center( - child: Texts(notification.message), + child: Text(notification.message), ), ), ], @@ -97,7 +100,6 @@ class NotificationsDetailsPage extends StatelessWidget { ), ), ), - ), ); } } diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 9745609d..fc34dbfe 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notification_details_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -10,136 +13,139 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; // ignore: must_be_immutable class NotificationsPage extends StatelessWidget { - getDateForm(String date) { - DateTime d = DateUtil.convertStringToDate(date); - String monthName = DateUtil.getMonth(d.month).toString(); - TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); - String minute = timeOfDay.minute < 10 - ? timeOfDay.minute.toString().padLeft(2, '0') - : timeOfDay.minute.toString(); - - String hour = '${timeOfDay.hourOfPeriod}:$minute'; - if (timeOfDay.period == DayPeriod.am) { - hour = hour + "AM"; - } else { - { - hour = hour + "PM"; - } - } - - //DayPeriod.am - return monthName + ',${d.day},${d.year}, $hour'; - } - int currentIndex = 0; @override Widget build(BuildContext context) { - var prescriptionReport; + ProjectViewModel projectViewModel = Provider.of(context); + AppGlobal.context = context; return BaseView( onModelReady: (model) { - GetNotificationsRequestModel getNotificationsRequestModel = - new GetNotificationsRequestModel( - currentPage: currentIndex, - pagingSize: 14, - notificationStatusID: 2); + GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2); model.getNotifications(getNotificationsRequestModel, context); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).notifications, baseViewModel: model, - body: ListView( - children: model.notifications - .map( - (notification) => InkWell( - onTap: () async { - if (!notification.isRead) - model.markAsRead(notification.id); - Navigator.push( - context, - FadePage( - page: NotificationsDetailsPage( - notification: notification, - ))); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 5, left: 10, right: 10, bottom: 5), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), + body: ListView.separated( + itemBuilder: (context, index) { + if (index == model.notifications.length) { + return InkWell( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + currentIndex++; + GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2); + + await model.getNotifications(getNotificationsRequestModel, context); + GifLoaderDialogUtils.hideDialog(context); + }, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Image.asset('assets/images/notf.png'), + Icon( + Icons.notifications_active, + color: CustomColors.accentColor, + size: 40, ), - border: Border.all( - color: notification.isRead - ? Colors.grey[200] - : Theme.of(context).primaryColor, - width: 0.5), - ), - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(getDateForm(notification.createdOn)), - SizedBox( - height: 5, - ), - Row( - children: [ - Expanded( - child: Texts(notification.message)), - if (notification.messageType == "image") - Icon(FontAwesomeIcons.images) - ], - ), - SizedBox( - height: 5, - ), - ], - ), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).moreNotifications, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ], + ), + ), + ); + } + + return InkWell( + onTap: () async { + if (!model.notifications[index].isRead) { + model.markAsRead(model.notifications[index].id); + } + Navigator.push( + context, + FadePage( + page: NotificationsDetailsPage( + notification: model.notifications[index], + ))); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor.withOpacity(0.05), + border: projectViewModel.isArabic + ? Border( + right: BorderSide( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + width: 5.0, + ), + ) + : Border( + left: BorderSide( + color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + width: 5.0, ), ), - SizedBox( - width: 15, + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) + + " " + + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false)), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded(child: Texts(model.notifications[index].message)), + if (model.notifications[index].messageType == "image") + Icon( + FontAwesomeIcons.images, + color: CustomColors.grey, + ) + ], + ), + SizedBox( + height: 5, + ), + ], ), - ], + ), ), - ), + ], ), - ) - .toList() - ..add( - InkWell( - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - currentIndex++; - GetNotificationsRequestModel - getNotificationsRequestModel = - new GetNotificationsRequestModel( - currentPage: currentIndex, - pagingSize: 14, - notificationStatusID: 2); - - await model.getNotifications( - getNotificationsRequestModel, context); - GifLoaderDialogUtils.hideDialog(context); - }, - child: Center( - child: Image.asset('assets/images/notf.png'), - ), - ), - )), + ), + ); + }, + separatorBuilder: (context, index) { + return Column( + children: [ + Divider( + color: Colors.grey[300], + thickness: 2.0, + ), + ], + ); + }, + itemCount: model.notifications.length + 1), ), ); } diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart index 1d4e78ee..3803bcd4 100644 --- a/lib/pages/ErService/AmbulanceReq.dart +++ b/lib/pages/ErService/AmbulanceReq.dart @@ -1,18 +1,14 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'dart:ui'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart'; import 'OrderLogPage.dart'; @@ -22,8 +18,7 @@ class AmbulanceReq extends StatefulWidget { _AmbulanceReqState createState() => _AmbulanceReqState(); } -class _AmbulanceReqState extends State - with SingleTickerProviderStateMixin { +class _AmbulanceReqState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); @@ -41,101 +36,61 @@ class _AmbulanceReqState extends State @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/Ambulance/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/Ambulance/ar/0.png')); + ProjectViewModel projectViewModel = Provider.of(context); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/Ambulance/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/Ambulance/ar/0.png')); return BaseView( onModelReady: (model) => model.getAmRequestOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).transportationService, description: TranslationBase.of(context).infoAmbulance, imagesInfo: imagesInfo, baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.90, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.label, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.40, - child: Center( - child: Texts(TranslationBase.of(context).transportationService), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).ordersLog), - ), - ), - ], - ), - ), - ), - ), + body: Column( + children: [ + TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Text(TranslationBase.of(context).transportationService), + Text(TranslationBase.of(context).ordersLog), ], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - AmbulanceRequestIndexPage( - amRequestViewModel: model, - ), - OrderLogPage( - amRequestViewModel: model, - ) - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + controller: _tabController, + children: [ + AmbulanceRequestIndexPage( + amRequestViewModel: model, + ), + OrderLogPage( + amRequestViewModel: model, + ) + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index 26c973d7..f9b2b190 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -1,14 +1,22 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/StepsWidget.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'BillAmount.dart'; import 'PickupLocation.dart'; @@ -21,8 +29,7 @@ class AmbulanceRequestIndexPage extends StatefulWidget { AmbulanceRequestIndexPage({Key key, this.amRequestViewModel}); @override - _AmbulanceRequestIndexPageState createState() => - _AmbulanceRequestIndexPageState(); + _AmbulanceRequestIndexPageState createState() => _AmbulanceRequestIndexPageState(); } class _AmbulanceRequestIndexPageState extends State { @@ -34,12 +41,15 @@ class _AmbulanceRequestIndexPageState extends State { TransportationDetails transportationDetails = new TransportationDetails(); + int status; + String _statusDisp; + Color _color; + _changeCurrentTab(int tab) { setState(() { currentIndex = tab; }); - pageController.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + pageController.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override @@ -51,79 +61,268 @@ class _AmbulanceRequestIndexPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + AmbulanceRequestOrdersModel order = widget.amRequestViewModel.pendingAmbulanceRequestOrder; + + if(widget.amRequestViewModel.pendingAmbulanceRequestOrder != null) { + int status = order.statusId; + _statusDisp = order.statusText; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + } + return AppScaffold( - body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null + body: widget.amRequestViewModel.pendingAmbulanceRequestOrder != null && order != null ? SingleChildScrollView( - child: Column( + child: Column( children: [ SizedBox( - height: 80, + height: 10, ), Container( - margin: EdgeInsets.only(left: 18, right: 18), + margin: EdgeInsets.all(21), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .id - .toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).status, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: getDate(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: widget.amRequestViewModel.pendingAmbulanceRequestOrder - .dropOffLocation, + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), - OrderLogItem( - title: TranslationBase.of(context).transportMethod, - value: widget - .amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 20.0, + ), + ], + ), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - widget.amRequestViewModel.updatePressOrder( - presOrderID: widget.amRequestViewModel - .pendingAmbulanceRequestOrder.id); - }, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.amRequestViewModel, order.iD, context); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], ), - ) - ], + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), ), + + // Container( + // margin: EdgeInsets.only(left: 18, right: 18), + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(2), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // OrderLogItem( + // title: TranslationBase.of(context).reqId, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD.toString(), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).status, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.statusText, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupDate, + // value: DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.amRequestViewModel.pendingAmbulanceRequestOrder.created)), + // ), + // OrderLogItem( + // title: TranslationBase.of(context).pickupLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.pickupLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).dropoffLocation, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.dropOffLocation, + // ), + // OrderLogItem( + // title: TranslationBase.of(context).transportMethod, + // value: widget.amRequestViewModel.pendingAmbulanceRequestOrder.serviceText, + // ), + // Container( + // padding: EdgeInsets.all(10), + // width: double.maxFinite, + // margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only( + // bottomRight: Radius.circular(12), + // bottomLeft: Radius.circular(12), + // ), + // color: Colors.white), + // child: SecondaryButton( + // color: Colors.red[900], + // textColor: Colors.white, + // label: TranslationBase.of(context).cancel, + // onTap: () { + // widget.amRequestViewModel.updatePressOrder(presOrderID: widget.amRequestViewModel.pendingAmbulanceRequestOrder.iD); + // }, + // ), + // ) + // ], + // ), + // ), ], ), - ) + ) : Column( children: [ SizedBox( @@ -174,8 +373,25 @@ class _AmbulanceRequestIndexPageState extends State { ); } - String getDate(String date) { - return date.split("T")[0]; + void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + // GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + // GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + // GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; } - } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart index 67b9d82b..bacc9c38 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/BillAmount.dart @@ -2,10 +2,9 @@ import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; -import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.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/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -45,261 +44,222 @@ class _BillAmountState extends State { body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).billAmount), + Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 10, ), - Table( - border: TableBorder.symmetric(inside: BorderSide(width: 1.0, color: Colors.grey[300]), outside: BorderSide(width: 1.0, color: Colors.grey[300])), - children: [ - TableRow( + Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareB, - textAlign: TextAlign.start, - color: Colors.black, - fontSize: 15, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', isBold: true), + ) + ], ), ), + mDivider(Colors.grey[200]), Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientTaxToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', isBold: true), + ) + ], ), ), - ], - ), - TableRow( - children: [ + mDivider(Colors.grey[200]), Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.09, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTax, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), + width: double.infinity, + padding: EdgeInsets.only(top: 3, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', isBold: true, isTotal: true), + ) + ], ), ), ], ), - TableRow( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).patientShareTotal, - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - bold: true, - ), - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.09, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10.0), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', - color: Colors.black, - fontSize: 15, - textAlign: TextAlign.start, - ), - ), - ), - ], - ), - ], + ), ), SizedBox( height: 10, ), - Texts( - TranslationBase.of(context).selectAmbulate, - bold: true, - ), + Text(TranslationBase.of(context).selectAmbulate, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Row( children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Wheelchair; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).wheelchair), - leading: Radio( - value: Ambulate.Wheelchair, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Wheelchair; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Wheelchair, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).wheelchair, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Walker; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).walker), - leading: Radio( - value: Ambulate.Walker, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + ], + ), + Row( + children: [ + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Walker; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Walker, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).walker, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), ], ), - SizedBox( - height: 5, - ), Row( children: [ - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.Stretcher; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).stretcher), - leading: Radio( - value: Ambulate.Stretcher, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.Stretcher; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.Stretcher, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).stretcher, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), ), - Expanded( - child: InkWell( - onTap: () { - setState(() { - _ambulate = Ambulate.None; - }); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: ListTile( - title: Text(TranslationBase.of(context).none), - leading: Radio( - value: Ambulate.None, - groupValue: _ambulate, - onChanged: (value) { - setState(() { - _ambulate = value; - }); - }, - ), + ], + ), + Row( + children: [ + InkWell( + onTap: () { + setState(() { + _ambulate = Ambulate.None; + }); + }, + child: Container( + width: MediaQuery.of(context).size.width * 0.9, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Ambulate.None, + groupValue: _ambulate, + onChanged: (value) { + setState(() { + _ambulate = value; + }); + }, + ), + Text( + TranslationBase.of(context).none, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -309,14 +269,21 @@ class _BillAmountState extends State { SizedBox( height: 12, ), - NewTextFields( - hintText: TranslationBase.of(context).notes, - initialValue: note, - onChanged: (value) { - setState(() { - note = value; - }); - }, + Container( + decoration: cardRadius(10), + child: Padding( + padding: EdgeInsets.all(8.0), + child: TextField( + maxLines: 5, + decoration: InputDecoration.collapsed( + hintText: TranslationBase.of(context).notes, hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16)), + onChanged: (value) { + setState(() { + note = value; + }); + }, + ), + ), ), SizedBox( height: 100, @@ -326,23 +293,38 @@ class _BillAmountState extends State { ), ), bottomSheet: Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 90, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).next, + () { setState(() { widget.patientER_RC.transportationDetails.ambulate = _ambulate.selectAmbulateNumber(); + widget.patientER_RC.transportationDetails.ambulateTitle = _ambulate.getAmbulateTitle(context); widget.patientER_RC.transportationDetails.notes = note; // widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); widget.changeCurrentTab(3); }); }, - label: TranslationBase.of(context).next, + // label: TranslationBase.of(context).next, ), ), ); } + + _getNormalText(text, {bool isBold = false, bool isTotal = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold + ? isTotal + ? 16 + : 12 + : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } } diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index e05f0e95..0e63bf76 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -4,21 +4,20 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/Blood/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; @@ -51,9 +50,7 @@ class _PickupLocationState extends State { void initState() { super.initState(); _getCurrentLocation(); - setState(() { - - }); + setState(() {}); } _getCurrentLocation() async { @@ -64,7 +61,6 @@ class _PickupLocationState extends State { _longitude = 0; _latitude = 0; }); - } @override @@ -75,7 +71,7 @@ class _PickupLocationState extends State { body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -83,43 +79,66 @@ class _PickupLocationState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).pickupLocation), + Text(TranslationBase.of(context).pickupLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 15, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: _latitude??0, - longitude: _longitude??0, - onPick: (value) { - setState(() { - _result = value; - }); - }, - )), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: _latitude ?? 0, + longitude: _longitude ?? 0, + onPick: (value) { + setState(() { + _result = value; + }); + }, + )), + ); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectMap, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getSelectFromMapName(context), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -127,7 +146,7 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).pickupSpot), + Text(TranslationBase.of(context).pickupSpot, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -138,21 +157,27 @@ class _PickupLocationState extends State { }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).insideHome), - leading: Checkbox( - value: _isInsideHome, - onChanged: (value) { - setState(() { - _isInsideHome = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Checkbox( + value: _isInsideHome, + onChanged: (value) { + setState(() { + _isInsideHome = value; + }); + }, + ), + Text( + TranslationBase.of(context).insideHome, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -160,7 +185,7 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).haveAppo), + Text(TranslationBase.of(context).haveAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -177,25 +202,31 @@ class _PickupLocationState extends State { } }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).yes), - leading: Radio( - value: HaveAppointment.YES, - groupValue: _haveAppointment, - onChanged: (value) { - if (myAppointment == null) { - getAppointment(); - setState(() { - _haveAppointment = value; - }); - } - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: HaveAppointment.YES, + groupValue: _haveAppointment, + onChanged: (value) { + if (myAppointment == null) { + getAppointment(); + setState(() { + _haveAppointment = value; + }); + } + }, + ), + Text( + TranslationBase.of(context).yes, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -210,23 +241,29 @@ class _PickupLocationState extends State { }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).no), - leading: Radio( - value: HaveAppointment.NO, - groupValue: _haveAppointment, - onChanged: (value) { - setState(() { - _haveAppointment = value; - myAppointment = null; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: HaveAppointment.NO, + groupValue: _haveAppointment, + onChanged: (value) { + setState(() { + _haveAppointment = value; + myAppointment = null; + }); + }, + ), + Text( + TranslationBase.of(context).no, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), ), ), @@ -249,31 +286,54 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).dropoffLocation), + Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 8, ), - InkWell( - onTap: () { - confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), - Icon( - Icons.arrow_drop_down, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getHospitalName(""), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -284,26 +344,54 @@ class _PickupLocationState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).pickupLocation), + Text(TranslationBase.of(context).pickupLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 15, ), - InkWell( - onTap: () { - confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + confirmSelectHospitalDialog(widget.amRequestViewModel.hospitals); + }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getHospitalName(TranslationBase.of(context).pickupLocation)), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getHospitalName(""), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), Icon( Icons.arrow_drop_down, size: 24, @@ -316,44 +404,67 @@ class _PickupLocationState extends State { SizedBox( height: 12, ), - Texts(TranslationBase.of(context).dropoffLocation), + Text(TranslationBase.of(context).dropoffLocation, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 8, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, - ), - ), - ); - }, - child: Container( - padding: EdgeInsets.all(12), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), + ), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + ), + ), + ); + }, child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), - Icon( - FontAwesomeIcons.mapMarkerAlt, - size: 24, - color: Colors.black, - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectMap, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + getSelectFromMapName(context), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + ], + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), @@ -372,13 +483,13 @@ class _PickupLocationState extends State { ), ), bottomSheet: Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 90, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton( + // color: Colors.grey[800], + // textColor: Colors.white, + TranslationBase.of(context).next, + () { if (_result == null || _selectedHospital == null) AppToast.showErrorToast(message: TranslationBase.of(context).selectAll); else @@ -411,7 +522,7 @@ class _PickupLocationState extends State { widget.patientER_RC.transportationDetails.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); widget.patientER_RC.transportationDetails.pickupLocationName = widget.patientER.direction == 0 ? _selectedHospital.name : _result.formattedAddress; widget.patientER_RC.projectID = widget.amRequestViewModel.user.projectID; - widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID.toString(); + widget.patientER_RC.patientID = widget.amRequestViewModel.user.patientID; widget.patientER_RC.transportationDetails.requesterIsOutSA = false; // widget.patientER.lineItemNo = 0; widget.patientER_RC.transportationDetails.requesterMobileNo = widget.amRequestViewModel.user.mobileNumber; @@ -436,22 +547,28 @@ class _PickupLocationState extends State { widget.changeCurrentTab(2); }); }, - label: TranslationBase.of(context).next, + // label: TranslationBase.of(context).next, ), ), ); } + int _selectedHospitalIndex = -1; + void confirmSelectHospitalDialog(List hospitals) { + List list = [ + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; showDialog( context: context, - child: SelectHospitalDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = hospitals[index]; + setState(() {}); }, ), ); @@ -462,7 +579,7 @@ class _PickupLocationState extends State { } String getSelectFromMapName(context) { - return _result != null ? _result.formattedAddress : TranslationBase.of(context).selectMap; + return _result != null ? _result.formattedAddress : ""; } getAppointment() { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart index aad8eb3b..e3c8ccf2 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/SelectTransportationMethod.dart @@ -5,8 +5,8 @@ import 'package:diplomaticquarterapp/core/model/er/get_all_transportation_method import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -53,7 +53,6 @@ class _SelectTransportationMethodState extends State } else { if (widget.amRequestViewModel.amRequestModeList.length != 0) _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[widget.amRequestViewModel.amRequestModeList.length - 1]; } - } @override @@ -72,56 +71,77 @@ class _SelectTransportationMethodState extends State SizedBox( height: 12, ), - Texts(TranslationBase.of(context).transportHeading), - ...List.generate( - widget.amRequestViewModel.amRequestModeList.length, - (index) => InkWell( - onTap: () { - setState(() { - _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index]; - }); - }, - child: Container( - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), - child: Row( - children: [ - Expanded( - flex: 3, - child: ListTile( - title: Texts(projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text), - leading: Radio( - value: widget.amRequestViewModel.amRequestModeList[index], - groupValue: _erTransportationMethod, - onChanged: (value) { - setState(() { - _erTransportationMethod = value; - }); - }, - ), + Text(TranslationBase.of(context).transportHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), + Container( + margin: EdgeInsets.only(top: 12), + decoration: cardRadius(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + widget.amRequestViewModel.amRequestModeList.length, + (index) => InkWell( + onTap: () { + setState(() { + _erTransportationMethod = widget.amRequestViewModel.amRequestModeList[index]; + }); + }, + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 4, + child: ListTile( + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: widget.amRequestViewModel.amRequestModeList[index], + groupValue: _erTransportationMethod, + onChanged: (value) { + setState(() { + _erTransportationMethod = value; + }); + }, + ), + Flexible( + child: Text( + projectViewModel.isArabic ? widget.amRequestViewModel.amRequestModeList[index].textN : widget.amRequestViewModel.amRequestModeList[index].text, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + ), + Expanded( + flex: 1, + child: Text( + TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}', + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ) + ], ), ), - Expanded( - flex: 1, - child: Texts(TranslationBase.of(context).sar + ' ${widget.amRequestViewModel.amRequestModeList[index].price}'), - ) - ], + ), ), - ), + ], ), ), SizedBox( height: 12, ), - Texts(TranslationBase.of(context).directionHeading), - SizedBox( - height: 5, - ), + Text(TranslationBase.of(context).directionHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), Container( width: double.maxFinite, child: Row( @@ -137,22 +157,26 @@ class _SelectTransportationMethodState extends State }, child: Container( width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).toHospital), - leading: Radio( - value: Direction.ToHospital, - groupValue: _direction, - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Direction.ToHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + Text(TranslationBase.of(context).toHospital, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -167,22 +191,26 @@ class _SelectTransportationMethodState extends State }, child: Container( width: double.maxFinite, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).fromHospital), - leading: Radio( - value: Direction.FromHospital, - groupValue: _direction, - onChanged: (value) { - setState(() { - _direction = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Direction.FromHospital, + groupValue: _direction, + onChanged: (value) { + setState(() { + _direction = value; + }); + }, + ), + Text(TranslationBase.of(context).fromHospital, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -198,7 +226,7 @@ class _SelectTransportationMethodState extends State SizedBox( height: 8, ), - Texts(TranslationBase.of(context).wayHeading), + Text(TranslationBase.of(context).wayHeading, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), @@ -214,22 +242,26 @@ class _SelectTransportationMethodState extends State }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).oneDirec), - leading: Radio( - value: Way.OneWay, - groupValue: _way, - onChanged: (value) { - setState(() { - _way = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Way.OneWay, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + Text(TranslationBase.of(context).oneDirec, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -243,22 +275,26 @@ class _SelectTransportationMethodState extends State }); }, child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.all(color: Colors.grey, width: 0.5), - color: Colors.white, - ), child: ListTile( - title: Texts(TranslationBase.of(context).twoDirec), - leading: Radio( - value: Way.TwoWays, - groupValue: _way, - onChanged: (value) { - setState(() { - _way = value; - }); - }, + contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), + title: Row( + children: [ + Radio( + value: Way.TwoWays, + groupValue: _way, + onChanged: (value) { + setState(() { + _way = value; + }); + }, + ), + Text(TranslationBase.of(context).twoDirec, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + )), + ], ), ), ), @@ -280,13 +316,11 @@ class _SelectTransportationMethodState extends State ), ), bottomSheet: Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 90, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).next, + () { setState(() { // widget.patientER.transportationMethodId = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); // widget.patientER.direction = _direction == Direction.ToHospital ? 1 : 0; @@ -305,7 +339,7 @@ class _SelectTransportationMethodState extends State widget.patientER_RC.transportationDetails.direction = _direction == Direction.ToHospital ? 1 : 0; widget.patientER_RC.transportationDetails.tripType = _way == Way.TwoWays ? 0 : 1; widget.patientER_RC.transportationDetails.ambulate = (widget.amRequestViewModel.amRequestModeList.indexOf(_erTransportationMethod) + 1); - widget.patientER_RC.transportationDetails.transportationType = _erTransportationMethod.id.toString(); + widget.patientER_RC.transportationDetails.transportationType = _erTransportationMethod.iD.toString(); widget.patientER_RC.patientERTransportationMethod = _erTransportationMethod; widget.patientER_RC.transportationDetails.pickupUrgency = 1; // widget.patientER.orderServiceID = _orderService.getIdOrderService(); @@ -314,10 +348,8 @@ class _SelectTransportationMethodState extends State // widget.patientER.vAT = _erTransportationMethod.priceVAT ?? 0; // widget.patientER.totalPrice = _erTransportationMethod.priceTotal.toDouble(); widget.changeCurrentTab(1); - }); }, - label: TranslationBase.of(context).next, ), ), ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart index d595fd6b..4b59a8fa 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/Summary.dart @@ -1,13 +1,14 @@ -import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class Summary extends StatefulWidget { final Function changeCurrentTab; @@ -24,91 +25,79 @@ class Summary extends StatefulWidget { class _SummaryState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, isShowAppBar: false, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 12, right: 12), + margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).rrtSummary), + Text(TranslationBase.of(context).RRTSummary, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Container( width: double.infinity, padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - ), + // margin: EdgeInsets.only(top: 12), + decoration: cardRadius(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).transportMethod, - color: Colors.grey, - ), - Texts( - '${widget.patientER_RC.patientERTransportationMethod.text}', - bold: true, - ), + _getNormalText(TranslationBase.of(context).transportMethod), + projectViewModel.isArabic + ? _getNormalText( + '${widget.patientER_RC.patientERTransportationMethod.textN}', + isBold: true, + ) + : _getNormalText( + '${widget.patientER_RC.patientERTransportationMethod.text}', + isBold: true, + ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).directions, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).directions), + _getNormalText( widget.patientER_RC.transportationDetails.direction == 0 ? TranslationBase.of(context).toHospital : TranslationBase.of(context).fromHospital, - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( + _getNormalText( TranslationBase.of(context).pickupLocation, - color: Colors.grey, ), - Texts( + _getNormalText( '${widget.patientER_RC.transportationDetails.pickupLocationName}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).dropoffLocation, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).dropoffLocation), + _getNormalText( '${widget.patientER_RC.transportationDetails.dropoffLocationName}', - bold: true, + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).selectAmbulate, - color: Colors.grey, - ), - Texts( - '${widget.patientER_RC.transportationDetails.ambulate}', - bold: true, + _getNormalText(TranslationBase.of(context).selectAmbulate), + _getNormalText( + '${widget.patientER_RC.transportationDetails.ambulateTitle}', + isBold: true, ), SizedBox( height: 8, ), - Texts( - TranslationBase.of(context).notes, - color: Colors.grey, - ), - Texts( + _getNormalText(TranslationBase.of(context).notes), + _getNormalText( '${widget.patientER_RC.transportationDetails.notes ?? '---'}', - bold: true, + isBold: true, ), SizedBox( height: 8, @@ -119,38 +108,52 @@ class _SummaryState extends State { SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).billAmount, - textAlign: TextAlign.start, - ), + Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Container( height: 55, padding: EdgeInsets.all(10), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), + decoration: cardRadius(12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).patientShareTotal + ':'), Texts(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}')], + children: [ + _getNormalText(TranslationBase.of(context).patientShareTotal + ':'), + Container( + padding: EdgeInsets.only(left: 20.0, right: 20.0), + child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', isBold: true, isTotal: true) + ), + ], ), ), - SizedBox(height: 130), + SizedBox(height: 50), ], ), ), ), bottomSheet: Container( - padding: EdgeInsets.all(15), - width: double.maxFinite, - height: 90, - child: SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - label: TranslationBase.of(context).send, - onTap: () async { - await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC); - }), + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12.0), + child: DefaultButton(TranslationBase.of(context).send, () async { + await widget.amRequestViewModel.insertERPressOrder(patientER: widget.patientER_RC); + }), + ), + ); + } + + _getNormalText(text, {bool isBold = false, bool isTotal = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold + ? isTotal + ? 16 + : 12 + : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, ), ); } diff --git a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart b/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart deleted file mode 100644 index 1144e587..00000000 --- a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class ConfirmExitPageDialog extends StatelessWidget { - final GestureTapCallback onTapYes; - final GestureTapCallback onTapNo; - - const ConfirmExitPageDialog({Key key, this.onTapYes, this.onTapNo}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - color: Colors.black, - ), - ), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts( - "Are you sure you want to exit this page ?", - color: Colors.grey, - ), - SizedBox( - height: 5, - ), - Divider(), - SizedBox( - height: 5.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - onTapNo(); - }, - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).no, - color: Colors.red, - ), - ), - ), - ), - - InkWell( - onTap: () { - Navigator.pop(context); - onTapYes(); - }, - child: Container( - child: Center( - child: Texts(TranslationBase.of(context).yes), - ), - ), - ), - ], - ), - SizedBox( - height: 20.0, - ), - ], - ) - ], - ); - } -} diff --git a/lib/pages/ErService/EdOnline/DdServicesPage.dart b/lib/pages/ErService/EdOnline/DdServicesPage.dart index 47f73c42..dc2e8d78 100644 --- a/lib/pages/ErService/EdOnline/DdServicesPage.dart +++ b/lib/pages/ErService/EdOnline/DdServicesPage.dart @@ -1,18 +1,15 @@ import 'package:diplomaticquarterapp/core/model/er/TriageInformationRequest.dart'; import 'package:diplomaticquarterapp/core/model/er/TriageQuestionsModel.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import 'EdOnlineAgreementPage.dart'; import 'EdOnlineNotesPage.dart'; import 'EdOnlineQuestionsPage.dart'; import 'EdOnlineSelectedHospitalPage.dart'; import 'EdPaymentInformationPage.dart'; -import 'ConfirmExitPageDialog.dart'; class DdServicesPage extends StatefulWidget { @override @@ -31,14 +28,12 @@ class _DdServicesPageState extends State { void initState() { super.initState(); pageController = new PageController(); - } _changePageViewIndex(int tab) { setState(() { pageController.jumpToPage(tab); - pageController.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + pageController.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); }); } @@ -100,25 +95,11 @@ class _DdServicesPageState extends State { selectedQuestions: selectedQuestions, triageInformationRequest: triageInformationRequest, ), - EdPaymentInformationPage(selectedHospital: triageInformationRequest.selectedHospital,) + EdPaymentInformationPage( + selectedHospital: triageInformationRequest.selectedHospital, + ) ], ), ); } - - void showConfirmMessage( - BuildContext context, - ) { - showDialog( - context: context, - child: ConfirmExitPageDialog( - onTapYes: () { - Navigator.pop(context); - }, - onTapNo: () { - Navigator.pop(context); - }, - ), - ); - } } diff --git a/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart b/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart index 45df4041..fd0c8e9a 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineNotesPage.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/er/TriageInformationRequest.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/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; diff --git a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart index 34c41040..b8498e7c 100644 --- a/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart +++ b/lib/pages/ErService/EdOnline/EdOnlineSelectedHospitalPage.dart @@ -1,5 +1,4 @@ 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/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index af6f0638..88b21b11 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -1,19 +1,14 @@ -import 'dart:convert'; - import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.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 '../../uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; +import '../../uitl/translations_delegate_base.dart'; import 'AmbulanceReq.dart'; -import 'EdOnline/DdServicesPage.dart'; -import 'EdOnline/EdOnlineSelectedHospitalPage.dart'; import 'NearestEr.dart'; class ErOptions extends StatefulWidget { @@ -21,7 +16,6 @@ class ErOptions extends StatefulWidget { const ErOptions({Key key, this.isAppbar}) : super(key: key); - @override _ErOptionsState createState() => _ErOptionsState(); } @@ -32,106 +26,78 @@ class _ErOptionsState extends State { @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance - .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); super.initState(); } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - final rrtLocked = !projectViewModel.havePrivilege(68); + final rrtLocked = projectViewModel.havePrivilege(68); return AppScaffold( isShowAppBar: widget.isAppbar, - appBarTitle: TranslationBase.of(context).bookAppo, + appBarTitle: TranslationBase.of(context).emergencyServices, isShowDecPage: false, - body: Container( - margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Container( - height: 170, - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: CardCommonEr( - image: 'assets/images/new-design/AM.PNG', - text: TranslationBase.of(context).ambulancerequest, - subText: TranslationBase.of(context).requestA, - onTap: (){ - Navigator.push( - context, - FadePage( - page: AmbulanceReq())); - }, - - ), - ), - Expanded( - child: CardCommonEr( - image: 'assets/images/new-design/emergency_icon.png', - text: TranslationBase.of(context).nearester, - subText: TranslationBase.of(context).locationa, - onTap:(){ - Navigator.push( - context, - FadePage( - page: NearestEr())); - }), - - ) - ], - ), + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), + body: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(21), + shrinkWrap: true, + children: [ + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: AmbulanceReq())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).ambulancerequest, + imagePath: 'assets/images/new-design/AM.PNG', + subTitle: TranslationBase.of(context).requestA, + isPngImage: true, ), - Container( - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), - height: 170, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: CardCommonEr( - image: 'assets/images/new-design/AM.PNG', - text:'ED service', - subText: 'ED service', - onTap: (){ - Navigator.push( - context, - FadePage(page: DdServicesPage()) - ); - }, - - ), - ), - Expanded( - child: CardCommonEr( - locked: rrtLocked, - image: 'assets/images/new-design/AM.PNG', - text: TranslationBase.of(context).rrtService, - subText: TranslationBase.of(context).rapidResponseTeam, - onTap:(){ - Navigator.push( - context, - FadePage( - page: RRTMainScreen())); - }), - ) - ], - ), + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: NearestEr())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).nearester, + imagePath: 'assets/images/new-design/emergency_icon.png', + subTitle: TranslationBase.of(context).locationa, + isPngImage: true, ), - ], - ), + ), + InkWell( + onTap: () { + if (rrtLocked) Navigator.push(context, FadePage(page: RRTMainScreen())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).RRTTitle, + imagePath: 'assets/images/new-design/AM.PNG', + subTitle: TranslationBase.of(context).RRTSubTitle, + isPngImage: true, + isEnable: rrtLocked, + ), + ), + InkWell( + onTap: () { + // Navigator.push(context, FadePage(page: DdServicesPage())); + }, + child: MedicalProfileItem( + title: "ED", + imagePath: 'assets/images/new-design/AM.PNG', + subTitle: TranslationBase.of(context).service, + isPngImage: true, + isEnable: false, + ), + ), + ], ), ); } } - diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index 57a3a8ae..3aad729f 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -1,13 +1,15 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../uitl/translations_delegate_base.dart'; -import 'widgets/card_position.dart'; class NearestEr extends StatefulWidget { static const String _url = "assets/images/"; @@ -24,6 +26,8 @@ class NearestEr extends StatefulWidget { class _NearestErState extends State { List projectAvgERWaitingTimeModelList = List(); + bool isDataLoaded; + @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getERList()); @@ -39,48 +43,44 @@ class _NearestErState extends State { return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).NearestEr, - body: projectAvgERWaitingTimeModelList.length > 0 - ? Container( - child: ListView( - children: [ - Text("${TranslationBase.of(context).NearestErDesc}", - textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, letterSpacing: 1.0, fontWeight: FontWeight.w900, color: new Color(0xFF60686b))), - Container( - margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0), - child: GridView.count( - crossAxisCount: 2, - childAspectRatio: (itemWidth / itemWidth), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - controller: new ScrollController(keepScrollOffset: false), + body: isDataLoaded != null + ? isDataLoaded + ? ListView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + children: [ + Text( + TranslationBase.of(context).NearestErDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 21), + ListView.separated( + physics: NeverScrollableScrollPhysics(), shrinkWrap: true, - padding: const EdgeInsets.all(4.0), - children: List.generate(7, (index) { - return Container( - child: CardPosition( - waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString(), - text: projectAvgERWaitingTimeModelList[index].projectName.toString(), - image: 'assets/images/new-design/find_us_icon.png', - subText: '${projectAvgERWaitingTimeModelList[index].distanceInKilometers ?? 0.0} ${TranslationBase.of(context).km_}', - type: projectAvgERWaitingTimeModelList[index].iD.toString(), - telephone: projectAvgERWaitingTimeModelList[index].phoneNumber.toString(), - networkImage: projectAvgERWaitingTimeModelList[index].projectImageURL.toString(), - latitude: projectAvgERWaitingTimeModelList[index].latitude, - longitude: projectAvgERWaitingTimeModelList[index].longitude, - projectname: projectAvgERWaitingTimeModelList[index].projectName, - cardSize: itemWidth, - ), - ); - }), + padding: EdgeInsets.zero, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) { + GetHMGLocationsModel location = GetHMGLocationsModel(); + location.locationName = projectAvgERWaitingTimeModelList[index].projectName; + location.cityName = projectAvgERWaitingTimeModelList[index].projectName; + location.projectImageURL = projectAvgERWaitingTimeModelList[index].projectImageURL; + location.phoneNumber = projectAvgERWaitingTimeModelList[index].phoneNumber; + location.latitude = projectAvgERWaitingTimeModelList[index].latitude; + location.longitude = projectAvgERWaitingTimeModelList[index].longitude; + location.distanceInKilometers = projectAvgERWaitingTimeModelList[index].distanceInKilometers; + return HospitalLocation(location, waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString()); + }, + itemCount: projectAvgERWaitingTimeModelList.length, ), - ), - ], - ), - ) - : Center( - child: Texts('No Data'), - ), + ], + ) + : Center( + child: Texts('No Data'), + ) + : SizedBox(), ); } @@ -88,18 +88,24 @@ class _NearestErState extends State { GifLoaderDialogUtils.showMyDialog(context); ErService service = new ErService(); service.getProjectAvgERWaitingTimeOrders().then((response) { - if (response['MessageStatus'] == 1) { + if (response != null && response['MessageStatus'] == 1) { setState(() { projectAvgERWaitingTimeModelList.clear(); response['List_ProjectAvgERWaitingTime'].forEach((vital) { projectAvgERWaitingTimeModelList.add(ProjectAvgERWaitingTime.fromJson(vital)); }); + isDataLoaded = true; }); GifLoaderDialogUtils.hideDialog(context); - } else {} + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: TranslationBase.of(context).serviceNotAvailable); + isDataLoaded = false; + } }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); }); } } diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index 3d492c83..fb8de6d9 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -1,9 +1,18 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/AmbulanceRequestOrdersModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/others/OrderLogItem.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class OrderLogPage extends StatelessWidget { final AmRequestViewModel amRequestViewModel; @@ -12,64 +21,232 @@ class OrderLogPage extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () { + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + // GifLoaderDialogUtils.showMyDialog(context); + await model.updatePressOrder(presOrderID: presOrderID); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + // GifLoaderDialogUtils.hideDialog(context); + } else { + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + // GifLoaderDialogUtils.hideDialog(context); + } + }); + }, + )); + return; + } + return Container( - margin: EdgeInsets.all(10), + // margin: EdgeInsets.all(10), padding: EdgeInsets.all(8), - child: ListView.builder( - itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, - itemBuilder: (context, index) => Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(2), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - OrderLogItem( - title: TranslationBase.of(context).reqId, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].id.toString(), - ), - OrderLogItem( - title: TranslationBase.of(context).orderStatus, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusText, - ), - OrderLogItem( - title: TranslationBase.of(context).pickupDate, - value: getDate(amRequestViewModel.patientAmbulanceRequestOrdersList[index].created), - ), - OrderLogItem( - title: TranslationBase.of(context).pickupLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].pickupLocation, - ), - OrderLogItem( - title: TranslationBase.of(context).dropoffLocation, - value: amRequestViewModel.patientAmbulanceRequestOrdersList[index].dropOffLocation, - ), - if (amRequestViewModel.patientAmbulanceRequestOrdersList[index].statusId == 1) - Container( - padding: EdgeInsets.all(10), - width: double.maxFinite, - margin: EdgeInsets.only(bottom: 4, left: 4, right: 4), + child: amRequestViewModel.patientAmbulanceRequestOrdersList.length > 0 + ? ListView.builder( + padding: EdgeInsets.all(21), + itemCount: amRequestViewModel.patientAmbulanceRequestOrdersList.length, + itemBuilder: (context, index) { + AmbulanceRequestOrdersModel order = amRequestViewModel.patientAmbulanceRequestOrdersList[index]; + + int status = order.statusId; + String _statusDisp = order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return Container( + margin: EdgeInsets.only(bottom: 12.0), decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 13, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12), - bottomLeft: Radius.circular(12), + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - color: Colors.white), - child: SecondaryButton( - color: Colors.red[900], - textColor: Colors.white, - label: TranslationBase.of(context).cancel, - onTap: () { - amRequestViewModel.updatePressOrder(presOrderID: amRequestViewModel.pendingAmbulanceRequestOrder.id); - }, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).transportMethod + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + order.serviceText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 16 / 10), + ), + ), + ], + ), + SizedBox( + height: 13.0, + ), + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox(height: 12), + if (order.statusId == 1 || order.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(amRequestViewModel, order.iD, context); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.textColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.pickupLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + Container( + height: 20.0, + width: 1.0, + color: CustomColors.grey2, + margin: const EdgeInsets.only(left: 3.0, right: 3.0), + ), + Row( + children: [ + Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 10.0) : EdgeInsets.only(right: 10.0), + width: 8, + height: 8, + decoration: containerRadius( + CustomColors.accentColor, + 100, + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dropoffLocation + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + order.dropOffLocation.trim().toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + ], + ), + ], + ), ), - ) - ], - ), - ), - ), + ); + }) + : getNoDataWidget(context), ); } diff --git a/lib/pages/ErService/rapid-response-team/rrt-agreement-page.dart b/lib/pages/ErService/rapid-response-team/rrt-agreement-page.dart index c3048127..4ee9cb65 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-agreement-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-agreement-page.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/pages/conference/clipped_video.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart index 59f11fb2..5f0506f3 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart @@ -1,54 +1,63 @@ -import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -class RRTLogPage extends StatefulWidget{ - final List orders; +class RRTLogPage extends StatefulWidget { + final List orders; const RRTLogPage({this.orders}); - - @override - State createState() => RRTLogPageState(); + @override + State createState() => RRTLogPageState(); } -class RRTLogPageState extends State{ +class RRTLogPageState extends State { RRTViewModel viewModel; @override - Widget build(BuildContext context) { + void initState() { + setState(() {}); + super.initState(); + } + @override + Widget build(BuildContext context) { return BaseView( - onModelReady: (vm) => viewModel = vm, - builder: (ctx, vm, widgetState){ - return ListView.builder( - itemCount: widget.orders.length, - itemBuilder: (ctx, idx) { - var order = widget.orders[idx]; - return RRTLogListItem(order, onCancel: deleteOrder); - } - ); - } - ); + onModelReady: (vm) => { + viewModel = vm, + }, + builder: (ctx, vm, widgetState) { + return widget.orders.length > 0 + ? ListView.builder( + itemCount: widget.orders.length, + padding: EdgeInsets.all(21), + itemBuilder: (ctx, idx) { + var order = widget.orders[idx]; + return RRTLogListItem(order, onCancel: deleteOrder); + }) + : getNoDataWidget(context); + }); } - deleteOrder(PrescriptionsOrder order) async { + deleteOrder(GetCMCAllOrdersResponseModel order) async { GifLoaderDialogUtils.showMyDialog(context); - var success = await viewModel.cancelOrder(order); - GifLoaderDialogUtils.hideDialog(context); - if(success) - setState(() { - widget.orders.remove(order); - }); + var success = await viewModel.cancelOrderRC(order); + + if (success) { + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrdersRC(); + viewModel.setState(ViewState.Idle); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); + Navigator.push(context, FadePage(page: RRTMainScreen())); + } } - -} - - +} \ No newline at end of file diff --git a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart index 9ee7bd1c..62fa4745 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-logs-page.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-request-page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -7,8 +8,13 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class RRTMainScreen extends StatefulWidget { + final index = 0; + + RRTMainScreen({index}); + @override State createState() => RRTMainScreenState(); } @@ -23,6 +29,8 @@ class RRTMainScreenState extends State with SingleTickerProviderS List imagesInfo = List(); + ProjectViewModel projectViewModel; + @override void initState() { super.initState(); @@ -34,11 +42,14 @@ class RRTMainScreenState extends State with SingleTickerProviderS @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); localize = TranslationBase.of(context); return AppScaffold( appBarTitle: localize.rapidResponseTeam, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, description: TranslationBase.of(context).rrtDDetails, imagesInfo: imagesInfo, body: BaseView( @@ -73,23 +84,43 @@ class RRTMainScreenState extends State with SingleTickerProviderS } Widget tabBar() => Container( - margin: EdgeInsets.all(15), + margin: EdgeInsets.all(0.0), clipBehavior: Clip.hardEdge, decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)), - child: TabBar(onTap: onPageChanged, indicatorWeight: 3, indicatorColor: Color(0xFFc5272d), isScrollable: false, controller: tabController, indicatorSize: TabBarIndicatorSize.label, tabs: [ - Tab( - child: Text( - localize.rapidResponseTeam, - style: TextStyle(color: Theme.of(context).appBarTheme.color), + child: TabBar( + onTap: onPageChanged, + controller: tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 5, bottom: 5), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ), - Tab( - child: Text( - localize.orderLog, - style: TextStyle(color: Theme.of(context).appBarTheme.color), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ), - ]), + tabs: [ + Tab( + child: Text( + localize.rapidResponseTeam, + style: TextStyle(color: Theme.of(context).appBarTheme.color), + ), + ), + Tab( + child: Text( + localize.orderLog, + style: TextStyle(color: Theme.of(context).appBarTheme.color), + ), + ), + ]), ); Widget contentPager() => PageView( diff --git a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart index ed6078ff..dfb7cdaa 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart @@ -1,71 +1,241 @@ - +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5)); -class RRTLogListItem extends StatelessWidget{ - final PrescriptionsOrder order; - final Function(PrescriptionsOrder) onCancel; - RRTLogListItem(this.order, {this.onCancel}); +class RRTLogListItem extends StatefulWidget { + final GetCMCAllOrdersResponseModel order; + final Function(GetCMCAllOrdersResponseModel) onCancel; + RRTLogListItem(this.order, {this.onCancel}); + @override + State createState() => RRTLogListItemState(); BuildContext _context; +} +class RRTLogListItemState extends State { + RRTViewModel viewModel; TranslationBase localize; + @override Widget build(BuildContext context) { - _context = context; - localize = TranslationBase.of(context); + ProjectViewModel projectViewModel = Provider.of(context); - return Container( - padding: EdgeInsets.all(15), margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)] - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _contentItem(label: localize.reqId, value: order.iD.toString()), - _item_content_seperator, - _contentItem(label: localize.status, value: order.getStatusName(localize)), - _item_content_seperator, - _contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()), - _item_content_seperator, - _contentItem(label: localize.location, value: order.getNearestProjectDescription()), - _item_content_seperator, - SizedBox(height: 10), + localize = TranslationBase.of(context); + int status = widget.order.statusId; + String _statusDisp = widget.order.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return BaseView( + onModelReady: (vm) => { + viewModel = vm, + }, + builder: (ctx, vm, widgetState) { + return Container( + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + 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( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.order.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // TranslationBase.of(context).locationa + ": ", + // style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + // ), + // Expanded( + // child: Text( + // widget.order.projectName.toString(), + // style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + // ), + // ), + // ], + // ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + localize.pickupDate + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.order.created)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], + ), + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.order.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.order.statusId == 1 || widget.order.statusId == 2) + InkWell( + onTap: () { + //onCancel(order); + cancelOrders(widget.order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ], + ), + ], + ), + ), + ); + }); - if(onCancel != null) - FractionallySizedBox(child: cancelButton()) - ], - ), - ); + // return Container( + // padding: EdgeInsets.all(15), + // margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10), + // decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.stretch, + // children: [ + // _contentItem(label: localize.reqId, value: order.iD.toString()), + // _item_content_seperator, + // _contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)), + // _item_content_seperator, + // _contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()), + // _item_content_seperator, + // _contentItem(label: localize.location, value: order.getNearestProjectDescription()), + // _item_content_seperator, + // SizedBox(height: 10), + // if (order.status == 1 || order.status == 2) Container(child: cancelButton()) + // ], + // ), + // ); } - Widget _contentItem({@required String label, String value}){ - return Container( - padding: EdgeInsets.symmetric(vertical: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(label, style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),), - SizedBox(height: 5,), - Text(value, style: TextStyle(color: Theme.of(_context).appBarTheme.color,fontWeight: FontWeight.bold, fontSize: 14),), - ], - ), - ); - } + // Widget _contentItem({@required String label, String value}) { + // return Container( + // padding: EdgeInsets.symmetric(vertical: 10), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // label, + // style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1), + // ), + // SizedBox( + // height: 5, + // ), + // Text( + // value, + // style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontWeight: FontWeight.bold, fontSize: 14), + // ), + // ], + // ), + // ); + // } - Widget cancelButton() => MaterialButton( - height: 45, - color: Color(0xFFc5272d), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: () => onCancel(order), - child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13),), + // Widget cancelButton() => MaterialButton( + // height: 45, + // color: Color(0xFFc5272d), + // shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + // onPressed: () => onCancel(order), + // child: Text( + // localize.cancel, + // style: TextStyle(color: Colors.white, fontSize: 13), + // ), + // ); + cancelOrders(order) async { + GifLoaderDialogUtils.showMyDialog(context); + var success = await viewModel.cancelOrderRC(order); - ); + if (success) { + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrdersRC(); + viewModel.setState(ViewState.Idle); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); + Navigator.push(context, FadePage(page: RRTMainScreen())); + } + } } diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index 20acbbb4..9d9ca428 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -1,75 +1,126 @@ import 'dart:async'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.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:flutter_material_pickers/flutter_material_pickers.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_maps_place_picker/google_maps_place_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'rrt-place-order.dart'; -class RRTRequestPickupAddressPage extends StatefulWidget{ - +class RRTRequestPickupAddressPage extends StatefulWidget { final ServicePrice servicePrice; + RRTRequestPickupAddressPage({@required this.servicePrice}); @override - State createState() => RRTRequestPickupAddressPageState(); - + State createState() => RRTRequestPickupAddressPageState(); } -class RRTRequestPickupAddressPageState extends State with SingleTickerProviderStateMixin{ + +class RRTRequestPickupAddressPageState extends State with SingleTickerProviderStateMixin { bool acceptTerms = false; bool mapIdle = true; Completer mapController = Completer(); - CameraPosition mapCameraPosition = CameraPosition( - target: LatLng(24.7114693, 46.67469582), - zoom: 14.4746, + + static CameraPosition cameraPosition = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 17, ); - - List myAddresses = []; - Addresses selectedAddress; + LatLng currentPostion; + List myAddresses = []; + AddressInfo selectedAddress = new AddressInfo(); StreamController addressStreamController = StreamController(); Stream addressStream; StreamController addressLoadingStreamController = StreamController(); Stream addressLoadingStream; + // AddressInfo _selectedAddress; + double latitude = 0; + double longitude = 0; + AppMap appMap; + bool showCurrentLocation = false; + AppSharedPreferences sharedPref = AppSharedPreferences(); + @override - void initState(){ + void initState() { super.initState(); - goToCurrentLocation(); - addressStream = addressStreamController.stream; - addressLoadingStream = addressLoadingStreamController.stream; + + appMap = AppMap( + cameraPosition.toMap(), + onCameraMove: (camera) { + _updatePosition(camera); + }, + onMapCreated: () { + _getUserLocation(); + setState(() {}); + }, + ); + + // addressStream = addressStreamController.stream; + // addressLoadingStream = addressLoadingStreamController.stream; } - - void loadAddresses() async{ - // GifLoaderDialogUtils.showMyDialog(context); - myAddresses = await viewModel.getAddresses(); - // GifLoaderDialogUtils.hideDialog(context); - - if(myAddresses.isNotEmpty) - setState(() {}); + + setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { + if (latLong == null) { + if (myAddresses.isEmpty) { + setState(() { + showCurrentLocation = true; + }); + } else { + latLong = myAddresses[myAddresses.length - 1].latLong; + } + } + + if (!showCurrentLocation) { + List latLongArr = latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + currentPostion = LatLng(latitude, longitude); + setMap(); + } + } + + setMap() { + setState(() { + cameraPosition = CameraPosition( + target: currentPostion, + zoom: 16, + ); + appMap.moveTo(cameraPostion: cameraPosition); + selectedAddress.latLong = currentPostion.latitude.toString() + "," + currentPostion.longitude.toString(); + }); + } + + void loadAddresses() async { + await viewModel.getCustomerInfo(); + + if (viewModel.addressesList.isNotEmpty) setState(() {}); } TranslationBase localize; RRTViewModel viewModel; - + @override Widget build(BuildContext context) { localize = TranslationBase.of(context); @@ -78,175 +129,217 @@ class RRTRequestPickupAddressPageState extends State( - onModelReady: (vm){ + onModelReady: (vm) { viewModel = vm; loadAddresses(); + myAddresses = viewModel.addressesList; }, builder: (ctx, vm, widget) => AppScaffold( appBarTitle: localize.pickupLocation, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + baseViewModel: viewModel, body: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - StreamBuilder( - stream: addressStream, - builder: (context, snapshot) { - return selectAddressField(); - } + Container( + margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12), + decoration: cardRadius(12), + + child: Container( + child: InkWell( + onTap: () => confirmSelectLocationDialog(myAddresses), + child: Container( + padding: EdgeInsets.all(8), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + getAddressName(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.45, + ), + ), + ), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + height: 50, + width: double.infinity, + ), ), - StreamBuilder( - stream: addressLoadingStream, - builder: (context, snapshot) { - return snapshot.hasData ? LinearProgressIndicator(backgroundColor: Colors.transparent) : Container(height: 4,); - } + InkWell( + onTap: () async { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), + child: Row( + children: [ + Icon(Icons.add_circle_outline_sharp), + mWidth(12), + Text( + TranslationBase.of(context).addNewAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + ], + ), + ), ), Expanded( - child: - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { - if(state == SearchingState.Idle){ - addressLoadingStreamController.sink.add(null); - if(selectedPlace != null){ - var loc = selectedPlace.geometry.location; - var address1 = selectedPlace.addressComponents.first.longName; - var address2 = ""; - if(selectedPlace.addressComponents.length > 1) - address2 = selectedPlace.addressComponents[1].longName; - - selectedAddress = Addresses(latLong: '${loc.lat},${loc.lng}', address1: address1, address2: address2); - addressStreamController.sink.add(0); - } - }else{ - addressLoadingStreamController.sink.add(0); - } - return Container(); - }, - initialPosition: LatLng(24.7114693, 46.67469582), - useCurrentLocation: false, + child: Stack( + alignment: Alignment.center, + children: [ + if (appMap != null) appMap, + Icon( + Icons.place, + color: CustomColors.accentColor, + size: 50, + ), + ], ), ), - continueButton() + Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + child: continueButton(), + ), ], - ) - ) - ); + ))); + } + + void _updatePosition(CameraPosition _position) { + latitude = _position.target.latitude; + longitude = _position.target.longitude; + selectedAddress.latLong = latitude.toString() + "," + longitude.toString(); } - Widget centerTargetPoint(){ + Widget centerTargetPoint() { double size = mapIdle ? 20 : 30; double margin = mapIdle ? 3 : 10; return Center( child: Container( - width: size, height: size, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), border: Border.all(width: 2, color: Theme.of(context).appBarTheme.color) - ), - child: Container( - margin: EdgeInsets.all(margin), - decoration: BoxDecoration( - color: Theme.of(context).appBarTheme.color, - borderRadius: BorderRadius.circular(20)) - ), + width: size, + height: size, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), border: Border.all(width: 2, color: Theme.of(context).appBarTheme.color)), + child: Container(margin: EdgeInsets.all(margin), decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.circular(20))), ), ); } - Widget selectAddressField(){ - var text = selectedAddress == null ? localize.selectAddress : selectedAddress.toString(); - return Container( - margin: EdgeInsets.all(10), - height: 50, - child: MaterialButton( - height: 50, color: Colors.white, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: openAddressSelectDialog, - child: Row( - children: [ - Expanded(child: Text(text, style: TextStyle(color: Colors.grey, fontSize: 13, letterSpacing: 1))), - Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.grey,) - ], - ), - ), + Widget continueButton() { + return Padding( + padding: const EdgeInsets.all(0.0), + child: DefaultButton(TranslationBase.of(context).continues, () { + Navigator.push( + context, + FadePage( + page: RRTPlaceOrderPage( + selectedAddress: selectedAddress, + servicePrice: widget.servicePrice, + ))); + }), ); } - Widget continueButton(){ - return Padding( - padding: const EdgeInsets.all(15), - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: () => - Navigator.push( - context, - FadePage(page: RRTPlaceOrderPage(selectedAddress: selectedAddress, servicePrice: widget.servicePrice,)) - ), - child: Text(localize.continues, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),), + void confirmSelectLocationDialog(List addresses) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: selectedAddress, + onValueSelected: (value) { + showCurrentLocation = false; + setLatitudeAndLongitude(latLong: value.latLong); + + setState(() { + selectedAddress = value; + }); + }, ), ); } - - openAddressSelectDialog(){ - showMaterialResponsiveDialog( - hideButtons: true, - context: context, - title: localize.selectAddress, - child: ListView.separated( - shrinkWrap: true, - padding: EdgeInsets.all(10), - itemCount: myAddresses.length, - itemBuilder: (ctx,idx) { - var itm = myAddresses[idx]; - return ListTile( - title: Text(itm.toString()), - onTap: (){ - setState(() { - selectedAddress = itm; - Navigator.pop(context); - if(itm.latLong != null && itm.latLong.isNotEmpty && itm.latLong.split(',').length > 1){ - var cordinates = itm.latLong.split(','); - var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last)); - moveToLocation(latlng); - }else{ - AppToast.showErrorToast(message: 'Invalid address coordinates'); - } - }); - }, - ); - }, - separatorBuilder: (ctx,idx) => Container(height: 0.25, color: Colors.grey.withOpacity(0.7),) - ) - ); + String getAddressName() { + if (selectedAddress != null && selectedAddress.address1 != null) + return selectedAddress.address1; + else + return TranslationBase.of(context).selectAddress; } - moveToLocation(LatLng location, {bool animate = true}) async{ + moveToLocation(LatLng location, {bool animate = true}) async { await Future.delayed(Duration(milliseconds: 200)); - mapCameraPosition = CameraPosition(target: location, zoom: 16.4746,); - if(animate) - (await mapController.future).animateCamera(CameraUpdate.newCameraPosition(mapCameraPosition),); + cameraPosition = CameraPosition( + target: location, + zoom: 16.4746, + ); + if (animate) + (await mapController.future).animateCamera( + CameraUpdate.newCameraPosition(cameraPosition), + ); else - (await mapController.future).moveCamera(CameraUpdate.newCameraPosition(mapCameraPosition),); + (await mapController.future).moveCamera( + CameraUpdate.newCameraPosition(cameraPosition), + ); } - goToCurrentLocation() async{ - var location = await Geolocator.getLastKnownPosition(); - if(location == null){ - Geolocator.getCurrentPosition().then((value){ - moveToLocation(LatLng(value.latitude, value.longitude)); - }); - return; + void _getUserLocation() async { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + var lat = await this.sharedPref.getDouble(USER_LAT); + var long = await this.sharedPref.getDouble(USER_LONG); + latitude = lat; + longitude = long; + currentPostion = LatLng(lat, long); + setMap(); + } else { + if (await Permission.location.request().isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } else { + requestPermissions().then( + (value) async { + if (value[Permission.location].isGranted) { + var position = await GeolocatorPlatform.instance.getCurrentPosition(desiredAccuracy: LocationAccuracy.low); + currentPostion = LatLng(position.latitude, position.longitude); + latitude = position.latitude; + longitude = position.longitude; + setMap(); + } + }, + ); + } } + } - moveToLocation(LatLng(location.latitude, location.longitude), animate: false); + goToCurrentLocation() async { + Geolocator.getCurrentPosition().then((value) { + selectedAddress = AddressInfo(latLong: '${value.latitude},${value.longitude}'); + moveToLocation(LatLng(value.latitude, value.longitude)); + }); } -} \ No newline at end of file +} diff --git a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart index 8287bfad..216d4637 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart @@ -1,31 +1,39 @@ -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; -import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.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/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:google_maps_flutter/google_maps_flutter.dart'; +import 'package:provider/provider.dart'; -class RRTPlaceOrderPage extends StatelessWidget{ +class RRTPlaceOrderPage extends StatelessWidget { TranslationBase localize; RRTViewModel viewModel; - Addresses selectedAddress; + AddressInfo selectedAddress; final ServicePrice servicePrice; RRTPlaceOrderPage({@required this.selectedAddress, @required this.servicePrice}); TextEditingController noteController = TextEditingController(text: ''); BuildContext _context; + + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); _context = context; localize = TranslationBase.of(context); var lat = selectedAddress.latLong.split(',').first; @@ -33,163 +41,185 @@ class RRTPlaceOrderPage extends StatelessWidget{ return BaseView( onModelReady: (vm) => viewModel = vm, - builder: (ctx,vm,wState){ + builder: (ctx, vm, wState) { return AppScaffold( - appBarTitle: localize.rapidResponseTeam, - isShowAppBar: true, - body: Column( + appBarTitle: localize.rapidResponseTeam, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + body: SingleChildScrollView( + padding: EdgeInsets.all(20), + child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Expanded( - child: SingleChildScrollView( - padding: EdgeInsets.all(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text(localize.selectedLocation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),), - - selectedAddressField(), - - AspectRatio( - aspectRatio: 3/1, - child: ClipRRect( - clipBehavior: Clip.hardEdge, - borderRadius: BorderRadius.circular(10), - child: Image.network( - "https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng &zoom=16&size=800x400&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", - fit: BoxFit.cover, - ), - ), - ), - - SizedBox(height: 10,), - - Container( - height: 70, - margin: EdgeInsets.symmetric(vertical: 5), - padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10), - boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))] - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(localize.totalAmountPayable, style: TextStyle(fontSize: 13),), - SizedBox(height: 5,), - Text("${servicePrice.totalPrice ?? '- - -'} ${localize.sar}" , style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),), - ], - ), - ), - - Container( - height: 70, - margin: EdgeInsets.symmetric(vertical: 5), - padding: EdgeInsets.symmetric(horizontal: 0, vertical: 10), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10), - boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2,2), color: Colors.grey.withOpacity(0.25))] - ), - child: TextField( - controller: noteController, - style: TextStyle(fontSize: 18.0), - decoration: InputDecoration( - filled: true, - fillColor: Colors.white, - labelText: localize.notes, - contentPadding: const EdgeInsets.only(left: 14.0, bottom: 8.0, top: 8.0), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(10), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - borderRadius: BorderRadius.circular(10), - ), - ) - ), - ), - ], + Text( + localize.selectedLocation, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), + ), + selectedAddressField(), + AspectRatio( + aspectRatio: 3 / 1, + child: ClipRRect( + clipBehavior: Clip.hardEdge, + borderRadius: BorderRadius.circular(10), + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=$lat,$lng &zoom=17&size=800x600&maptype=roadmap&markers=color:red%7C$lat,$lng&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + fit: BoxFit.cover, ), ), ), - submitButton(context) + SizedBox( + height: 10, + ), + Container( + height: 85, + margin: EdgeInsets.symmetric(vertical: 5), + padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2, 2), color: Colors.grey.withOpacity(0.25))]), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + localize.patientShareWithTax, + style: TextStyle(fontSize: 13), + ), + SizedBox( + height: 5, + ), + Text( + "${servicePrice.totalPrice ?? '- - -'} ${localize.sar}", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), + ), + ], + ), + ), + Container( + height: 70, + margin: EdgeInsets.symmetric(vertical: 5), + padding: EdgeInsets.symmetric(horizontal: 0, vertical: 10), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [BoxShadow(blurRadius: 5, spreadRadius: 2, offset: Offset(2, 2), color: Colors.grey.withOpacity(0.25))]), + child: TextField( + controller: noteController, + style: TextStyle(fontSize: 18.0), + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + labelText: localize.notes, + contentPadding: const EdgeInsets.only(left: 14.0, bottom: 8.0, top: 8.0), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.white), + borderRadius: BorderRadius.circular(10), + ), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.white), + borderRadius: BorderRadius.circular(10), + ), + )), + ), ], - ) + ), + ), + bottomSheet: submitButton(context), ); }, ); } - - Widget selectedAddressField(){ + Widget selectedAddressField() { var address = "${selectedAddress.address1 ?? ''} ${selectedAddress.address2 ?? ''}"; - return Container( - margin: EdgeInsets.symmetric(vertical: 10), - child: Expanded( - child: MaterialButton( - height: 50, color: Colors.white, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: (){}, - child: Row( - children: [ - Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 15, letterSpacing: 1))), - Icon(Icons.location_on_rounded, size: 30, color: Colors.black,) - ], - ), - ), - ), - ); + return selectedAddress.address1 != null + ? Container( + margin: EdgeInsets.symmetric(vertical: 10), + child: MaterialButton( + height: 50, + color: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + onPressed: () {}, + child: Row( + children: [ + Expanded(child: Text(address, style: TextStyle(color: Colors.black87, fontSize: 12, letterSpacing: 1))), + Icon( + Icons.location_on_rounded, + size: 30, + color: Colors.black, + ) + ], + ), + ), + ) + : SizedBox(); } - - Widget submitButton(BuildContext context){ - return Padding( - padding: const EdgeInsets.all(15), - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), - onPressed: () => placeOrder(), - child: Text(localize.submit, style: TextStyle(color: Colors.white, fontSize: 15, letterSpacing: 1),), + Widget submitButton(BuildContext context) { + return Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(15), + child: DefaultButton( + localize.submit, + () => placeOrder(), + color: CustomColors.green, + ), ), ); } - placeOrder() async{ - if(selectedAddress != null && selectedAddress.latLong != null && selectedAddress.latLong.isNotEmpty && selectedAddress.latLong.split(',').length > 1){ + placeOrder() async { + if (selectedAddress != null && selectedAddress.latLong != null && selectedAddress.latLong.isNotEmpty && selectedAddress.latLong.split(',').length > 1) { GifLoaderDialogUtils.showMyDialog(_context); Map params = {}; var cordinates = selectedAddress.latLong.split(','); var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last)); - params['Latitude'] = latlng.latitude; - params['Longitude'] = latlng.longitude; - params['Notes'] = noteController.text; - var requestId = await viewModel.createOrder(params); + params['latitude'] = latlng.latitude; + params['longitude'] = latlng.longitude; + params['additionalDetails'] = noteController.text; + params['nationality'] = projectViewModel.user.nationalityID; + params['paymentAmount'] = servicePrice.totalPrice; + + // var response = await viewModel.createOrder(params); + // var requestId = await viewModel.createOrder(params); + + var requestId = await viewModel.createOrderRC(params); GifLoaderDialogUtils.hideDialog(_context); - if(requestId != null){ - AlertDialogBox( - context: _context, - title: '', - confirmMessage: localize.rrtOrderSuccessMessage, - okText: localize.ok, - okFunction: (){ - AlertDialogBox.closeAlertDialog(_context); - gotoRRTRoot(); - } - ).showAlertDialog(_context); + if (requestId != null) { + showCMCConfirmDialog( + _context, + requestId.toString(), + onClick: () { + gotoRRTRoot(); + // Navigator.pop(_context); + // Navigator.pop(_context); + }, + ); } - }else{ + + // if (requestId != null) { + // AlertDialogBox( + // context: _context, + // title: '', + // confirmMessage: localize.rrtOrderSuccessMessage, + // okText: localize.ok, + // okFunction: () { + // AlertDialogBox.closeAlertDialog(_context); + // gotoRRTRoot(); + // }).showAlertDialog(_context); + // } + } else { AppToast.showErrorToast(message: 'Invalid location selected'); } - } - - gotoRRTRoot(){ - Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: ErOptions)); + + gotoRRTRoot() async { + viewModel.setState(ViewState.Busy); + await viewModel.getAllOrdersRC(); + viewModel.setState(ViewState.Idle); + Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); + Navigator.push(_context, FadePage(page: RRTMainScreen())); } -} \ No newline at end of file +} diff --git a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart index 4cbfeb4b..243d74ae 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart @@ -1,55 +1,50 @@ -import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; -import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-agreement-page.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.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_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class RRTRequestPage extends StatefulWidget{ - - final List pendingOrders; +class RRTRequestPage extends StatefulWidget { + final List pendingOrders; final ServicePrice servicePrice; RRTRequestPage({this.pendingOrders, this.servicePrice}); @override - State createState() => RRTRequestPageState(); - + State createState() => RRTRequestPageState(); } -class RRTRequestPageState extends State{ - bool acceptTerms = false; - TranslationBase localize; +class RRTRequestPageState extends State { + bool acceptTerms = false; RRTViewModel viewModel; @override Widget build(BuildContext context) { - localize = TranslationBase.of(context); return BaseView( - onModelReady: (vm){ + onModelReady: (vm) { viewModel = vm; }, - builder: (ctx, vm, widgetState){ - - if(widget.pendingOrders.isNotEmpty) + builder: (ctx, vm, widgetState) { + if (widget.pendingOrders.isNotEmpty) return currentOrderContent(); else return requestContent(); - }, ); - } - Widget requestContent(){ + Widget requestContent() { return Column( children: [ Expanded( @@ -62,46 +57,44 @@ class RRTRequestPageState extends State{ acceptPolicy(), - Container(height: 0.5, color: Theme.of(context).appBarTheme.color),// Seperator + Container(height: 0.5, color: Theme.of(context).appBarTheme.color), // Seperator Container( padding: EdgeInsets.only(top: 20, bottom: 5), alignment: Alignment.center, - child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2) - ), + child: Text(TranslationBase.of(context).youCanPayByTheFollowingOptions, + style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)), - paymentOptions(), + Container(margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), child: getPaymentMethods()) ], ), ), - actionButtons() ], ); } - Widget currentOrderContent(){ + Widget currentOrderContent() { var orders = widget.pendingOrders; return ListView.builder( itemCount: orders.length, + padding: EdgeInsets.all(21), itemBuilder: (ctx, idx) { - var order = orders[idx]; + var order = orders[idx]; return RRTLogListItem(order, onCancel: deleteOrder); - } - ); + }); } - Widget serviceDescription(BuildContext context) => - Padding( + Widget serviceDescription(BuildContext context) => Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Text( - localize.rrtDDetails, + TranslationBase.of(context).rrtDDetails, textAlign: TextAlign.justify, style: TextStyle(color: Theme.of(context).appBarTheme.color, fontSize: 15, height: 1.5, fontWeight: FontWeight.w300), ), ); - Widget priceTable(BuildContext context){ + Widget priceTable(BuildContext context) { var radius = Radius.circular(8); String amount = widget.servicePrice.price.toString(); String vat = widget.servicePrice.vat.toString(); @@ -112,128 +105,118 @@ class RRTRequestPageState extends State{ Container( height: 30, decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.only(topLeft: radius, topRight: radius)), - child: Center(child: Text(localize.approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))), + child: Center(child: Text(TranslationBase.of(context).approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))), ), - - pricingRow(label: localize.amountBeforeTax, value: '$amount ${localize.sar}'), + pricingRow(label: TranslationBase.of(context).patientShare, value: '$amount ${TranslationBase.of(context).sar}'), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), - - pricingRow(label: localize.taxAmount, value: '$vat ${localize.sar}'), + pricingRow(label: TranslationBase.of(context).patientTaxToDo, value: '$vat ${TranslationBase.of(context).sar}'), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), - - pricingRow(label: localize.totalAmountPayable, value: '$total ${localize.sar}', labelBold: true), + pricingRow(label: TranslationBase.of(context).patientShareWithTax, value: '$total ${TranslationBase.of(context).sar}', labelBold: true), Container(height: 0.5, color: Theme.of(context).appBarTheme.color), ], ); } - Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}){ - return - Container( - height: 40, margin: EdgeInsets.symmetric(horizontal: 10), - child: Row( - children: [ - Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)), - Spacer(), - Container(height: 40, color: Theme.of(context).appBarTheme.color, width: 0.5,), - Container( - alignment: Alignment.center, - width: MediaQuery.of(context).size.width * 0.25, - child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal)) - ), - ], - ), - ); + Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}) { + return Container( + height: 40, + margin: EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)), + Spacer(), + Container( + height: 40, + color: Theme.of(context).appBarTheme.color, + width: 0.5, + ), + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width * 0.25, + child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))), + ], + ), + ); } - - Widget acceptPolicy(){ + Widget acceptPolicy() { return Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ - Checkbox(value: acceptTerms, onChanged: (v){ - setState(() => acceptTerms = v); - }), + Checkbox( + value: acceptTerms, + onChanged: (v) { + setState(() => acceptTerms = v); + }), SizedBox(width: 10), - Expanded( - child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2) - ), + Expanded(child: Text(TranslationBase.of(context).iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)), Container( alignment: Alignment.center, width: MediaQuery.of(context).size.width * 0.25, child: TextButton( - child: Text(localize.clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)), - onPressed: (){ + child: Text(TranslationBase.of(context).clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)), + onPressed: () { Navigator.push( - context, - FadePage( - page: RRTAgreementPage())); - } - ), + context, + FadePage( + page: UserAgreementContent(), + ), + ); + }), ) ], ), ); } - Widget paymentOptions()=> Container( + Widget paymentOptions() => Container( height: 30, alignment: Alignment.center, - child: Image.asset("assets/payment_options/payment_options.png", fit: BoxFit.fill,) - ); + child: Image.asset( + "assets/payment_options/payment_options.png", + fit: BoxFit.fill, + )); - Widget actionButtons(){ + Widget actionButtons() { return Container( margin: EdgeInsets.all(15), child: Row( children: [ Expanded( - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - onPressed: () { }, - child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),), - + child: DefaultButton( + TranslationBase.of(context).next, + () { + if (acceptTerms) + goToPickupAddress(); + else + AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); + }, + color: acceptTerms ? CustomColors.accentColor : Colors.grey, ), ), - SizedBox(width: 20,), - Expanded( - child: MaterialButton( - height: 50, - color: Theme.of(context).appBarTheme.color, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ), - child: Text(localize.ok, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),), - onPressed: () { - if(acceptTerms) - goToPickupAddress(); - else - AppToast.showErrorToast(message: localize.pleaseAcceptTerms); - } - ), - ) ], ), ); } - - goToPickupAddress()async{ + + goToPickupAddress() async { Navigator.push( context, - FadePage(page: RRTRequestPickupAddressPage(servicePrice: widget.servicePrice,)) - ); + FadePage( + page: RRTRequestPickupAddressPage( + servicePrice: widget.servicePrice, + ))); } - - - deleteOrder(PrescriptionsOrder order) async { + deleteOrder(GetCMCAllOrdersResponseModel order) async { GifLoaderDialogUtils.showMyDialog(context); - var success = await viewModel.cancelOrder(order); + var success = await viewModel.cancelOrderRC(order); GifLoaderDialogUtils.hideDialog(context); - if(success) + if (success) setState(() { widget.pendingOrders.remove(order); }); + await viewModel.getAllOrdersRC(); } -} \ No newline at end of file +} diff --git a/lib/pages/ErService/widgets/StepsWidget.dart b/lib/pages/ErService/widgets/StepsWidget.dart index 56b3de6b..219cfd60 100644 --- a/lib/pages/ErService/widgets/StepsWidget.dart +++ b/lib/pages/ErService/widgets/StepsWidget.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -12,216 +14,331 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return projectViewModel.isArabic? - Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, + return Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12, bottom: 12), + child: Row( + children: [ + Expanded( + child: showProgress( + title: TranslationBase.of(context).transportation, + status: index == 0 + ? TranslationBase.of(context).inPrgress + : index > 0 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 0 ? CustomColors.orange : CustomColors.green, ), ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).locationa, + status: index == 1 + ? TranslationBase.of(context).inPrgress + : index > 1 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 1 + ? CustomColors.orange + : index > 1 + ? CustomColors.green + : CustomColors.grey2, ), ), - ), - Positioned( - top: 10, - right: MediaQuery.of(context).size.width * 0.3, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).otherInfo, + status: index == 2 + ? TranslationBase.of(context).inPrgress + : index > 2 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: index == 2 + ? CustomColors.orange + : index > 2 + ? CustomColors.green + : CustomColors.grey2, ), ), - ), - Positioned( - top: 10, - right: MediaQuery.of(context).size.width * 0.6, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), - ), + showProgress( + title: TranslationBase.of(context).RRTSummary, + status: index == 3 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked, + color: index == 3 + ? CustomColors.orange + : index > 4 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3):null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: Border.all(color: Colors.black,width: 0.75), + ], + ), + ); - shape: BoxShape.circle, - color: index == 3 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '4', - color: index == 3 ? Colors.white : Colors.grey[800], - ), - ), - ), - ), - ), - ], - ): - Stack( + // return projectViewModel.isArabic? + // Stack( + // children: [ + // Container( + // height: 50, + // width: MediaQuery.of(context).size.width, + // color: Colors.transparent, + // child: Center( + // child: Divider( + // color: Colors.grey, + // height: 0.75, + // thickness: 0.75, + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: 0, + // child: InkWell( + // onTap: () => changeCurrentTab(0), + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '1', + // color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: MediaQuery.of(context).size.width * 0.3, + // child: InkWell( + // onTap: () => index >= 2 ? changeCurrentTab(1) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '2', + // color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: MediaQuery.of(context).size.width * 0.6, + // child: InkWell( + // onTap: () => index >= 3 ? changeCurrentTab(2) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + // color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '3', + // color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: 0, + // child: InkWell( + // onTap: () => index == 2 ?changeCurrentTab(3):null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.black,width: 0.75), + // + // shape: BoxShape.circle, + // color: index == 3 ? Colors.grey[800] : Colors.white, + // ), + // child: Center( + // child: Texts( + // '4', + // color: index == 3 ? Colors.white : Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // ], + // ): + // Stack( + // children: [ + // Container( + // height: 50, + // width: MediaQuery.of(context).size.width, + // color: Colors.transparent, + // child: Center( + // child: Divider( + // color: Colors.grey, + // height: 0.75, + // thickness: 0.75, + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: 0, + // child: InkWell( + // onTap: () => changeCurrentTab(0), + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '1', + // color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: MediaQuery.of(context).size.width * 0.3, + // child: InkWell( + // onTap: () => index >= 2 ? changeCurrentTab(1) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), + // shape: BoxShape.circle, + // color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '2', + // color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // left: MediaQuery.of(context).size.width * 0.6, + // child: InkWell( + // onTap: () => index >= 3 ? changeCurrentTab(2) : null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), + // color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, + // ), + // child: Center( + // child: Texts( + // '3', + // color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // Positioned( + // top: 10, + // right: 0, + // child: InkWell( + // onTap: () => index == 2 ?changeCurrentTab(3):null, + // child: Container( + // width: 35, + // height: 35, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.black,width: 0.75), + // + // shape: BoxShape.circle, + // color: index == 3 ? Colors.grey[800] : Colors.white, + // ), + // child: Center( + // child: Texts( + // '4', + // color: index == 3 ? Colors.white : Colors.grey[800], + // ), + // ), + // ), + // ), + // ), + // ], + // ); + } + + Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.3, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 26, + height: 26, + decoration: containerRadius(color, 200), + child: Icon( + Icons.done, + color: Colors.white, + size: 16, + ), ), - ), + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: mDivider(Colors.grey), + )), + ], ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.6, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: index > 2 ? null:Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), + mHeight(8), + Text( + title, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.44, ), ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3):null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: Border.all(color: Colors.black,width: 0.75), - - shape: BoxShape.circle, - color: index == 3 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '4', - color: index == 3 ? Colors.white : Colors.grey[800], + mHeight(2), + Container( + padding: EdgeInsets.all(5), + decoration: containerRadius(color.withOpacity(0.2), 4), + child: Text( + status, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, ), ), ), - ), - ), + ], + ) ], ); } diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart deleted file mode 100644 index cd0dfaa9..00000000 --- a/lib/pages/ErService/widgets/card_common.dart +++ /dev/null @@ -1,81 +0,0 @@ -//import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../AmbulanceReq.dart'; -import '../NearestEr.dart'; - -class CardCommonEr extends StatelessWidget { - final image; - final text; - final subText; - final bool locked; - - final Function onTap; - const CardCommonEr( - { - this.locked = false, - @required this.image, - @required this.text, - @required this.subText, - @required this.onTap, - }); - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: locked ? null : onTap, - child: Opacity( - opacity: locked ? 0.25 : 1.0, - child: Stack( - children: [ - Container( - margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), - decoration: BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) - ], borderRadius: BorderRadius.circular(10), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(this.text, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - letterSpacing: 1.0, - fontSize: 20.0)), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(this.subText, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), - ), - Spacer(), - Container( - alignment: Alignment.bottomRight, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: 60.0), - ), - ], - ), - ), - if(locked) - Align( - alignment: Alignment.center, - child: lock() - ) - ] , - ), - ), - ); - } - - Widget lock(){ - return Container(child: Icon(Icons.lock_rounded, size: 80),); - } - -} diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart deleted file mode 100644 index 29fdd5a4..00000000 --- a/lib/pages/ErService/widgets/card_position.dart +++ /dev/null @@ -1,111 +0,0 @@ -//import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:maps_launcher/maps_launcher.dart'; - - -import '../NearestEr.dart'; - -class CardPosition extends StatelessWidget { - final image; - final text; - final subText; - final type; - final telephone; - final networkImage; - final latitude; - final longitude; - final projectname; - final cardSize; - final String waitingTime; - - const CardPosition( - { - @required this.image, - @required this.text, - @required this.subText, - @required this.type, - @required this.telephone, - @required this.networkImage , - @required this.latitude, - @required this.longitude, - @required this.projectname , - @required this.cardSize, - @required this.waitingTime , - }); - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - navigateToSearch(context, this.type,this.telephone,this.networkImage,this.latitude,this.longitude,this.projectname); - - }, - child: Container( - // width:MediaQuery.of(context).size.width * 0.47,//165, - margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0), - decoration: BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) - ], borderRadius: BorderRadius.circular(10), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: cardSize * 0.2 - 8, - margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), - child: Text(this.text, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, - letterSpacing: 1.0, - fontSize: 2 * SizeConfig.textMultiplier)), - ), - Container( - height: cardSize * 0.5 - 8, - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 8.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: cardSize * 0.4), - ), - Container( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), - height: cardSize * 0.2 - 8, - child: Text(this.subText, - overflow: TextOverflow.clip, - style: TextStyle( - color: Color(0xFFc5272d), letterSpacing: 1.0, fontSize: 15.0)), - ), - - ], - ), - ), - ); - } - - Future navigateToSearch(context, type,telephone,networkImage,latitude,longitude,projectname) async { - var localize = TranslationBase.of(context); - showDialog( - context: context,builder: (_) => AssetGiffyDialog( - entryAnimation: EntryAnimation.BOTTOM, - image:Image.network(networkImage, fit: BoxFit.cover,), - title: Text(projectname, - style: TextStyle( - fontSize: 22.0, fontWeight: FontWeight.w600), - ), - description: Text("${localize.averageWaitingTime}\n\n$waitingTime ${localize.minute}", textAlign: TextAlign.center,), - buttonOkText:Text("LOCATION", style: TextStyle(color: Colors.white),), - buttonOkColor: Colors.grey, - buttonCancelText:Text('CAll', style: TextStyle(color: Colors.white),) , - buttonCancelColor: Colors.grey, - onOkButtonPressed: () { MapsLauncher.launchCoordinates(double.parse(latitude),double.parse(longitude),projectname);}, - onCancelButtonPressed :() {launch("tel://" +telephone);} - )); - - } - -} - - diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index c208efba..06710183 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,53 +1,68 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + import 'widgets/AppointmentActions.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class AppointmentDetails extends StatefulWidget { AppoitmentAllHistoryResultList appo; static bool isLoading = false; - final dynamic doctorSchedule; + dynamic doctorSchedule; static bool showFooterButton = false; + final int parentIndex; - AppointmentDetails({@required this.appo, this.doctorSchedule}); + AppointmentDetails({@required this.appo, this.parentIndex, this.doctorSchedule}); @override _AppointmentDetailsState createState() => _AppointmentDetailsState(); } -class _AppointmentDetailsState extends State - with SingleTickerProviderStateMixin { +class _AppointmentDetailsState extends State with SingleTickerProviderStateMixin { static TabController _tabController; AppSharedPreferences sharedPref = AppSharedPreferences(); List doctorDetailsList = List(); + ToDoCountProviderModel toDoProvider; + ProjectViewModel projectViewModel; + + DoctorList doctorList = new DoctorList(); + @override void initState() { AppointmentDetails.showFooterButton = false; if (widget.doctorSchedule != null) { - _tabController = - new TabController(length: 2, vsync: this, initialIndex: 1); + _tabController = new TabController(length: 2, vsync: this, initialIndex: 1); widget.appo.appointmentDate = widget.doctorSchedule['Date']; } else { _tabController = new TabController(length: 2, vsync: this); } + doctorList.doctorID = widget.appo.doctorID; + doctorList.clinicID = widget.appo.clinicID; + doctorList.projectID = widget.appo.projectID; setTab(); super.initState(); } @@ -61,233 +76,193 @@ class _AppointmentDetailsState extends State @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); + + toDoProvider = Provider.of(context); + return AppScaffold( appBarTitle: widget.appo.doctorNameObj, isShowAppBar: true, - bottomSheet: AppointmentDetails.showFooterButton - ? Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: goToBookConfirm, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), - ), + showNewAppBar: true, + backgroundColor: Colors.white, + showNewAppBarTitle: true, + bottomSheet: _bottomButtons(), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, + widget.appo.doctorID, + widget.appo.doctorImageURL, + widget.appo.doctorSpeciality, + "", + widget.appo.projectName, + DateUtil.convertStringToDate(widget.appo.appointmentDate), + widget.appo.startTime.substring(0, 5), + null, + widget.appo.doctorRate, + widget.appo.actualDoctorRate, + widget.appo.noOfPatientsRate, + "", + decimalDoctorRate: widget.appo.decimalDoctorRate.toString() + //model.user.emailAddress, ), - ) - : null, - body: Container( - color: new Color(0xFFf6f6f6), - child: SingleChildScrollView( - child: Stack( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 20.0), - alignment: Alignment.center, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appo.doctorImageURL, - fit: BoxFit.fill, height: 120.0, width: 120.0), - ), - ), - Container( - margin: EdgeInsets.only( - top: 10.0, left: 10.0, right: 10.0), - alignment: Alignment.center, - child: Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text( - getDoctorSpeciality(widget.appo.doctorSpeciality), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[900], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: RatingBar.readOnly( - initialRating: - widget.appo.actualDoctorRate.toDouble(), - size: 35.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - InkWell( - onTap: () { - getDoctorRatingsDetails(); - }, - child: Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: Text( - "(" + - widget.appo.noOfPatientsRate.toString() + - " " + - TranslationBase.of(context).reviews + - ")", - style: TextStyle( - fontSize: 14.0, - color: Colors.blue[800], - letterSpacing: 1.0, - decoration: TextDecoration.underline, - )), - ), - ), - Container( - alignment: Alignment.center, - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - widget.appo.appointmentDate), - projectViewModel.isArabic ? "ar" : "en")), - ), - Container( - alignment: Alignment.center, - child: Text(widget.appo.startTime.substring(0, 5)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Divider( - color: Colors.grey[500], - ), - ), - TabBar( - onTap: (index) { - setState(() { - if (index == 1) { - if (widget.appo.clinicID == 17 || - widget.appo.clinicID == 23 || - widget.appo.isExecludeDoctor) { - _tabController.index = - _tabController.previousIndex; - AppointmentDetails.showFooterButton = false; - } else { - AppointmentDetails.showFooterButton = true; - } - } - }); - }, - tabs: [ - Tab( - child: Text( - TranslationBase.of(context).appoActions, - style: TextStyle(color: Colors.black))), - widget.appo.clinicID == 17 || - widget.appo.clinicID == 23 || - widget.appo.isExecludeDoctor - ? Tab( - child: Text( - TranslationBase.of(context) - .availableAppo, - style: TextStyle(color: Colors.grey)), - ) - : Tab( - child: Text( - TranslationBase.of(context) - .availableAppo, - style: TextStyle(color: Colors.black)), - ) - ], - controller: _tabController, - ), - ], - ), - ), - Container( - height: MediaQuery.of(context).size.height * 0.87, - child: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - AppointmentActions( - appo: widget.appo, - tabController: _tabController, - enableFooterButton: enableFooterButton), - DocAvailableAppointments( - doctor: getDoctorObject(), - doctorSchedule: widget.doctorSchedule, - isLiveCareAppointment: - widget.appo.isLiveCareAppointment) - ], - controller: _tabController, - ), + isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, + buttonTitle: TranslationBase.of(context).schedule, + buttonIcon: 'assets/images/new/Boo_ Appointment.svg', + showConfirmMessageDialog: false, + onRatingAndReviewTap: getDoctorRatingsDetails, + onTap: () { + Navigator.push( + context, + FadePage( + page: SchedulePage(doctorList: doctorList, appo: widget.appo), ), + ).then((value) { + setState(() { + if (_tabController.index == 0) { + _tabController.animateTo((_tabController.index + 1) % 2); + this.enableFooterButton(); + } + widget.doctorSchedule = value; + }); + }); + }, + ), + SizedBox(height: 10), + Material( + color: Color(0xffF8F8F8), + child: TabBar( + onTap: (index) { + setState(() { + if (index == 1) { + if (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { + _tabController.index = _tabController.previousIndex; + AppointmentDetails.showFooterButton = false; + } else { + AppointmentDetails.showFooterButton = true; + } + } + }); + }, + tabs: [ + Tab(child: Text(TranslationBase.of(context).appoActions, style: TextStyle(color: Colors.black))), + widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 47 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment + ? Tab( + child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)), + ) + : Tab( + child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.black)), + ) ], + controller: _tabController, ), - _tabController.index == 1 - ? Positioned( - right: 30.0, - //top: 30.0, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow - ), - ]), - height: 50, - width: 50, - margin: EdgeInsets.only(top: 20.0), - alignment: Alignment.center, - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: IconButton( - icon: Image.asset('assets/images/drSchedul.png'), - onPressed: () { - openSchedule(); - }), - ), - )) - : SizedBox(), - ], - ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.87, + color: Color(0xffF8F8F8), + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton, projectViewModel: projectViewModel), + DocAvailableAppointments(doctor: getDoctorObject(), doctorSchedule: widget.doctorSchedule, isLiveCareAppointment: widget.appo.isLiveCareAppointment) + ], + controller: _tabController, + ), + ), + ], ), ), ); } + Widget _bottomButtons() { + if (widget.parentIndex == null) { + return null; + } else { + List list = []; + if (widget.parentIndex == 0 && _tabController.index == 0) { + list.add( + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancelAppointment, + () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).cancelAppoMsg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: cancelAppointment, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + color: CustomColors.accentColor, + textColor: CustomColors.white, + ), + ), + ); + list.add( + SizedBox(width: 8), + ); + list.add( + Expanded( + child: DefaultButton( + TranslationBase.of(context).confirm, + confirmAppointment, + color: Color(0xff359846), + ), + ), + ); + } else if (widget.parentIndex == 1 && _tabController.index == 0) { + list.add( + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancelAppointment, + () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).cancelAppoMsg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: cancelAppointment, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + color: CustomColors.accentColor, + // textColor: Color(0xff000000), + ), + ), + ); + } else if (_tabController.index == 1) { + list.add( + Expanded( + child: DefaultButton( + TranslationBase.of(context).reviewAppointment, + goToBookConfirm, + // DocAvailableAppointments.areSlotsAvailable ? goToBookConfirm : null, + color: Color(0xFFD02127), + disabledColor: Color(0xff28323A).withOpacity(0.3), + ), + ), + ); + } + if (list.isEmpty) { + return null; + } else + return Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: list, + ), + ); + } + } + void enableFooterButton() { setState(() { AppointmentDetails.showFooterButton = true; @@ -295,10 +270,10 @@ class _AppointmentDetailsState extends State } void goToBookConfirm() { - if (DocAvailableAppointments.areSlotsAvailable) + if (DocAvailableAppointments.areAppointmentsAvailable) navigateToBookConfirm(context); else - AppToast.showErrorToast(message: "Please select Time Slot to continue"); + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); } Future navigateToBookConfirm(context) async { @@ -312,7 +287,7 @@ class _AppointmentDetailsState extends State selectedTime: DocAvailableAppointments.selectedTime))); } - getDoctorRatingsDetails() { + void getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getDoctorsRatingDetails(widget.appo.doctorID, context).then((res) { @@ -353,32 +328,16 @@ class _AppointmentDetailsState extends State child: Column( children: [ Container( - alignment: Alignment.center, width: MediaQuery.of(context).size.width, - color: Theme.of(context).primaryColor, margin: EdgeInsets.only(bottom: 5.0), padding: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).doctorRating, - style: TextStyle( - fontSize: 22.0, color: Colors.white))), - Container( - margin: EdgeInsets.only(top: 0.0), - child: Text( - this - .widget - .appo - .actualDoctorRate - .ceilToDouble() - .toString(), - style: TextStyle( - fontSize: 32.0, color: Colors.black))), + child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.black))), + Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, child: RatingBar.readOnly( - initialRating: - this.widget.appo.actualDoctorRate.toDouble(), + initialRating: this.widget.appo.actualDoctorRate.toDouble(), size: 35.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], @@ -390,33 +349,24 @@ class _AppointmentDetailsState extends State ), Container( margin: EdgeInsets.only(top: 10.0), - child: Text( - this.widget.appo.noOfPatientsRate.toString() + - " " + - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 14.0, color: Colors.black))), + child: Text(this.widget.appo.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: Row( children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).excellent, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth( - doctorDetailsList[0].patientNumber), - height: 6.0, - child: Container( - color: Colors.green[700], + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), ), ), ), @@ -428,18 +378,12 @@ class _AppointmentDetailsState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).v_good, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[1].patientNumber), + width: getRatingWidth(doctorDetailsList[1].patientNumber), height: 6.0, child: Container( color: Color(0xffB7B723), @@ -454,18 +398,12 @@ class _AppointmentDetailsState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).good, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[2].patientNumber), + width: getRatingWidth(doctorDetailsList[2].patientNumber), height: 6.0, child: Container( color: Color(0xffEBA727), @@ -480,18 +418,12 @@ class _AppointmentDetailsState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context).average, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[3].patientNumber), + width: getRatingWidth(doctorDetailsList[3].patientNumber), height: 6.0, child: Container( color: Color(0xffEB7227), @@ -506,19 +438,12 @@ class _AppointmentDetailsState extends State children: [ Container( width: 100.0, - margin: EdgeInsets.only( - top: 10.0, left: 15.0, right: 15.0), - child: Text( - TranslationBase.of(context) - .below_average, - style: TextStyle( - fontSize: 13.0, - color: Colors.black))), + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( - width: getRatingWidth( - doctorDetailsList[4].patientNumber), + width: getRatingWidth(doctorDetailsList[4].patientNumber), height: 6.0, child: Container( color: Color(0xffE20C0C), @@ -528,9 +453,7 @@ class _AppointmentDetailsState extends State ], ), ), - Container( - margin: EdgeInsets.only(top: 40.0), - child: Divider()), + Container(margin: EdgeInsets.only(top: 40.0), child: Divider()), Container( margin: EdgeInsets.only(top: 0.0), child: Align( @@ -552,9 +475,7 @@ class _AppointmentDetailsState extends State onPressed: () { Navigator.of(context).pop(); }, - child: Text( - TranslationBase.of(context).cancel, - style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), ), ), ), @@ -582,13 +503,7 @@ class _AppointmentDetailsState extends State String getDate(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(); } String getDoctorSpeciality(List docSpecial) { @@ -620,14 +535,61 @@ class _AppointmentDetailsState extends State context, FadePage( page: SchedulePage( - appo: widget.appo, doctorList: getDoctorObject(), + appo: widget.appo, ))); } setTab() async { var scheduleDoctor = await sharedPref.getObject(DOCTOR_SCHEDULE_DATE_SEL); + if (scheduleDoctor != null) widget.appo.appointmentDate = scheduleDoctor['Date']; + } - widget.appo.appointmentDate = scheduleDoctor['Date']; + confirmAppointment() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + Navigator.of(context).pop(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + cancelAppointment() { + ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(widget.appo, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + getToDoCount(); + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + Navigator.of(context).pop(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getToDoCount() { + toDoProvider.setState(0, true, toDoProvider.notificationsCount); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); + } else {} + }).catchError((err) { + print(err); + }); } } diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 5ed0fef4..b65c5235 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -6,17 +6,22 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCardView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.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 'AppointmentDetails.dart'; + class MyAppointments extends StatefulWidget { List appoList = []; @@ -25,8 +30,7 @@ class MyAppointments extends StatefulWidget { List arrivedAppoList = []; List _patientBookedAppointmentListHospital = List(); - List _patientConfirmedAppointmentListHospital = - List(); + List _patientConfirmedAppointmentListHospital = List(); List _patientArrivedAppointmentListHospital = List(); List _patientBookedAppointmentListClinic = List(); @@ -37,115 +41,86 @@ class MyAppointments extends StatefulWidget { _MyAppointmentsState createState() => _MyAppointmentsState(); } -class _MyAppointmentsState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - +class _MyAppointmentsState extends State with SingleTickerProviderStateMixin { bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); List imagesInfo = List(); FilterType filterType; + int _currentPage = 0; + @override void initState() { - _tabController = new TabController(length: 3, vsync: this); filterType = FilterType.Clinic; WidgetsBinding.instance.addPostFrameCallback((_) { - if (Provider.of(context, listen: false).isLogin) - getPatientAppointmentHistory(); + if (Provider.of(context, listen: false).isLogin) getPatientAppointmentHistory(); }); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png')); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/1.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/1.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/1.png')); super.initState(); } + @override + void dispose() { + super.dispose(); + } + @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).myAppointments, + appBarTitle: TranslationBase.of(context).myAppointmentsList, isShowAppBar: true, imagesInfo: imagesInfo, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: true, + showDropDown: true, + dropdownIndexValue: _currentPage, + dropDownIndexChange: (index) { + setState(() { + _currentPage = index; + }); + }, + dropDownList: [ + TranslationBase.of(context).booked, + TranslationBase.of(context).confirmed, + TranslationBase.of(context).arrived, + ], description: TranslationBase.of(context).infoMyAppointments, body: Container( child: Column(children: [ - TabBar( - tabs: [ - Tab( - child: Text(TranslationBase.of(context).booked, - style: TextStyle(color: Colors.black))), - Tab( - child: Text(TranslationBase.of(context).confirmed, - style: TextStyle(color: Colors.black)), - ), - Tab( - child: Text(TranslationBase.of(context).arrived, - style: TextStyle(color: Colors.black)), - ) - ], - controller: _tabController, - ), - Divider( - color: Colors.grey[600], - thickness: 0.5, - ), Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: filterType, - activeColor: Color(0xffB8382C), - onChanged: (FilterType value) { - setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: filterType, - activeColor: Color(0xffB8382C), - onChanged: (FilterType value) => setFilterType(value), - ), - ), - ), - ) + children: [ + MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, filterType, () { + setFilterType(FilterType.Clinic); + }), + MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, filterType, () { + setFilterType(FilterType.Hospital); + }), ], ), + SizedBox(height: 20), + Padding( + padding: EdgeInsets.only(left: 21, right: 21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + myRadioButton(TranslationBase.of(context).booked, 0), + myRadioButton(TranslationBase.of(context).confirmed, 1), + myRadioButton(TranslationBase.of(context).arrived, 2), + ], + ), + ), isDataLoaded ? Expanded( - child: new TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - getBookedAppointments(), - getConfirmedAppointments(), - getArrivedAppointments() - ], - controller: _tabController, + child: IndexedStack( + index: _currentPage, + children: [getBookedAppointments(), getConfirmedAppointments(), getArrivedAppointments()], ), ) : Container(), @@ -171,7 +146,6 @@ class _MyAppointmentsState extends State widget._patientArrivedAppointmentListClinic.clear(); service.getPatientAppointmentHistory(false, context).then((res) { - print(res['AppoimentAllHistoryResultList'].length); GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { @@ -179,8 +153,7 @@ class _MyAppointmentsState extends State if (res['AppoimentAllHistoryResultList'].length != 0) { // isDataLoaded = true; res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList - .add(new AppoitmentAllHistoryResultList.fromJson(v)); + widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); sortAppointmentList(); } else {} @@ -194,7 +167,6 @@ class _MyAppointmentsState extends State GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - Navigator.of(context).pop(); }); } @@ -226,135 +198,80 @@ class _MyAppointmentsState extends State }); widget.bookedAppoList.forEach((element) { - List doctorByClinic = - widget._patientBookedAppointmentListClinic - .where( - (elementClinic) => - elementClinic.filterName == element.clinicName, - ) - .toList(); + List doctorByClinic = widget._patientBookedAppointmentListClinic + .where( + (elementClinic) => elementClinic.filterName == element.clinicName, + ) + .toList(); if (doctorByClinic.length != 0) { - widget - ._patientBookedAppointmentListClinic[widget - ._patientBookedAppointmentListClinic - .indexOf(doctorByClinic[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientBookedAppointmentListClinic.add(PatientAppointmentList( - filterName: element.clinicName, patientDoctorAppointment: element)); + widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = - widget._patientBookedAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = widget._patientBookedAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { - widget - ._patientBookedAppointmentListHospital[widget - ._patientBookedAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( - filterName: element.projectName, - patientDoctorAppointment: element)); + widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } }); widget.confirmedAppoList.forEach((element) { - List doctorByClinic = - widget._patientConfirmedAppointmentListClinic - .where( - (elementClinic) => - elementClinic.filterName == element.clinicName, - ) - .toList(); + List doctorByClinic = widget._patientConfirmedAppointmentListClinic + .where( + (elementClinic) => elementClinic.filterName == element.clinicName, + ) + .toList(); if (doctorByClinic.length != 0) { - widget - ._patientConfirmedAppointmentListClinic[widget - ._patientConfirmedAppointmentListClinic - .indexOf(doctorByClinic[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientConfirmedAppointmentListClinic.add( - PatientAppointmentList( - filterName: element.clinicName, - patientDoctorAppointment: element)); + widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = - widget._patientConfirmedAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = widget._patientConfirmedAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { - widget - ._patientConfirmedAppointmentListHospital[widget - ._patientConfirmedAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientConfirmedAppointmentListHospital.add( - PatientAppointmentList( - filterName: element.projectName, - patientDoctorAppointment: element)); + widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } }); widget.arrivedAppoList.forEach((element) { - List doctorByClinic = - widget._patientArrivedAppointmentListClinic - .where( - (elementClinic) => - elementClinic.filterName == element.clinicName, - ) - .toList(); + List doctorByClinic = widget._patientArrivedAppointmentListClinic + .where( + (elementClinic) => elementClinic.filterName == element.clinicName, + ) + .toList(); if (doctorByClinic.length != 0) { - widget - ._patientArrivedAppointmentListClinic[widget - ._patientArrivedAppointmentListClinic - .indexOf(doctorByClinic[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList( - filterName: element.clinicName, patientDoctorAppointment: element)); + widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = - widget._patientArrivedAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List doctorByHospital = widget._patientArrivedAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { - widget - ._patientArrivedAppointmentListHospital[widget - ._patientArrivedAppointmentListHospital - .indexOf(doctorByHospital[0])] - .patientDoctorAppointmentList - .add(element); + widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); } else { - widget._patientArrivedAppointmentListHospital.add( - PatientAppointmentList( - filterName: element.projectName, - patientDoctorAppointment: element)); + widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } openAppointmentsTab(); @@ -363,89 +280,51 @@ class _MyAppointmentsState extends State openAppointmentsTab() async { var flag = await this.sharedPref.getInt(IS_SEARCH_APPO); - + int index; if (flag == 1) { - _tabController.index = 0; + index = 0; } else if (flag == 2) { - _tabController.index = 1; + index = 1; } else if (flag == 3) { - _tabController.index = 2; + index = 2; } else { if (widget._patientBookedAppointmentListClinic.length != 0) { - _tabController.index = 0; + index = 0; } else if (widget._patientConfirmedAppointmentListClinic.length != 0) { - _tabController.index = 1; + index = 1; } else if (widget._patientArrivedAppointmentListClinic.length != 0) { - _tabController.index = 2; - return; + index = 2; + // return; } } + + _currentPage = index; } Widget getBookedAppointments() { + return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital); + } + + Widget _getAppointment(int _listLength, List _list) { return Container( child: Container( - child: widget.bookedAppoList.length != 0 - ? SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - filterType == FilterType.Clinic - ? widget._patientBookedAppointmentListClinic.length - : widget._patientBookedAppointmentListHospital.length, - (index) => AppExpandableNotifier( - title: filterType == FilterType.Clinic - ? widget - ._patientBookedAppointmentListClinic[index] - .filterName - : widget - ._patientBookedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: filterType == FilterType.Clinic - ? widget - ._patientBookedAppointmentListClinic[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList() - : widget - ._patientBookedAppointmentListHospital[ - index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - )), - ) - ], - ), - ) + child: _listLength != 0 + ? _appointmentExpandableList(_list) : Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset( - "assets/images/new-design/noAppointmentIcon.png"), + Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noBookedAppo, - style: TextStyle( - fontSize: 16.0, - )), + child: Text( + _currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noConfirmedAppo : TranslationBase.of(context).noArrivedAppo), + style: TextStyle( + fontSize: 16.0, + ), + ), ), ], ), @@ -455,144 +334,72 @@ class _MyAppointmentsState extends State ); } + Widget _appointmentExpandableList(List _patientAppointmentList) { + return ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + List _appointmentAllHistoryResultList = _patientAppointmentList[index].patientDoctorAppointmentList; + return AppExpandableNotifier( + title: _patientAppointmentList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + AppoitmentAllHistoryResultList _appointmentResult = _appointmentAllHistoryResultList[_index]; + bool _isSortByClinic = filterType == FilterType.Clinic; + + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: AppointmentDetails( + appo: _appointmentResult, + parentIndex: _currentPage, + ), + ), + ).then((value) { + getPatientAppointmentHistory(); + }), + isInOutPatient: _appointmentResult.isInOutPatient, + name: _appointmentResult.doctorTitle + " " + _appointmentResult.doctorNameObj, + // billNo: _appointmentResult.invoiceNo, + profileUrl: _appointmentResult.doctorImageURL, + subName: _isSortByClinic ? _appointmentResult.projectName : _appointmentResult.clinicName, + isLiveCareAppointment: _appointmentResult.isLiveCareAppointment, + date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate), + isSortByClinic: _isSortByClinic, + rating: _appointmentResult.actualDoctorRate + 0.0, + appointmentTime: _appointmentResult.startTime.substring(0, 5), + remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) + ? _appointmentResult.remaniningHoursTocanPay + : null + + //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: _appointmentAllHistoryResultList.length), + ); + }, + itemCount: _patientAppointmentList.length, + ); + } + Widget getConfirmedAppointments() { - return widget.confirmedAppoList.length != 0 - ? Container( - margin: EdgeInsets.only(top: 10.0), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - filterType == FilterType.Clinic - ? widget._patientConfirmedAppointmentListClinic.length - : widget - ._patientConfirmedAppointmentListHospital.length, - (index) => AppExpandableNotifier( - title: filterType == FilterType.Clinic - ? widget - ._patientConfirmedAppointmentListClinic[index] - .filterName - : widget - ._patientConfirmedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: filterType == FilterType.Clinic - ? widget - ._patientConfirmedAppointmentListClinic[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList() - : widget - ._patientConfirmedAppointmentListHospital[ - index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - )), - ) - ], - ), - ), - ) - : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset("assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noConfirmedAppo, - style: TextStyle( - fontSize: 16.0, - )), - ), - ], - ), - ), - ); + return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital); } Widget getArrivedAppointments() { - return widget.arrivedAppoList.length != 0 - ? Container( - margin: EdgeInsets.only(top: 10.0), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - filterType == FilterType.Clinic - ? widget._patientArrivedAppointmentListClinic.length - : widget._patientArrivedAppointmentListHospital.length, - (index) => AppExpandableNotifier( - title: filterType == FilterType.Clinic - ? widget._patientArrivedAppointmentListClinic[index] - .filterName - : widget._patientArrivedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: filterType == FilterType.Clinic - ? widget._patientArrivedAppointmentListClinic[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList() - : widget - ._patientArrivedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - ), - ), - ) - ], - ), - ), - ) - : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset("assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noArrivedAppo, - style: TextStyle( - fontSize: 16.0, - )), - ), - ], - ), - ), - ); + return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital); } setFilterType(FilterType filterType) { @@ -600,4 +407,44 @@ class _MyAppointmentsState extends State this.filterType = filterType; }); } + + Widget myRadioButton(String _label, int _value) { + return InkWell( + onTap: () { + setState(() { + _currentPage = _value; + }); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: _value, + activeColor: _value == _currentPage ? Color(0xffD02127) : Color(0xffE8E8E8), + groupValue: _currentPage, + onChanged: (index) { + setState(() { + _currentPage = index; + }); + //_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut); + }, + ), + ), + SizedBox(width: 10), + Text( + _label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + ); + } } diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index 90ac8ae3..92fbeedf 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -1,28 +1,30 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; - import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:provider/provider.dart'; class SchedulePage extends StatefulWidget { - final DoctorList doctorList; - final AppoitmentAllHistoryResultList appo; + DoctorList doctorList; + AppoitmentAllHistoryResultList appo; + SchedulePage({ this.appo, this.doctorList, }); + @override _SchedulePageState createState() => _SchedulePageState(); } @@ -40,6 +42,7 @@ class _SchedulePageState extends State { bool isPageChange = false; AppSharedPreferences sharedPref = AppSharedPreferences(); + @override void initState() { this.doctorList = widget.doctorList; @@ -49,21 +52,30 @@ class _SchedulePageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getDoctorSchedule(doctorList), + allowAny: true, builder: (_, model, widget) => BaseView( onModelReady: (model2) => model2.getFreeSlots(doctorList), + allowAny: true, builder: (_, model2, widget2) { - if (model.freeSlots.length > 0 && isPageChange == false) { - this.freeSlots = model.freeSlots; + if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { + this.freeSlots = model2.freeSlots; this.doctorScheduleResponse = model.getDoctorScheduleList; this.generateWeeksSchedules(); + } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); + Navigator.pop(context); } return AppScaffold( appBarTitle: TranslationBase.of(context).schedule, + showNewAppBar: true, + showNewAppBarTitle: true, isShowAppBar: true, baseViewModel: model2, + isShowDecPage: false, body: SizedBox( height: MediaQuery.of(context).size.height, child: Stack( @@ -83,101 +95,81 @@ class _SchedulePageState extends State { return Container( child: ListView.builder( itemCount: weeks[index].length, - itemBuilder: (context, index2) => - InkWell( - onTap: () { - openBookAppointment( - weeks[index][index2]); - }, - child: Row( - children: [ - Expanded( - flex: 1, - child: Padding( - padding: - EdgeInsets.only( - left: 20), - child: Row( + itemBuilder: (context, index2) => InkWell( + onTap: () { + openBookAppointment(weeks[index][index2]); + }, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), + child: Row(children: [ + Column( + children: [ + Texts( + weeks[index][index2]['DayName'], + fontSize: 13, + fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500, + ), + Texts( + getDayMonths( + DateUtil.convertStringToDate( + weeks[index][index2]['Date'], + ), + ), + fontWeight: FontWeight.bold, + fontSize: 18, + ) + ], + ) + ])), + ), + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20.0)), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 20), + margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), + decoration: BoxDecoration(boxShadow: [ + DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) + ? BoxShadow(color: Colors.green, offset: Offset(projectViewModel.isArabic ? 5 : -5, 0)) + : BoxShadow( + color: Colors.grey[100], + blurRadius: 5, + spreadRadius: 4, + offset: Offset(0, 10), + ), + ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) + ? Texts( + TranslationBase.of(context).today, + color: Colors.green, + fontWeight: FontWeight.w600, + fontSize: 12, + marginTop: 0, + ) + : SizedBox(), + Row( children: [ - Column( - children: [ - Texts( - weeks[index][index2] - [ - 'DayName'], - fontSize: - 13, - ), - Texts( - getDayMonths( - DateUtil - .convertStringToDate( - weeks[index][index2]['Date'], - ), - ), - fontWeight: - FontWeight.bold, - fontSize: - 18, - ) - ], - ) - ])), - ), - Expanded( - flex: 3, - child: ClipRRect( - borderRadius: - const BorderRadius - .all( - Radius.circular( - 20.0)), - child: Container( - padding: - EdgeInsets.only( - left: - 10, - right: - 10, - top: 20, - bottom: - 20), - margin: EdgeInsets.only( - left: 20, - right: 20, - top: 7, - bottom: 7), - decoration: BoxDecoration( - boxShadow: [ - weeks[index][index2]['fullDay'] == - false - ? BoxShadow( - color: Colors.green, - offset: Offset(-5, 0)) - : BoxShadow(), - ], - borderRadius: - const BorderRadius.all(Radius.circular( - 10.0)), - color: Colors - .white), - child: Row( - children: [ - Expanded( - child: - Texts( - weeks[index][index2] - [ - 'WorkingHours'], - fontWeight: - FontWeight.w400, + Expanded( + child: Text( + weeks[index][index2]['WorkingHours'], + style: TextStyle( + fontWeight: FontWeight.w600, ), - ) - ], - ))), - ) - ], - )))); + ), + ), + Icon(Icons.arrow_forward, size: 16.0), + ], + ) + ]))), + ), + ], + )))); }, )), PageViewIndicator( @@ -212,9 +204,7 @@ class _SchedulePageState extends State { var newWeekSchedule = []; for (var workDay in this.doctorScheduleResponse) { Map newWorkDay = Map(); - newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate( - DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + - weekMSOffset); + newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + weekMSOffset); newWorkDay['DayName'] = workDay.dayName; newWorkDay['WorkingHours'] = workDay.workingHours; newWeekSchedule.add(newWorkDay); @@ -237,21 +227,307 @@ class _SchedulePageState extends State { } String getDayMonths(DateTime dateTime) { - String dateFormat = - '${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}'; + String dateFormat = '${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}'; return dateFormat; } openBookAppointment(selectedDate) { //sharedPref.setObject(DOCTOR_SCHEDULE_DATE_SEL, selectedDate); - Navigator.push( - context, - FadePage( - page: AppointmentDetails( - appo: widget.appo, - doctorSchedule: selectedDate, - ), - ), - ); + Navigator.of(context).pop(selectedDate); + // Navigator.push( + // context, + // FadePage( + // page: AppointmentDetails( + // appo: widget.appo, + // doctorSchedule: selectedDate, + // ), + // ), + // ); } } + +// import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +// import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +// +// import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; +// import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart'; +// import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +// import 'package:flutter/material.dart'; +// import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; +// import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +// import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +// import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +// import 'package:provider/provider.dart'; +// import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +// +// class SchedulePage extends StatefulWidget { +// DoctorList doctorList; +// AppoitmentAllHistoryResultList appo; +// SchedulePage({ +// this.appo, +// this.doctorList, +// }); +// @override +// _SchedulePageState createState() => _SchedulePageState(); +// } +// +// class _SchedulePageState extends State { +// DoctorsListService service; +// PageController _pageController = PageController(); +// double currentPage = 0; +// int selectedindex = 0; +// List weeks = []; +// List doctorScheduleResponse = []; +// int weekMS = 604800 * 1000; +// DoctorList doctorList; +// List freeSlots = []; +// bool isPageChange = false; +// +// AppSharedPreferences sharedPref = AppSharedPreferences(); +// @override +// void initState() { +// this.doctorList = widget.doctorList; +// +// super.initState(); +// } +// +// @override +// Widget build(BuildContext context) { +// ProjectViewModel projectViewModel = Provider.of(context); +// return BaseView( +// onModelReady: (model) => model.getDoctorSchedule(doctorList), +// allowAny: true, +// builder: (_, model, widget) => BaseView( +// onModelReady: (model2) => model2.getFreeSlots(doctorList), +// allowAny: true, +// builder: (_, model2, widget2) { +// if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { +// this.freeSlots = model2.freeSlots; +// this.doctorScheduleResponse = model.getDoctorScheduleList; +// +// this.generateWeeksSchedules(); +// } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { +// AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); +// Navigator.pop(context); +// } +// return AppScaffold( +// appBarTitle: TranslationBase.of(context).schedule, +// showNewAppBar: true, +// showNewAppBarTitle: true, +// isShowAppBar: true, +// backgroundColor: Color(0xffF7F7F7), +// baseViewModel: model2, +// isShowDecPage: false, +// body: Column( +// children: [ +// SizedBox(height: 21), +// PageViewIndicator( +// isActive: true, +// currentPage: this.currentPage, +// length: weeks.length, +// ), +// Expanded( +// child: PageView.builder( +// controller: _pageController, +// itemCount: weeks.length, +// onPageChanged: (index) { +// setState(() { +// isPageChange = true; +// this.currentPage = index.toDouble(); +// }); +// }, +// itemBuilder: (context, index) { +// return ListView.separated( +// itemCount: weeks[index].length, +// padding: EdgeInsets.all(21), +// separatorBuilder: (context, index) => SizedBox(height: 12), +// itemBuilder: (context, index2) { +// bool isToday = DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10); +// Color toDayColor = isToday ? Color(0xff359846) : Colors.white; +// return InkWell( +// onTap: () { +// openBookAppointment(weeks[index][index2]); +// }, +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Expanded( +// flex: 1, +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text( +// weeks[index][index2]['DayName'], +// style: TextStyle( +// fontSize: 13, +// fontWeight: FontWeight.w600, +// color: Color(0xff2E303A), +// letterSpacing: -0.52, +// ), +// ), +// Text( +// getDayMonths(DateUtil.convertStringToDate(weeks[index][index2]['Date'])), +// style: TextStyle( +// fontSize: 18, +// fontWeight: FontWeight.w700, +// color: Color(0xff2E303A), +// letterSpacing: -0.72, +// ), +// ), +// ], +// ), +// ), +// Expanded( +// flex: 3, +// child: Container( +// decoration: BoxDecoration( +// color: toDayColor, +// borderRadius: BorderRadius.all( +// Radius.circular(10.0), +// ), +// boxShadow: [ +// BoxShadow( +// color: Color(0xff000000).withOpacity(.05), +// blurRadius: 27, +// offset: Offset(0, -3), +// ), +// ], +// ), +// child: Container( +// margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), +// padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), +// decoration: BoxDecoration( +// color: Colors.white, +// border: Border.all(color: Colors.white, width: 1), +// borderRadius: BorderRadius.only( +// bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), +// topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), +// bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), +// topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), +// ), +// ), +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Expanded( +// child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ +// if (isToday) +// Text( +// TranslationBase.of(context).today, +// style: TextStyle( +// fontSize: 12, +// fontWeight: FontWeight.w600, +// color: toDayColor, +// letterSpacing: -0.48, +// ), +// ), +// Row( +// children: [ +// Expanded( +// child: Text( +// weeks[index][index2]['WorkingHours'], +// style: TextStyle( +// fontSize: 13, +// fontWeight: FontWeight.w600, +// color: Color(0xff2E303A), +// letterSpacing: -0.56, +// ), +// ), +// ), +// ], +// ) +// ]), +// ), +// Icon(Icons.arrow_forward, color: Color(0xff2B353E)), +// ], +// ), +// ), +// ), +// ), +// ], +// ), +// ); +// }); +// }, +// ), +// ), +// ], +// ), +// ); +// }), +// ); +// } +// +// generateWeeksSchedules() { +// this.weeks.clear(); +// for (var i = 0; i < 8; i++) { +// var weekSchedule = generateNewWeekSchedule(i); +// this.markWeekFreeDays(weekSchedule); +// this.weeks.add(weekSchedule); +// } +// //print(this.weeks); +// } +// +// markWeekFreeDays(schedule) { +// for (var workDay in schedule) { +// workDay['fullDay'] = !this.hasFreeSlot(workDay['Date']); +// } +// } +// +// generateNewWeekSchedule(weekIndex) { +// var weekMSOffset = weekIndex * weekMS; +// +// var newWeekSchedule = []; +// for (var workDay in this.doctorScheduleResponse) { +// Map newWorkDay = Map(); +// newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + weekMSOffset); +// newWorkDay['DayName'] = workDay.dayName; +// newWorkDay['WorkingHours'] = workDay.workingHours; +// newWeekSchedule.add(newWorkDay); +// } +// return newWeekSchedule; +// } +// +// hasFreeSlot(String jsonDate) { +// var date = DateUtil.convertStringToDate(jsonDate); +// var scheduleDay = date; +// for (var event in this.freeSlots) { +// var date = DateUtil.convertStringToDate(event); +// var nDate = DateTime(date.year, date.month, date.day); +// +// if (nDate.millisecondsSinceEpoch == scheduleDay.millisecondsSinceEpoch) { +// return true; +// } +// } +// return false; +// } +// +// String getDayMonths(DateTime dateTime) { +// String dateFormat = '${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}'; +// return dateFormat; +// } +// +// openBookAppointment(selectedDate) { +// //sharedPref.setObject(DOCTOR_SCHEDULE_DATE_SEL, selectedDate); +// Navigator.of(context).pop(selectedDate); +// // Navigator.push( +// // context, +// // FadePage( +// // page: AppointmentDetails( +// // appo: widget.appo, +// // doctorSchedule: selectedDate, +// // ), +// // ), +// // ); +// } +// } diff --git a/lib/pages/MyAppointments/VisitTicket.dart b/lib/pages/MyAppointments/VisitTicket.dart index 6f1dbdf8..c2f5c6ed 100644 --- a/lib/pages/MyAppointments/VisitTicket.dart +++ b/lib/pages/MyAppointments/VisitTicket.dart @@ -52,7 +52,6 @@ class _VisitTicketState extends State { GifLoaderDialogUtils.showMyDialog(context); service.getPatientAppointmentHistory(true, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res['AppoimentAllHistoryResultList']); if (res['MessageStatus'] == 1) { setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index dc3ff3f9..5cac41dd 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -6,50 +6,50 @@ class ArrivedButtons { { "title": TranslationBase.of(AppGlobal.context).medicines, "subtitle": TranslationBase.of(AppGlobal.context).medicinesSubtitle, - "icon": "assets/images/new-design/medicine_prescriptions_icon.png", - "caller": "prescriptions" + "icon": "medicine_prescription.svg", + "caller": "prescriptions", }, { "title": TranslationBase.of(AppGlobal.context).radiology, "subtitle": TranslationBase.of(AppGlobal.context).radiologySubtitle, - "icon": "assets/images/new-design/radiology_service_icon.png", - "caller": "radiology" + "icon": 'radiology.svg', + "caller": "radiology", }, { "title": TranslationBase.of(AppGlobal.context).lab, "subtitle": TranslationBase.of(AppGlobal.context).labSubtitle, - "icon": "assets/images/new-design/lab_result_icon.png", - "caller": "labResult" + "icon": 'lab_result.svg', + "caller": "labResult", }, { "title": TranslationBase.of(AppGlobal.context).vitalSigns, "subtitle": TranslationBase.of(AppGlobal.context).vitalSignsSubtitle, - "icon": "assets/images/new-design/vital_signs.png", - "caller": "VitalSigns" + "icon": 'vital_signs.svg', + "caller": "VitalSigns", }, { "title": TranslationBase.of(AppGlobal.context).raise, "subtitle": TranslationBase.of(AppGlobal.context).complaint, - "icon": "assets/images/new-design/feedback_icon.png", - "caller": "insertComplaint" + "icon": "raise_comp.svg", + "caller": "insertComplaint", }, { "title": TranslationBase.of(AppGlobal.context).insuranceApproval, - "subtitle": TranslationBase.of(AppGlobal.context).insuranceSubtitle, - "icon": "assets/images/new-design/insurance_approvals_icon.png", - "caller": "Insurance" + "subtitle": TranslationBase.of(AppGlobal.context).insuranceApprovalSubtitle, + "icon": 'insurance_approval.svg', + "caller": "Insurance", }, { "title": TranslationBase.of(AppGlobal.context).askDoctor, - "subtitle": TranslationBase.of(AppGlobal.context).askYourSubtitle, - "icon": "assets/images/new-design/ask_doctor_icon.png", - "caller": "askDoc" + "subtitle": TranslationBase.of(AppGlobal.context).service, + "icon": 'ask_doctor.svg', + "caller": "askDoc", }, { - "title": TranslationBase.of(AppGlobal.context).appoSurvey, - "subtitle": TranslationBase.of(AppGlobal.context).service, - "icon": "assets/images/new-design/survey.png", - "caller": "Survey" + "title": TranslationBase.of(AppGlobal.context).service, + "subtitle": TranslationBase.of(AppGlobal.context).appoSurvey, + "icon": "survey.svg", + "caller": "Survey", } ]; -} \ No newline at end of file +} diff --git a/lib/pages/MyAppointments/models/BookedButtons.dart b/lib/pages/MyAppointments/models/BookedButtons.dart index 709b3b1f..bec7f39c 100644 --- a/lib/pages/MyAppointments/models/BookedButtons.dart +++ b/lib/pages/MyAppointments/models/BookedButtons.dart @@ -3,41 +3,41 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class BookedButtons { var buttons = [ - { - "title": TranslationBase.of(AppGlobal.context).confirm, - "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/confirm_icon.png", - "caller": "confirmAppointment" - }, + // { + // "title": TranslationBase.of(AppGlobal.context).confirm, + // "subtitle": TranslationBase.of(AppGlobal.context).appointment, + // "icon": "assets/images/new-design/confirm_icon.png", + // "caller": "confirmAppointment", + // }, { "title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/reschedule_icon.png", - "caller": "openReschedule" - }, - { - "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, - "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/cancel_icon.png", - "caller": "onCancelAppointment" + "icon": "reschedule.svg", + "caller": "openReschedule", }, + // { + // "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + // "subtitle": TranslationBase.of(AppGlobal.context).appointment, + // "icon": "assets/images/new-design/cancel_icon.png", + // "caller": "onCancelAppointment", + // }, { "title": TranslationBase.of(AppGlobal.context).raise, "subtitle": TranslationBase.of(AppGlobal.context).complaint, - "icon": "assets/images/new-design/Complaint_icon.png", - "caller": "insertComplaint" + "icon": "raise_comp.svg", + "caller": "insertComplaint", }, { "title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, - "icon": "assets/images/new-design/reminder_icon.png", - "caller": "addReminder" + "icon": "add_reminder.svg", + "caller": "addReminder", }, { "title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, - "icon": "assets/images/new-design/location_icon.png", - "caller": "navigateToProject" + "icon": "hosp_location.svg", + "caller": "navigateToProject", } ]; } diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart index 9548b7c8..1062eaf3 100644 --- a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -7,43 +7,43 @@ class BookedButtonsAllowCheckIn { "title": TranslationBase.of(AppGlobal.context).confirm, "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "assets/images/new-design/confirm_icon.png", - "caller": "confirmAppointment" + "caller": "confirmAppointment", }, { "title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/reschedule_icon.png", - "caller": "openReschedule" + "icon": "reschedule.svg", + "caller": "openReschedule", }, { "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "assets/images/new-design/cancel_icon.png", - "caller": "onCancelAppointment" + "caller": "onCancelAppointment", }, { "title": TranslationBase.of(AppGlobal.context).raise, "subtitle": TranslationBase.of(AppGlobal.context).complaint, - "icon": "assets/images/new-design/Complaint_icon.png", - "caller": "insertComplaint" + "icon": "raise_comp.svg", + "caller": "insertComplaint", }, { "title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, "icon": "assets/images/new-design/reminder_icon.png", - "caller": "addReminder" + "caller": "addReminder", }, { "title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, "icon": "assets/images/new-design/location_icon.png", - "caller": "navigateToProject" + "caller": "navigateToProject", }, { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList" + "caller": "goToTodoList", } ]; } diff --git a/lib/pages/MyAppointments/models/ConfirmedButtons.dart b/lib/pages/MyAppointments/models/ConfirmedButtons.dart index b02021c7..7ba3ce1c 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtons.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtons.dart @@ -3,47 +3,22 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class ConfirmedButtons { var buttons = [ - { - "title": TranslationBase.of(AppGlobal.context).reschedule, - "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/reschedule_icon.png", - "caller": "openReschedule" - }, - { - "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, - "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/cancel_icon.png", - "caller": "onCancelAppointment" - }, - { - "title": TranslationBase.of(AppGlobal.context).raise, - "subtitle": TranslationBase.of(AppGlobal.context).complaint, - "icon": "assets/images/new-design/Complaint_icon.png", - "caller": "insertComplaint" - }, - { - "title": TranslationBase.of(AppGlobal.context).add, - "subtitle": TranslationBase.of(AppGlobal.context).reminder, - "icon": "assets/images/new-design/reminder_icon.png", - "caller": "addReminder" - }, - { - "title": TranslationBase.of(AppGlobal.context).hospital, - "subtitle": TranslationBase.of(AppGlobal.context).location, - "icon": "assets/images/new-design/location_icon.png", - "caller": "navigateToProject" - }, + {"title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, "icon": "reschedule.svg", "caller": "openReschedule"}, + // { + // "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + // "subtitle": TranslationBase.of(AppGlobal.context).appointment, + // "icon": "assets/images/new-design/cancel_icon.png", + // "caller": "onCancelAppointment" + // }, + {"title": TranslationBase.of(AppGlobal.context).raise, "subtitle": TranslationBase.of(AppGlobal.context).complaint, "icon": "raise_comp.svg", "caller": "insertComplaint"}, + {"title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, "icon": "add_reminder.svg", "caller": "addReminder"}, + {"title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, "icon": "hosp_location.svg", "caller": "navigateToProject"}, // { // "title": "Generate", // "subtitle": "Visit Ticket", // "icon": "assets/images/new-design/generate_visit_ticket.png", // "caller": "visitTicket" // }, - { - "title": TranslationBase.of(AppGlobal.context).online, - "subtitle": TranslationBase.of(AppGlobal.context).payment, - "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList" - } + {"title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, "icon": "online_payment.svg", "caller": "goToTodoList"} ]; } diff --git a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart index 07ba333e..1f9f2d8a 100644 --- a/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart @@ -6,38 +6,38 @@ class ConfirmedButtonsAllowCheckIn { { "title": TranslationBase.of(AppGlobal.context).reschedule, "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/reschedule_icon.png", - "caller": "openReschedule" - }, - { - "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, - "subtitle": TranslationBase.of(AppGlobal.context).appointment, - "icon": "assets/images/new-design/cancel_icon.png", - "caller": "onCancelAppointment" + "icon": "reschedule.svg", + "caller": "openReschedule", }, + // { + // "title": TranslationBase.of(AppGlobal.context).cancel_nocaps, + // "subtitle": TranslationBase.of(AppGlobal.context).appointment, + // "icon": "assets/images/new-design/cancel_icon.png", + // "caller": "onCancelAppointment", + // }, { "title": TranslationBase.of(AppGlobal.context).raise, "subtitle": TranslationBase.of(AppGlobal.context).complaint, - "icon": "assets/images/new-design/Complaint_icon.png", - "caller": "insertComplaint" + "icon": "raise_comp.svg", + "caller": "insertComplaint", }, { "title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, "icon": "assets/images/new-design/reminder_icon.png", - "caller": "addReminder" + "caller": "addReminder", }, { "title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, - "icon": "assets/images/new-design/location_icon.png", - "caller": "navigateToProject" + "icon": "hosp_location.svg", + "caller": "navigateToProject", }, { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, - "icon": "assets/images/new-design/check-in.png", - "caller": "goToTodoList" + "icon": "online_payment.svg", + "caller": "goToTodoList", } ]; } diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index ff133d80..acfe444f 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,12 +1,11 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; -import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; @@ -14,21 +13,19 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.d import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/PrescriptionReport.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -40,11 +37,9 @@ class AppointmentActions extends StatefulWidget { TabController tabController; final Function enableFooterButton; MyInAppBrowser browser; + final ProjectViewModel projectViewModel; - AppointmentActions( - {@required this.appo, - @required this.tabController, - @required this.enableFooterButton}); + AppointmentActions({@required this.appo, @required this.tabController, @required this.enableFooterButton, this.projectViewModel}); @override _AppointmentActionsState createState() => _AppointmentActionsState(); @@ -53,8 +48,6 @@ class AppointmentActions extends StatefulWidget { class _AppointmentActionsState extends State { List appoButtonsList = []; - ToDoCountProviderModel toDoProvider; - @override void initState() { _getAppointmentActionButtons(); @@ -64,155 +57,79 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - toDoProvider = Provider.of(context); var size = MediaQuery.of(context).size; - final double itemHeight = projectViewModel.isArabic - ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 - : ((size.height - kToolbarHeight - 24) * 0.45) / 2; + final double itemHeight = projectViewModel.isArabic ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; - return Container( - margin: EdgeInsets.all(5.0), - child: CustomScrollView( - primary: false, - physics: NeverScrollableScrollPhysics(), - slivers: [ - SliverPadding( - padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), - sliver: SliverGrid.count( - crossAxisCount: 2, - childAspectRatio: (itemWidth / itemHeight), - children: appoButtonsList - .map((e) => GestureDetector( - onTap: () { - _handleButtonClicks(e); - }, - child: Container( - margin: EdgeInsets.all(8.0), - padding: EdgeInsets.only(bottom: 4.0), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey[400], - blurRadius: 2.0, - spreadRadius: 0.0) - ], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: - EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 5.0), - child: Texts( - e.title, - color: Color(0xffB8382C), - variant: "overline", - fontSize: SizeConfig.textMultiplier * 1.8, - ), - ), - Container( - margin: - EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Texts( - e.subtitle, - color: Colors.black, - variant: "overline", - fontSize: SizeConfig.textMultiplier * 1.6, - ), - ), - ], - ), - ), - Container( - alignment: projectViewModel.isArabic - ? Alignment.bottomLeft - : Alignment.bottomRight, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB( - 10.0, 7.0, 0.0, 8.0) - : EdgeInsets.fromLTRB( - 0.0, 7.0, 10.0, 8.0), - child: Image.asset(e.icon, - width: 40.0, height: 40.0), - ), - ], - ), - ), - )) - .toList(), - ), + return GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(21), + shrinkWrap: true, + itemBuilder: (context, index) { + bool shouldEnable = (widget.appo.clinicID == 17 && widget.appo.clinicID == 47 && appoButtonsList[index].caller == "openReschedule"); + return InkWell( + onTap: shouldEnable + ? null + : () { + _handleButtonClicks(appoButtonsList[index]); + }, + child: MedicalProfileItem( + title: appoButtonsList[index].title, + imagePath: appoButtonsList[index].icon, + subTitle: appoButtonsList[index].subtitle, + hasBadge: true, + isEnable: !shouldEnable, + imgColor: Color(0xff28323A), ), - ], - ), + ); + }, + itemCount: appoButtonsList.length, ); } _handleButtonClicks(AppoDetailsButton) { - print(AppoDetailsButton.caller); - switch (AppoDetailsButton.caller) { case "openReschedule": widget.tabController.animateTo((widget.tabController.index + 1) % 2); setState(() { - print("Reschedule"); widget.enableFooterButton(); }); break; - - case "onCancelAppointment": - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).cancelAppoMsg, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {cancelAppointment()}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - break; - - case "confirmAppointment": - confirmAppointment(); - break; - case "navigateToProject": - openMap(double.parse(widget.appo.latitude), - double.parse(widget.appo.longitude)); + openMap(double.parse(widget.appo.latitude), double.parse(widget.appo.longitude)); break; - case "addReminder": - showReminderDialog(widget.appo); + showReminderDialog( + context, + DateUtil.convertStringToDate(widget.appo.appointmentDate), + widget.appo.doctorNameObj, + "", + DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate), widget.projectViewModel.isArabic), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.appo.appointmentDate)), + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + ); break; - case "goToTodoList": Navigator.of(context).pop(); break; - case "askDoc": askYourDoc(); break; - case "radiology": openAppointmentRadiology(); break; - case "labResult": openAppointmentLabResults(); break; - case "prescriptions": openPrescriptionReport(); break; - case "Survey": rateAppointment(); break; - case "Insurance": navigateToInsuranceApprovals(widget.appo.appointmentNo); break; @@ -297,8 +214,7 @@ class _AppointmentActionsState extends State { Future> _getBookedCheckInAppoActionsList() async { print("_getBookedCheckInAppoActionsList"); - BookedButtonsAllowCheckIn bookedButtonsAllowCheckIn = - new BookedButtonsAllowCheckIn(); + BookedButtonsAllowCheckIn bookedButtonsAllowCheckIn = new BookedButtonsAllowCheckIn(); print(bookedButtonsAllowCheckIn.buttons); List buttonsList = []; for (var i = 0; i < bookedButtonsAllowCheckIn.buttons.length; i++) { @@ -334,8 +250,7 @@ class _AppointmentActionsState extends State { Future> _getConfirmedCheckInAppoActionsList() async { print("_getConfirmedAllowCheckInAppoActionsList"); - ConfirmedButtonsAllowCheckIn confirmedButtonsAllowCheckIn = - new ConfirmedButtonsAllowCheckIn(); + ConfirmedButtonsAllowCheckIn confirmedButtonsAllowCheckIn = new ConfirmedButtonsAllowCheckIn(); print(confirmedButtonsAllowCheckIn.buttons); List buttonsList = []; for (var i = 0; i < confirmedButtonsAllowCheckIn.buttons.length; i++) { @@ -386,56 +301,61 @@ class _AppointmentActionsState extends State { }); } - cancelAppointment() { - ConfirmDialog.closeAlertDialog(context); - GifLoaderDialogUtils.showMyDialog(context); - DoctorsListService service = new DoctorsListService(); - service.cancelAppointment(widget.appo, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - print(res); - if (res['MessageStatus'] == 1) { - getToDoCount(); - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - Navigator.of(context).pop(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - print(err); - }); - } - - getToDoCount() { - toDoProvider.setState(0, true); - ClinicListService service = new ClinicListService(); - service.getActiveAppointmentNo(context).then((res) { - print(res['AppointmentActiveNumber']); - if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true); - } else {} - }).catchError((err) { - print(err); - }); - } + // cancelAppointment() { + // ConfirmDialog.closeAlertDialog(context); + // GifLoaderDialogUtils.showMyDialog(context); + // DoctorsListService service = new DoctorsListService(); + // service.cancelAppointment(widget.appo, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // print(res); + // if (res['MessageStatus'] == 1) { + // getToDoCount(); + // AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + // Navigator.of(context).pop(); + // } else { + // AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + // } + // }).catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + // print(err); + // }); + // } + + // getToDoCount() { + // toDoProvider.setState(0, true); + // ClinicListService service = new ClinicListService(); + // service.getActiveAppointmentNo(context).then((res) { + // print(res['AppointmentActiveNumber']); + // if (res['MessageStatus'] == 1) { + // toDoProvider.setState(res['AppointmentActiveNumber'], true); + // } else {} + // }).catchError((err) { + // print(err); + // }); + // } openAppointmentLabResults() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); PatientLabOrders patientLabOrders = new PatientLabOrders(); - service - .getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, - widget.appo.projectID, widget.appo.clinicID, context) - .then((res) { + service.getPatientLabOrdersByAppoNo(widget.appo.appointmentNo, widget.appo.projectID, widget.appo.clinicID, context).then((res) { print(res['ListLabResultsByAppNo']); GifLoaderDialogUtils.hideDialog(context); if (res['ListLabResultsByAppNo'] != null) { - patientLabOrders.orderNo = - res['ListLabResultsByAppNo'][0]['OrderNo'].toString(); - patientLabOrders.invoiceNo = - res['ListLabResultsByAppNo'][0]['InvoiceNo'].toString(); + patientLabOrders.orderNo = res['ListLabResultsByAppNo'][0]['OrderNo'].toString(); + patientLabOrders.invoiceNo = res['ListLabResultsByAppNo'][0]['InvoiceNo'].toString(); patientLabOrders.clinicID = widget.appo.clinicID; + patientLabOrders.clinicDescription = widget.appo.clinicName; patientLabOrders.projectID = widget.appo.projectID.toString(); + patientLabOrders.doctorName = widget.appo.doctorNameObj; + patientLabOrders.doctorImageURL = widget.appo.doctorImageURL; + patientLabOrders.speciality = widget.appo.doctorSpeciality; + patientLabOrders.projectName = widget.appo.projectName; + patientLabOrders.orderDate = DateUtil.convertStringToDate(widget.appo.appointmentDate); + patientLabOrders.doctorRate = widget.appo.doctorRate; + patientLabOrders.actualDoctorRate = widget.appo.actualDoctorRate; + patientLabOrders.noOfPatientsRate = widget.appo.noOfPatientsRate; + print(patientLabOrders.invoiceNo); print(patientLabOrders.orderNo); navigateToLabResults(patientLabOrders); @@ -453,80 +373,60 @@ class _AppointmentActionsState extends State { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); FinalRadiology finalRadiology = new FinalRadiology(); - service - .getPatientRadOrders(widget.appo.appointmentNo.toString(), context) - .then((res) { + service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['FinalRadiologyList'] != null) { print(res['FinalRadiologyList']); - finalRadiology = - new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); + finalRadiology = new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); print(finalRadiology.reportData); navigateToRadiologyDetails(finalRadiology); } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound); }); } openPrescriptionReport() { - GifLoaderDialogUtils.showMyDialog(context); - List prescriptionReportEnhList = List(); - DoctorsListService service = new DoctorsListService(); - service.getPatientPrescriptionReports(widget.appo, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['ListPRM'].length != 0) { - res['ListPRM'].forEach((report) { - prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); - }); - print(prescriptionReportEnhList.length); - navigateToMedicinePrescriptionReport( - prescriptionReportEnhList, res['ListPRM']); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).noRecords); - } - }).catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - }); + Prescriptions prescriptions = new Prescriptions(); + + prescriptions.doctorName = widget.appo.doctorNameObj; + prescriptions.appointmentNo = widget.appo.appointmentNo; + prescriptions.clinicID = widget.appo.clinicID; + prescriptions.projectID = widget.appo.projectID; + prescriptions.doctorImageURL = widget.appo.doctorImageURL; + prescriptions.speciality = widget.appo.doctorSpeciality; + prescriptions.name = widget.appo.projectName; + prescriptions.episodeID = widget.appo.episodeID; + prescriptions.setupID = widget.appo.setupID; + prescriptions.appointmentDate = widget.appo.appointmentDate; + prescriptions.nationalityFlagURL = "https://hmgwebservices.com/Images/flag/SAU.png"; + prescriptions.doctorRate = widget.appo.doctorRate; + prescriptions.actualDoctorRate = widget.appo.actualDoctorRate; + prescriptions.noOfPatientsRate = widget.appo.noOfPatientsRate; + prescriptions.isInOutPatient = widget.appo.isInOutPatient; + prescriptions.doctorID = widget.appo.doctorID; + + navigateToMedicinePrescriptionReport(prescriptions); } - Future navigateToMedicinePrescriptionReport( - List prescriptionReportEnhList, - dynamic listPres) async { - Navigator.push( - context, - FadePage( - page: PrescriptionReportPage( - prescriptionReportEnhList: prescriptionReportEnhList, - listPres: listPres, - appo: widget.appo))); + Future navigateToMedicinePrescriptionReport(Prescriptions prescriptions) async { + Navigator.push(context, FadePage(page: PrescriptionItemsPage(prescriptions: prescriptions))); } Future navigateToLabResults(PatientLabOrders patientLabOrders) async { - Navigator.push( - context, - FadePage( - page: LaboratoryResultPage(patientLabOrders: patientLabOrders))) - .then((value) {}); + Navigator.push(context, FadePage(page: LaboratoryResultPage(patientLabOrders: patientLabOrders))).then((value) {}); } Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async { - Navigator.push( - context, - FadePage( - page: RadiologyDetailsPage(finalRadiology: finalRadiology))) - .then((value) {}); + Navigator.push(context, FadePage(page: RadiologyDetailsPage(finalRadiology: finalRadiology))).then((value) {}); } static Future openMap(double latitude, double longitude) async { - String googleUrl = - 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'; + String googleUrl = 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'; if (await canLaunch(googleUrl)) { await launch(googleUrl); } else { @@ -534,36 +434,6 @@ class _AppointmentActionsState extends State { } } - showReminderDialog(AppoitmentAllHistoryResultList appo) { - 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: ReminderDialog( - eventId: appo.appointmentNo.toString(), - title: "Doctor Appointment", - description: "You have an appointment with " + - appo.doctorTitle + - " " + - appo.doctorNameObj, - startDate: appo.appointmentDate, - endDate: appo.appointmentDate, - location: appo.projectName, - ), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); - } - askYourDoc() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); @@ -573,8 +443,7 @@ class _AppointmentActionsState extends State { if (res['PatientDoctorAppointmentResultList'].length != 0) { getCallRequestType(); } else { - AppToast.showErrorToast( - message: TranslationBase.of(context).askDocNotAllowed); + AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -605,11 +474,9 @@ class _AppointmentActionsState extends State { showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { - final curvedValue = - Curves.easeInOutBack.transform(a1.value) - 1.0; + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; return Transform( - transform: - Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), child: Opacity( opacity: a1.value, child: AskDocDialog(requestData: requestData), @@ -633,9 +500,7 @@ class _AppointmentActionsState extends State { sendAskDocRequest(int requestType) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .sendAskDocCallRequest(widget.appo, requestType.toString(), context) - .then((res) { + service.sendAskDocCallRequest(widget.appo, requestType.toString(), context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Request Sent Successfully"); @@ -649,29 +514,25 @@ class _AppointmentActionsState extends State { }); } - confirmAppointment() { - GifLoaderDialogUtils.showMyDialog(context); - DoctorsListService service = new DoctorsListService(); - service - .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, - widget.appo.projectID, widget.appo.isLiveCareAppointment, context) - .then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - Navigator.of(context).pop(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - print(err); - }); - } + // confirmAppointment() { + // GifLoaderDialogUtils.showMyDialog(context); + // DoctorsListService service = new DoctorsListService(); + // service.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // if (res['MessageStatus'] == 1) { + // AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + // Navigator.of(context).pop(); + // } else { + // AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + // } + // }).catchError((err) { + // GifLoaderDialogUtils.hideDialog(context); + // print(err); + // }); + // } navigateToInsuranceApprovals(int appoNo) { - Navigator.push( - context, FadePage(page: InsuranceApproval(appointmentNo: appoNo))); + Navigator.push(context, FadePage(page: InsuranceApproval(appointmentNo: appoNo))); } navigateToVitalSigns(int appoNo, int projectID) { @@ -686,15 +547,19 @@ class _AppointmentActionsState extends State { } navigateToInsertComplaint() { - Navigator.push(context, FadePage(page: FeedbackHomePage(messageType: MessageType.ComplaintOnAnAppointment,appointment: widget.appo,))); + Navigator.push( + context, + FadePage( + page: FeedbackHomePage( + messageType: MessageType.ComplaintOnAnAppointment, + appointment: widget.appo, + ))); } rateAppointment() { widget.browser = new MyInAppBrowser(); - widget.browser.openBrowser('http://hmg.com/SitePages/pso.aspx?p=' + - widget.appo.projectID.toString() + - '.' + - widget.appo.appointmentNo.toString() + - '&c=1'); + var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; + print(url); + launch(url); } } diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart index 213e28e1..33c55ddd 100644 --- a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -28,7 +28,6 @@ class PrescriptionReportPage extends StatefulWidget { class _PrescriptionReportState extends State { @override void initState() { - print(widget.prescriptionReportEnhList.length); super.initState(); } @@ -75,7 +74,7 @@ class _PrescriptionReportState extends State { .prescriptionReportEnhList[index].itemDescription)), )), Icon( - Icons.arrow_forward_ios, + Icons.arrow_forward, size: 18, color: Colors.grey[500], ) diff --git a/lib/pages/MyAppointments/widgets/askDocDialog.dart b/lib/pages/MyAppointments/widgets/askDocDialog.dart index 15af9ae7..1098a389 100644 --- a/lib/pages/MyAppointments/widgets/askDocDialog.dart +++ b/lib/pages/MyAppointments/widgets/askDocDialog.dart @@ -52,6 +52,7 @@ class _AskDocDialogState extends State { borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), color: Colors.blue, + elevation: 0, onPressed: () { if(AskDocDialog.selectedParameterCode != 0) Navigator.pop(context, AskDocDialog.selectedParameterCode); diff --git a/lib/pages/MyAppointments/widgets/custom_radio.dart b/lib/pages/MyAppointments/widgets/custom_radio.dart index b3c16afb..f027a1c7 100644 --- a/lib/pages/MyAppointments/widgets/custom_radio.dart +++ b/lib/pages/MyAppointments/widgets/custom_radio.dart @@ -54,7 +54,6 @@ class CustomRadioState extends State { sampleData[index].isSelected = true; if (widget.requestData != null) { AskDocDialog.selectedParameterCode = sampleData[index].duration; - print(AskDocDialog.selectedParameterCode); } else { ReminderDialog.selectedDuration = sampleData[index].duration * 60000; PrescriptionReminderDialog.selectedDuration = sampleData[index].duration * 60000; diff --git a/lib/pages/MyAppointments/widgets/indicator.dart b/lib/pages/MyAppointments/widgets/indicator.dart index 5976042f..e652e360 100644 --- a/lib/pages/MyAppointments/widgets/indicator.dart +++ b/lib/pages/MyAppointments/widgets/indicator.dart @@ -37,11 +37,11 @@ class PageViewIndicator extends StatelessWidget { Widget circleBar(bool isActive) { return AnimatedContainer( duration: Duration(milliseconds: 150), - margin: EdgeInsets.symmetric(horizontal: 3), - height: isActive ? 12 : 8, - width: isActive ? 12 : 8, + margin: EdgeInsets.symmetric(horizontal: 4), + height: isActive ? 12 : 12, + width: isActive ? 12 : 12, decoration: BoxDecoration( - color: isActive ? Colors.red : Colors.grey, + color: isActive ? Color(0xffD02127) : Color(0xffD0D0D0), borderRadius: BorderRadius.all(Radius.circular(12))), ); } diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart index bc44770e..6a5c685c 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -1,6 +1,4 @@ -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart'; -import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -59,6 +57,7 @@ class _ReminderDialogState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), color: Colors.blue, + elevation: 0, onPressed: () { print(ReminderDialog.selectedDuration); createCalendarEvent(); diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart index db21d662..9a315bba 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart @@ -1,8 +1,6 @@ -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:manage_calendar_events/manage_calendar_events.dart'; @@ -63,7 +61,7 @@ class _ReminderDialogState extends State { child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), - color: Colors.blue, + color: Colors.blue,elevation: 0, onPressed: () { createOrUpdateEvents(); }, diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 6e9d6bce..b46e1958 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -13,19 +11,24 @@ import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_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:flutter_countdown_timer/countdown_timer_controller.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -36,8 +39,9 @@ class ToDo extends StatefulWidget { MyInAppBrowser browser; bool isShowAppBar = true; + Function onBackClick; - ToDo({@required this.isShowAppBar}); + ToDo({@required this.isShowAppBar, this.onBackClick}); @override _ToDoState createState() => _ToDoState(); @@ -46,27 +50,21 @@ class ToDo extends StatefulWidget { class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; - AuthenticatedUserObject authenticatedUserObject = - locator(); - List imagesInfo = List(); - ToDoCountProviderModel toDoProvider; CountdownTimerController controller; + ProjectViewModel projectViewModel; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authenticatedUserObject.isLogin) getPatientData(); + getPatientAppointmentHistory(); }); super.initState(); - imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); int endTime = DateTime.now().millisecondsSinceEpoch + 1000 * 30; controller = CountdownTimerController(endTime: endTime); } @@ -74,13 +72,18 @@ class _ToDoState extends State { @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, imagesInfo: imagesInfo, isShowAppBar: widget.isShowAppBar, isShowDecPage: true, + showNewAppBar: true, + showNewAppBarTitle: true, + icon: "assets/images/new/bottom_nav/todo.svg", description: TranslationBase.of(context).infoTodo, + onTap: widget.onBackClick, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( child: Column( children: [ @@ -92,319 +95,353 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { - print("ttt "+getNextActionImage(widget - .appoList[index] - .nextAction)); - print("ttt "+widget - .appoList[index] - .nextAction.toString()); return Container( - margin: EdgeInsets.all(10.0), + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: widget.appoList[index].clinicID == 265 + ? Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/drive-thru.svg"), + ) + : widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset("assets/images/new/virtual.svg") + : SvgPicture.asset("assets/images/new/hospital-visit.svg"), + + // SvgPicture.asset("assets/images/new/virtual.svg"), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + widget.appoList[index].clinicID == 265 + ? TranslationBase.of(context).drivethruAppo + : widget.appoList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCareAppo + : TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: CountdownTimer( + controller: new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) + : Container(); + }, + ), + ), + ], + ), + ], + ), + Container( + child: InkWell( + onTap: () { + performNextAction(widget.appoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: getNextActionButtonColor(widget.appoList[index].nextAction), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + getNextActionText(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + url: widget.appoList[index].doctorImageURL, + width: 52, + height: 52, ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), + SizedBox(width: 11), + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, children: [ - Image.asset( - "assets/images/new-design/time_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only( - left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - widget.appoList[index] - .appointmentDate), - projectViewModel.isArabic - ? "ar" - : "en") + - " " + - widget.appoList[index].startTime - .substring(0, 5), - style: TextStyle(fontSize: 10.0)), - ), - !widget.appoList[index] - .isLiveCareAppointment - ? Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0) - : Container(), - Container( - margin: EdgeInsets.only( - left: 5.0, right: 5.0), - child: widget.appoList[index] - .isLiveCareAppointment - ? Container() - : Text( - widget.appoList[index] - .projectName != - null - ? widget.appoList[index] - .projectName - : "-", - overflow: TextOverflow.clip, - maxLines: 2, - style: - TextStyle(fontSize: 10.0)), + RatingBar.readOnly( + initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), ], ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context) - .size - .height * - 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.network( - widget.appoList[index] - .doctorImageURL, - fit: BoxFit.fill), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 10.0, - left: 20.0, - right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - widget.appoList[index] - .doctorTitle + - " " + - widget.appoList[index] - .doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: - FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(widget - .appoList[index] - .doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget - .appoList[index] - .actualDoctorRate - .toDouble(), - size: 20.0, - filledColor: - Colors.yellow[700], - emptyColor: - Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: - Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - Container( - child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now() - .millisecondsSinceEpoch + - (widget - .appoList[ - index] - .remaniningHoursTocanPay * - 1000) * - 60), - widgetBuilder: (_, - CurrentRemainingTime - time) { - return time != null - ? Text( - '${time.days != null ? time.days : "0"}:${time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of( - context) - .upcomingTimeLeft, - style: TextStyle( - fontSize: 12.0, - color: Color( - 0xff40ACC9))) - : Container(); - }, - ), - ), - ], - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction( - widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget - .appoList[index] - .nextAction), - width: 50.0, - height: 50.0), - Container( - margin: - EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget - .appoList[index] - .nextAction), - textAlign: - TextAlign.center, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ) - ], - ), - Divider( - color: Colors.grey[500], - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription(widget - .appoList[index].nextAction), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[700])), - ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails( - context, - widget.appoList[index]); - }, - child: Container( - child: Text( - TranslationBase.of(context) - .upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: - new Color(0xFF40ACC9), - decoration: TextDecoration - .underline)), - ), - ), - ) - ], - ), ], ), ), - ), + ], ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.0), - bottomRight: Radius.circular(10.0)), - color: Color(0xff20bc44), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + getNextActionDescription(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), - height: 30.0, - padding: EdgeInsets.only(right:15), - margin: EdgeInsets.symmetric(horizontal:20), - transform: Matrix4.translationValues(0.0, -8.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - widget.appoList[index].isLiveCareAppointment - ? Image.asset( - "assets/images/new-design/video.png") - : Image.asset( - "assets/images/new-design/walkin.png"), - widget.appoList[index].isLiveCareAppointment - ? Text( - TranslationBase.of(context).videoAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)) - : Text( - TranslationBase.of(context) - .walkinAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)) - ], + ), + InkWell( + onTap: () { + navigateToAppointmentDetails(context, widget.appoList[index]); + }, + child: Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), ), ), ], ), ); + // return Container( + // margin: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // child: Card( + // margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + // color: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // child: Container( + // width: MediaQuery.of(context).size.width, + // padding: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Row( + // children: [ + // Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), + // Container( + // width: MediaQuery.of(context).size.width * 0.4, + // margin: EdgeInsets.only(left: 10.0, right: 10.0), + // child: Text( + // DateUtil.getWeekDayMonthDayYearDateFormatted( + // DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + + // " " + + // widget.appoList[index].startTime.substring(0, 5), + // overflow: TextOverflow.clip, + // style: TextStyle(fontSize: 10.0)), + // ), + // !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), + // Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: widget.appoList[index].isLiveCareAppointment + // ? Container() + // : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + // overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + // ), + // ], + // ), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Divider( + // color: Colors.grey[500], + // ), + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 1, + // child: Container( + // height: MediaQuery.of(context).size.height * 0.1, + // margin: EdgeInsets.only(top: 5.0), + // child: ClipRRect( + // borderRadius: BorderRadius.circular(100.0), + // child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), + // ), + // ), + // ), + // Expanded( + // flex: 3, + // child: Container( + // margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + // style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), + // if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") + // Container( + // margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + // child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), + // style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisSize: MainAxisSize.max, + // children: [ + // RatingBar.readOnly( + // initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + // size: 20.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + // ], + // ), + // Container( + // child: CountdownTimer( + // controller: + // new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + // widgetBuilder: (_, CurrentRemainingTime time) { + // return time != null + // ? Text( + // '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + // TranslationBase.of(context).upcomingTimeLeft, + // style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) + // : Container(); + // }, + // ), + // ), + // ], + // ), + // ), + // ), + // Expanded( + // flex: 1, + // child: InkWell( + // onTap: () => performNextAction(widget.appoList[index]), + // child: Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Column( + // children: [ + // Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + // ) + // ], + // ), + // ), + // ), + // ) + // ], + // ), + // Divider( + // color: Colors.grey[500], + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 2, + // child: Container( + // child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), + // ), + // ), + // Expanded( + // flex: 1, + // child: GestureDetector( + // onTap: () { + // navigateToAppointmentDetails(context, widget.appoList[index]); + // }, + // child: Container( + // child: Text(TranslationBase.of(context).upcomingDetails, + // textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), + // ), + // ), + // ) + // ], + // ), + // ], + // ), + // ), + // ), + // ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), + // color: Color(0xff20bc44), + // ), + // height: 30.0, + // padding: EdgeInsets.only(right: 10, left: 10), + // margin: EdgeInsets.symmetric(horizontal: 20), + // transform: Matrix4.translationValues(0.0, -8.0, 0.0), + // child: Row( + // mainAxisSize: MainAxisSize.min, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // widget.appoList[index].clinicID == 265 + // ? Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: SvgPicture.asset( + // "assets/images/new/car_icon.svg", + // height: 15, + // width: 15, + // ), + // ) + // : widget.appoList[index].isLiveCareAppointment + // ? Image.asset("assets/images/new-design/video.png") + // : Image.asset("assets/images/new-design/walkin.png"), + // widget.appoList[index].clinicID == 265 + // ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : widget.appoList[index].isLiveCareAppointment + // ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // ], + // ), + // ), + // ], + // ), + // ); }, ), ), @@ -427,19 +464,15 @@ class _ToDoState extends State { break; case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; + return projectViewModel.isArabic ? "assets/images/new-design/pay_online_button_arabic_disabled.png" : "assets/images/new-design/pay_online_button_disabled.png"; break; case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; + return projectViewModel.isArabic ? "assets/images/new-design/pay_online_button_arabic.png" : "assets/images/new-design/pay_online_button.png"; break; case 30: - return "assets/images/new-design/qr_code_button.png"; + return "assets/images/new-design/NFCIcon_option2.png"; break; case 40: @@ -455,7 +488,7 @@ class _ToDoState extends State { break; case 90: - return "assets/images/new-design/check-in.png"; + return "assets/images/new-design/NFCIcon_option2.png"; break; default: @@ -485,6 +518,48 @@ class _ToDoState extends State { } } + Color getNextActionButtonColor(nextAction) { + switch (nextAction) { + case 0: + return CustomColors.accentColor; + break; + case 10: + return CustomColors.green; + break; + + case 15: + return CustomColors.grey2; + break; + + case 20: + return CustomColors.green; + break; + + case 30: + return CustomColors.accentColor; + break; + + case 40: + return CustomColors.green; + break; + + case 50: + return CustomColors.green; + break; + + case 60: + return CustomColors.orange; + break; + + case 90: + return CustomColors.accentColor; + break; + + default: + return CustomColors.green; + } + } + String getNextActionText(nextAction) { switch (nextAction) { case 0: @@ -545,7 +620,11 @@ class _ToDoState extends State { break; case 30: - return TranslationBase.of(context).upcomingQR; + return TranslationBase.of(context).upcomingQRNFC; + break; + + case 90: + return TranslationBase.of(context).upcomingQRNFC; break; case 40: @@ -566,8 +645,7 @@ class _ToDoState extends State { } getLanguageID() async { - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { widget.languageID = languageID; }); @@ -604,12 +682,8 @@ class _ToDoState extends State { return docSpeciality; } - Future navigateToAppointmentDetails(context, appo) async { - Navigator.push( - context, - FadePage( - page: AppointmentDetails(appo: appo))) - .then((value) { + Future navigateToAppointmentDetails(context, AppoitmentAllHistoryResultList appo) async { + Navigator.push(context, FadePage(page: AppointmentDetails(appo: appo, parentIndex: appo.patientStatusType == 42 ? 1 : 0))).then((value) { getPatientAppointmentHistory(); }); } @@ -625,8 +699,7 @@ class _ToDoState extends State { if (res['AppoimentAllHistoryResultList'].length != 0) { widget.appoList.clear(); res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList - .add(new AppoitmentAllHistoryResultList.fromJson(v)); + widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); } else { Navigator.of(context).popAndPushNamed(HOME); @@ -648,10 +721,7 @@ class _ToDoState extends State { getLiveCareAppointmentPatientShare(context, service, appo); } else { GifLoaderDialogUtils.showMyDialog(context); - service - .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, - appo.projectID, context) - .then((res) { + service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); @@ -663,13 +733,9 @@ class _ToDoState extends State { } } - getLiveCareAppointmentPatientShare(context, DoctorsListService service, - AppoitmentAllHistoryResultList appo) { + getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); - service - .getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), - appo.clinicID, appo.projectID, context) - .then((res) { + service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); @@ -697,7 +763,6 @@ class _ToDoState extends State { DoctorsListService service = new DoctorsListService(); service.generateAppointmentQR(patientShareResponse, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); navigateToQR(context, res['AppointmentQR'], patientShareResponse); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -705,33 +770,28 @@ class _ToDoState extends State { }); } - Future navigateToQR( - context, String appoQR, PatientShareResponse patientShareResponse) async { + Future navigateToQR(context, String appoQR, PatientShareResponse patientShareResponse) async { Navigator.push( context, FadePage( page: QRCode( - patientShareResponse: patientShareResponse, - appoQR: appoQR, - ))).then((value) { + patientShareResponse: patientShareResponse, + appoQR: appoQR, + ))).then((value) { getPatientAppointmentHistory(); }); } - openPaymentDialog(AppoitmentAllHistoryResultList appo, - PatientShareResponse patientShareResponse) { + openPaymentDialog(AppoitmentAllHistoryResultList appo, PatientShareResponse patientShareResponse) { showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { - final curvedValue = - Curves.easeInOutBack.transform(a1.value) - 1.0; + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; return Transform( - transform: - Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), child: Opacity( opacity: a1.value, - child: PaymentDialog( - appo: appo, patientShareResponse: patientShareResponse), + child: PaymentDialog(appo: appo, patientShareResponse: patientShareResponse), ), ); }, @@ -749,22 +809,13 @@ class _ToDoState extends State { }); } - openPayment( - String paymentMethod, - AuthenticatedUser authenticatedUser, - double amount, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) { - widget.browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, - appo: appo, - onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { + widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); widget.browser.openPaymentBrowser( amount, "Appointment check in", - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo.projectID.toString(), authenticatedUser.emailAddress, paymentMethod, @@ -774,8 +825,8 @@ class _ToDoState extends State { authenticatedUser, widget.browser, appo.isLiveCareAppointment, - null, - null, + "2", + "", appo.appointmentDate, appo.appointmentNo, appo.clinicID, @@ -811,12 +862,7 @@ class _ToDoState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAppointmentTransID( - appo.projectID, appo.clinicID, appo.appointmentNo), - context) - .then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { @@ -834,36 +880,20 @@ class _ToDoState extends State { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], - res['Fort_id'], res['PaymentMethod'], context) - .then((res) { + service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['OnlineCheckInAppointments'][0]); - addAdvancedNumberRequest( - res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), - paymentReference, - appo.appointmentNo.toString(), - appo, - res['OnlineCheckInAppointments'][0]); + addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, appo.appointmentNo.toString(), appo, res['OnlineCheckInAppointments'][0]); }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); }); } - addAdvancedNumberRequest( - String advanceNumber, - String paymentReference, - String appointmentID, - AppoitmentAllHistoryResultList appo, - dynamic apptData) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo, dynamic apptData) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .addAdvancedNumberRequest( - advanceNumber, paymentReference, appointmentID, context) - .then((res) { + service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (appo.isLiveCareAppointment) addVIDARequestInsert(advanceNumber, paymentReference, apptData); @@ -875,13 +905,10 @@ class _ToDoState extends State { }); } - addVIDARequestInsert( - String advanceNumber, String paymentReference, dynamic apptData) { + addVIDARequestInsert(String advanceNumber, String paymentReference, dynamic apptData) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .addVIDARequest(advanceNumber, paymentReference, apptData, context) - .then((res) { + service.addVIDARequest(advanceNumber, paymentReference, apptData, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res); }).catchError((err) { @@ -890,44 +917,34 @@ class _ToDoState extends State { }); } - getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - setState(() { - print(data); - authUser = data; - }); - getPatientAppointmentHistory(); - } - } - - Future navigateToPaymentMethod( - context, - PatientShareResponse patientShareResponse, - AppoitmentAllHistoryResultList appo) async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - - Navigator.push( - context, FadePage(page: PaymentMethod())) - .then((value) { + // getPatientData() async { + // AppSharedPreferences sharedPref = AppSharedPreferences(); + // if (await sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + // setState(() { + // print(data); + // authUser = data; + // }); + // getPatientAppointmentHistory(); + // } + // } + + Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { + // if (await this.sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + // setState(() { + // authUser = data; + // }); + // } + + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { print(value); getPatientAppointmentHistory(); if (value != null) { - openPayment( - value, - authUser, - double.parse(patientShareResponse.patientShareWithTax.toString()), - patientShareResponse, - appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } @@ -935,10 +952,7 @@ class _ToDoState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, - appo.isLiveCareAppointment, context) - .then((res) { + service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); @@ -959,10 +973,7 @@ class _ToDoState extends State { 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, 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 9a22eada..ea583477 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -1,9 +1,18 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class PaymentMethod extends StatefulWidget { + Function onSelectedMethod; + bool isShowInstallments; + + PaymentMethod({this.onSelectedMethod, this.isShowInstallments = false}); + @override _PaymentMethodState createState() => _PaymentMethodState(); } @@ -16,192 +25,270 @@ class _PaymentMethodState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).paymentMethod, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Container( margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), child: SingleChildScrollView( child: Container( child: Column( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 0.0), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).selectPaymentOption, - style: TextStyle( - fontSize: 26.0, fontWeight: FontWeight.bold)), + margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0), + child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( - margin: EdgeInsets.only(top: 25.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("MADA"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "MADA" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset( - "assets/images/new-design/mada.png"), - ), + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("MADA"); + }, + 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 == "MADA" ? 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 == "MADA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ), + mWidth(12), + Container( + height: 70.0, + width: 70.0, + padding: EdgeInsets.all(7.0), + child: Image.asset("assets/images/new/payment/Mada.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "MADA") + 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, + ), + ), + ), + ], ), ), - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("VISA"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "VISA" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset( - "assets/images/new-design/visa.png"), - ), + ), + ), + ), + Container( + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("VISA"); + }, + 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 == "VISA" ? 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 == "VISA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/visa.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "VISA") + 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( - margin: EdgeInsets.only(top: 25.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("MASTERCARD"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "MASTERCARD" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset( - "assets/images/new-design/mastercard.png"), - ), + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("MASTERCARD"); + }, + 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 == "MASTERCARD" ? 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 == "MASTERCARD" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/Mastercard.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "MASTERCARD") + 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, + ), + ), + ), + ], ), ), - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("Installment"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "Installment" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), + ), + ), + ), + if (widget.isShowInstallments) + Container( + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("Installment"); + }, + 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 == "Installment" ? 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 == "Installment" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - child: Container( - height: 120.0, + mWidth(12), + Container( + height: 60.0, padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset( - "assets/images/new-design/installment.png"), + width: 90, + // child: Image.asset("assets/images/new/payment/installments.png"), + child: SvgPicture.asset("assets/images/new/payment/instalmt.svg"), ), - ), + mFlex(1), + if (selectedPaymentMethod == "Installment") + 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( - margin: EdgeInsets.only(top: 25.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: Container( - child: InkWell( - onTap: () { - updateSelectedPaymentMethod("ApplePay"); - }, - child: Card( - elevation: 3.0, - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "ApplePay" - ? BorderSide( - color: Colors.green, width: 5.0) - : BorderSide( - color: Colors.transparent, width: 0.0), - ), - child: Container( - height: 120.0, - padding: EdgeInsets.all(20.0), - child: SvgPicture.asset( - "assets/images/new-design/applepay.svg"), + Platform.isIOS + ? Container( + width: double.infinity, + child: InkWell( + onTap: () { + updateSelectedPaymentMethod("ApplePay"); + }, + 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 == "ApplePay" ? 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 == "ApplePay" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/Apple_Pay.png"), + ), + mFlex(1), + if (selectedPaymentMethod == "ApplePay") + 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, + ), + ), + ), + ], ), ), ), ), - ), - Expanded( - child: Container(), - ), - ], - ), - ), + ) + : Container(), SizedBox( height: 150.0, ), @@ -211,25 +298,35 @@ class _PaymentMethodState extends State { ), ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.height * 0.1, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - Navigator.pop(context, selectedPaymentMethod); - }, - child: Text(TranslationBase.of(context).confirm, - style: TextStyle(fontSize: 18.0)), + padding: EdgeInsets.all(16), + color: Colors.white, + child: Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + color: Colors.white, + // margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.height * 0.1, + height: 45.0, + child: RaisedButton( + color: CustomColors.green, + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + elevation: 0, + onPressed: () { + widget.onSelectedMethod(selectedPaymentMethod); + Navigator.pop(context, selectedPaymentMethod); + }, + child: Text(TranslationBase.of(context).confirm.toUpperCase(), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + )), + ), ), ), ), diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index 7c461815..7a0bdc2e 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -1,8 +1,12 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; class PaymentDialog extends StatefulWidget { AppoitmentAllHistoryResultList appo; @@ -21,159 +25,93 @@ class _PaymentDialogState extends State { Widget build(BuildContext context) { return Container( child: Dialog( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( height: 550.0, width: 450.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text("Invoice Detail", - style: TextStyle( - fontSize: 25.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text("Appointment Details", - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text( - widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, - style: TextStyle( - color: Colors.grey[700], - fontSize: 15.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text(getDate(widget.appo.appointmentDate), - style: getTextStyle()), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text(widget.appo.projectName, style: getTextStyle()), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Table( - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientShareToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientShare - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientTaxToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientTaxAmount - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareTotalToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientShareWithTax - .toString())), - ]), - ], + child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ + Container( + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), + child: Text(TranslationBase.of(context).invoiceDetails, style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w600)), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), + child: Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600)), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), + child: Text(getDate(widget.appo.appointmentDate), style: getTextStyle()), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), + child: Text(widget.appo.projectName, style: getTextStyle()), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Table( + children: [ + TableRow(decoration: BoxDecoration(), children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())), + ]), + ], + ), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), + child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)), + ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), + Container( + margin: EdgeInsets.fromLTRB(20.0, 30.0, 20.0, 15.0), + child: Text(TranslationBase.of(context).appoPaymentConfirm, style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor, fontWeight: FontWeight.w600)), + ), + Container( + alignment: Alignment.center, + height: 40.0, + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel_nocaps, + () { + Navigator.pop(context, null); + }, + color: CustomColors.accentColor, + textColor: Colors.white, + ), ), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text("You can pay by following options: ", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans")), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset( - "assets/images/new-design/payment_options_invoice_confirmation.png", - width: 300), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 15.0), - child: Text( - "Are You Sure You Want To Make payment for this Appointment?", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.0, - color: Colors.red[700], - fontFamily: "Open-Sans")), - ), - Divider( - color: Colors.grey, - ), - Container( - alignment: Alignment.center, - height: 40.0, - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context, null); - }, - child: Container( - child: Text("Cancel", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, color: Colors.red[700])), - ), - ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context, widget.patientShareResponse); -// widget.onPaymentMethodSelected(); - }, - child: Container( - child: Text("Ok", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, - )), - ), - ), - ), - ], + mWidth(10.0), + Expanded( + child: DefaultButton( + TranslationBase.of(context).confirm, + () { + Navigator.pop(context, widget.patientShareResponse); + }, + color: CustomColors.green, + textColor: Colors.white, + ), ), - ), - ]), + ], + ), + ), + ]), ), ), ); @@ -182,35 +120,17 @@ class _PaymentDialogState extends State { _getNormalText(text) { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), - child: Text(text, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 15, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[700])), + child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Colors.black)), ); } TextStyle getTextStyle() { - return TextStyle( - color: Colors.grey[700], fontSize: 15.0, fontFamily: "Open-Sans-Bold"); + return TextStyle(color: Colors.grey[700], fontSize: 13.0, fontWeight: FontWeight.w600); } -// Future navigateToPaymentMethod(context) async { -// Navigator.push( -// context, MaterialPageRoute(builder: (context) => PaymentMethod())); -// } - String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString() + + return DateUtil.getDayMonthYearDateFormatted(dateObj) + " " + dateObj.hour.toString() + ":" + diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 6610ed33..863947ea 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -1,20 +1,17 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { - AppoitmentAllHistoryResultList appo; - var languageID; - final VoidCallback onListUpdated; - - TodoListCard({@required this.appo, this.onListUpdated}); + TodoListCard(); @override _TodoListCardState createState() => _TodoListCardState(); @@ -25,333 +22,128 @@ class _TodoListCardState extends State { @override void initState() { -// widget.onListUpdated(); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( + width: double.infinity, margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Row( - children: [ - Image.asset("assets/images/new-design/time_icon.png", - width: 20.0, height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 30.0), - child: Text(getDate(widget.appo.appointmentDate), - style: TextStyle(fontSize: 12.0)), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: SvgPicture.asset("assets/images/new/virtual.svg"), ), - widget.appo.isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: widget.appo.isLiveCareAppointment - ? Text(TranslationBase.of(context).upcomingLivecare, - style: TextStyle(fontSize: 12.0)) - : Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text(TranslationBase.of(context).videoAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text("01:23:22 " + TranslationBase.of(context).upcomingTimeLeft, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)), + ), + ], ), ], ), Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appo.doctorImageURL, - fit: BoxFit.fill), - ), + child: InkWell( + onTap: () { + // showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: CustomColors.green, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), ), - ), - Expanded( - flex: 3, - child: Container( - margin: - EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - widget.appo.doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: 4.0, - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - ], - ), + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget.appo.nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget.appo.nextAction), - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ) - ], + ), ), - Divider( - color: Colors.grey[500], + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + "Raed Mubarak Bin Ghanem", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: "Raed Mubarak Bin Ghanem", + url: "https://hmgwebservices.com/Images/MobileImages/TAKHSUSI/158210.png", + width: 52, + height: 52, ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription(widget.appo.nextAction), - style: TextStyle( - fontSize: 12.0, color: Colors.grey[700])), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", "Cardiology", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", "11/04/2021 15:30", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, "Olaya Hospital", projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: 4.5, + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: new Color(0xFF40ACC9), - decoration: TextDecoration.underline)), - ), - ), - ) - ], + ], + ), ), ], ), - ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + "Please confirm the appointment to avoid cancellation", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + "More Details", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), + ), + ], ), ); } - - String getNextActionImage(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return "assets/images/new-design/confirm_button.png"; - break; - - case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; - break; - - case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; - break; - - case 30: - return "assets/images/new-design/qr_code_button.png"; - break; - - case 40: - return "assets/images/new-design/video_call_instruction.png"; - break; - - case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; - break; - - default: - return ""; - } - } - - String getNextActionText(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).confirm; - break; - - case 15: - return TranslationBase.of(context).pendingPayment; - break; - - case 20: - return TranslationBase.of(context).payNow; - break; - - case 30: - return TranslationBase.of(context).viewQR; - break; - - case 40: - return TranslationBase.of(context).instruction; - break; - - case 50: - return TranslationBase.of(context).livecare; - break; - - default: - return ""; - } - } - - String getNextActionDescription(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).upcomingConfirm; - break; - - case 15: - return TranslationBase.of(context).upcomingPaymentPending; - break; - - case 20: - return TranslationBase.of(context).upcomingPaymentNow; - break; - - case 30: - return TranslationBase.of(context).upcomingQR; - break; - - case 40: - return TranslationBase.of(context).upcomingVirtual; - break; - - case 50: - return TranslationBase.of(context).upcomingLivecare; - break; - - default: - return ""; - } - } - - getLanguageID() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - widget.languageID = languageID; - }); - } - - String getDate(String date) { - DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getWeekDay(dateObj.weekday) + - ", " + - dateObj.day.toString() + - " " + - DateUtil.getMonth(dateObj.month) + - " " + - dateObj.year.toString() + - " " + - dateObj.hour.toString() + - ":" + - getMinute(dateObj); - } - - String getMinute(DateTime dateObj) { - if (dateObj.minute == 0) { - return dateObj.minute.toString() + "0"; - } else { - return dateObj.minute.toString(); - } - } - - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - - Future navigateToAppointmentDetails(context) async { - Navigator.push( - context, FadePage(page: AppointmentDetails())); - } } diff --git a/lib/pages/appUpdatePage/app_update_page.dart b/lib/pages/appUpdatePage/app_update_page.dart index 7bcf2388..1296ac38 100644 --- a/lib/pages/appUpdatePage/app_update_page.dart +++ b/lib/pages/appUpdatePage/app_update_page.dart @@ -73,6 +73,7 @@ class _AppUpdatePageState extends State { child: RaisedButton( color: Colors.red[800], textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/conference/conference_page.dart b/lib/pages/conference/conference_page.dart index 7848d4f7..dc00bf6e 100644 --- a/lib/pages/conference/conference_page.dart +++ b/lib/pages/conference/conference_page.dart @@ -101,7 +101,7 @@ class _ConferencePageState extends State { return WillPopScope( onWillPop: () async => false, child: Scaffold( - backgroundColor: Colors.black, + backgroundColor: Colors.white, body: _conferenceRoom == null ? showProgress() : buildLayout(), ), ); diff --git a/lib/pages/conference/web_rtc/call_home_page.dart b/lib/pages/conference/web_rtc/call_home_page.dart new file mode 100644 index 00000000..7153bf92 --- /dev/null +++ b/lib/pages/conference/web_rtc/call_home_page.dart @@ -0,0 +1,172 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import '../conference_button_bar.dart'; + +class CallHomePage extends StatefulWidget { + @override + _CallHomePageState createState() => _CallHomePageState(); +} + +class _CallHomePageState extends State { + bool showNoise = false; + RTCVideoRenderer _localRenderer = RTCVideoRenderer(); + RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); + + final StreamController _audioButton = StreamController.broadcast(); + final StreamController _videoButton = StreamController.broadcast(); + final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); + final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); + + //Stream to enable video + MediaStream stream; + + @override + void initState() { + // TODO: implement initState + super.initState(); + _localRenderer.initialize(); + _remoteRenderer.initialize(); + + enableVideo(); + } + + enableVideo() async { + //Stream to enable video + stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); + // _audioButton.add(false); + } + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _localRenderer.dispose(); + _remoteRenderer.dispose(); + _audioButton.close(); + _videoButton.close(); + stream.dispose(); + _disposeStreamsAndSubscriptions(); + } + + Future _disposeStreamsAndSubscriptions() async { + if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); + if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); + } + + @override + Widget build(BuildContext context) { + // return WillPopScope( + // onWillPop: () async => false, + // child: Scaffold( + // backgroundColor: Colors.black, + // // body: , + // ), + // ); + + return Scaffold( + backgroundColor: Colors.white, + body: showNoise ? _buildNoiseBox() : buildLayout(), + ); + } + + LayoutBuilder buildLayout() { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Stack( + children: [ + CamViewWidget( + localRenderer: _localRenderer, + remoteRenderer: _remoteRenderer, + stream: stream, + constraints: constraints, + onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, + onButtonBarHeightStreamController: _onButtonBarHeightStreamController, + ), + ConferenceButtonBar( + audioEnabled: _audioButton.stream, + videoEnabled: _videoButton.stream, + onAudioEnabled: _onAudioEnable, + onVideoEnabled: _onVideoEnabled, + onSwitchCamera: _onSwitchCamera, + onHangup: _onHangup, + onPersonAdd: () {}, + onPersonRemove: () {}, + onHeight: _onHeightBar, + onShow: _onShowBar, + onHide: _onHideBar, + ), + ], + ); + }, + ); + } + + NoiseBox _buildNoiseBox() { + return NoiseBox( + density: NoiseBoxDensity.xLow, + backgroundColor: Colors.grey.shade900, + child: Center( + child: Container( + color: Colors.black54, + width: double.infinity, + height: 40, + child: Center( + child: Text( + 'Waiting for another participant to connect to the call...', + key: Key('text-wait'), + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), + ), + ), + ), + ); + } + + Function _onAudioEnable() { + bool enabled = stream.getAudioTracks()[0].enabled; + stream.getAudioTracks()[0].enabled = !enabled; + _audioButton.add(!enabled); + } + + Function _onVideoEnabled() { + bool enabled = stream.getVideoTracks()[0].enabled; + stream.getVideoTracks()[0].enabled = !enabled; + _videoButton.add(!enabled); + } + + Function _onSwitchCamera() { + // stream.getAudioTracks()[0].enabled = false; + // stream.getVideoTracks()[0].enabled = false; + Helper.switchCamera(stream.getVideoTracks()[0]); + } + + void _onShowBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); + }); + _onButtonBarVisibleStreamController.add(true); + } + + void _onHeightBar(double height) { + _onButtonBarHeightStreamController.add(height); + } + + void _onHideBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); + }); + _onButtonBarVisibleStreamController.add(false); + } + + Future _onHangup() async { + print('onHangup'); + Navigator.of(context).pop(); + } +} diff --git a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart new file mode 100644 index 00000000..3db0c74b --- /dev/null +++ b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart @@ -0,0 +1,61 @@ +import 'dart:async'; +import 'dart:core'; + +import 'package:flutter/material.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import 'draggable_cam.dart'; + +class CamViewWidget extends StatefulWidget { + RTCVideoRenderer localRenderer; + RTCVideoRenderer remoteRenderer; + MediaStream stream; + BoxConstraints constraints; + StreamController onButtonBarVisibleStreamController; + StreamController onButtonBarHeightStreamController; + + CamViewWidget({this.localRenderer, this.remoteRenderer, this.stream, this.constraints, this.onButtonBarVisibleStreamController, this.onButtonBarHeightStreamController}); + + @override + _CamViewWidgetState createState() => _CamViewWidgetState(); +} + +class _CamViewWidgetState extends State { + @override + void initState() { + super.initState(); + Future.delayed(const Duration(milliseconds: 300), () { + showCamera(); + }); + } + + showCamera() async { + setState(() async { + widget.localRenderer.srcObject = widget.stream; + widget.remoteRenderer.srcObject = widget.stream; + }); + } + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: double.infinity, + child: Stack( + children: [ + Container( + child: RTCVideoView(widget.localRenderer, mirror: true), + ), + DraggableCam( + key: Key('publisher'), + onButtonBarHeight: widget.onButtonBarHeightStreamController.stream, + onButtonBarVisible: widget.onButtonBarVisibleStreamController.stream, + availableScreenSize: widget.constraints.biggest, + child: RTCVideoView(widget.remoteRenderer), + ), + // Expanded(child: RTCVideoView(widget.remoteRenderer)), + ], + ), + ); + } +} diff --git a/lib/pages/conference/web_rtc/widgets/draggable_cam.dart b/lib/pages/conference/web_rtc/widgets/draggable_cam.dart new file mode 100644 index 00000000..efc59301 --- /dev/null +++ b/lib/pages/conference/web_rtc/widgets/draggable_cam.dart @@ -0,0 +1,173 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:diplomaticquarterapp/pages/conference/clipped_video.dart'; +import 'package:flutter/material.dart'; + +class DraggableCam extends StatefulWidget { + final Size availableScreenSize; + final Widget child; + final double scaleFactor; + final Stream onButtonBarVisible; + final Stream onButtonBarHeight; + + const DraggableCam({ + Key key, + @required this.availableScreenSize, + this.child, + @required this.onButtonBarVisible, + @required this.onButtonBarHeight, + + /// The portion of the screen the DraggableWidget should use. + this.scaleFactor = .25, + }) : assert(scaleFactor != null && scaleFactor > 0 && scaleFactor <= .4), + assert(availableScreenSize != null), + assert(onButtonBarVisible != null), + assert(onButtonBarHeight != null), + super(key: key); + + @override + _DraggablePublisherState createState() => _DraggablePublisherState(); +} + +class _DraggablePublisherState extends State { + bool _isButtonBarVisible = true; + double _buttonBarHeight = 0; + double _width; + double _height; + double _top; + double _left; + double _viewPaddingTop; + double _viewPaddingBottom; + final double _padding = 8.0; + final Duration _duration300ms = const Duration(milliseconds: 300); + final Duration _duration0ms = const Duration(milliseconds: 0); + Duration _duration; + StreamSubscription _streamSubscription; + StreamSubscription _streamHeightSubscription; + + @override + void initState() { + super.initState(); + _duration = _duration300ms; + _width = widget.availableScreenSize.width * widget.scaleFactor; + _height = _width * (widget.availableScreenSize.height / widget.availableScreenSize.width); + _top = widget.availableScreenSize.height - (_buttonBarHeight + _padding) - _height; + _left = widget.availableScreenSize.width - _padding - _width; + + _streamSubscription = widget.onButtonBarVisible.listen(_buttonBarVisible); + _streamHeightSubscription = widget.onButtonBarHeight.listen(_getButtonBarHeight); + } + + @override + void didChangeDependencies() { + final mediaQuery = MediaQuery.of(context); + _viewPaddingTop = mediaQuery.viewPadding.top; + _viewPaddingBottom = mediaQuery.viewPadding.bottom; + super.didChangeDependencies(); + } + + @override + void dispose() { + _streamSubscription.cancel(); + _streamHeightSubscription.cancel(); + super.dispose(); + } + + void _getButtonBarHeight(double height) { + setState(() { + _buttonBarHeight = height; + _positionWidget(); + }); + } + + void _buttonBarVisible(bool visible) { + if (!mounted) { + return; + } + setState(() { + _isButtonBarVisible = visible; + if (_duration == _duration300ms) { + // only position the widget when we are not currently dragging it around + _positionWidget(); + } + }); + } + + @override + Widget build(BuildContext context) { + return AnimatedPositioned( + top: _top, + left: _left, + width: _width, + height: _height, + duration: _duration, + child: Listener( + onPointerDown: (_) => _duration = _duration0ms, + onPointerMove: (PointerMoveEvent event) { + setState(() { + _left = (_left + event.delta.dx).roundToDouble(); + _top = (_top + event.delta.dy).roundToDouble(); + }); + }, + onPointerUp: (_) => _positionWidget(), + onPointerCancel: (_) => _positionWidget(), + child: ClippedVideo( + height: _height, + width: _width, + child: widget.child, + ), + ), + ); + } + + double _getCurrentStatusBarHeight() { + if (_isButtonBarVisible) { + return _viewPaddingTop; + } + final _defaultViewPaddingTop = Platform.isIOS ? 20.0 : Platform.isAndroid ? 24.0 : 0.0; + if (_viewPaddingTop > _defaultViewPaddingTop) { + // There must be a hardware notch in the display. + return _viewPaddingTop; + } + return 0.0; + } + + double _getCurrentButtonBarHeight() { + if (_isButtonBarVisible) { + return _buttonBarHeight + _viewPaddingBottom; + } + return _viewPaddingBottom; + } + + void _positionWidget() { + // Determine the center of the object being dragged so we can decide + // in which corner the object should be placed. + var dx = (_width / 2) + _left; + dx = dx < 0 ? 0 : dx >= widget.availableScreenSize.width ? widget.availableScreenSize.width - 1 : dx; + var dy = (_height / 2) + _top; + dy = dy < 0 ? 0 : dy >= widget.availableScreenSize.height ? widget.availableScreenSize.height - 1 : dy; + final draggableCenter = Offset(dx, dy); + + setState(() { + _duration = _duration300ms; + if (Rect.fromLTRB(0, 0, widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2).contains(draggableCenter)) { + // Top-left + _top = _getCurrentStatusBarHeight() + _padding; + _left = _padding; + } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, 0, widget.availableScreenSize.width, widget.availableScreenSize.height / 2).contains(draggableCenter)) { + // Top-right + _top = _getCurrentStatusBarHeight() + _padding; + _left = widget.availableScreenSize.width - _padding - _width; + } else if (Rect.fromLTRB(0, widget.availableScreenSize.height / 2, widget.availableScreenSize.width / 2, widget.availableScreenSize.height).contains(draggableCenter)) { + // Bottom-left + _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height; + _left = _padding; + } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2, widget.availableScreenSize.width, widget.availableScreenSize.height).contains(draggableCenter)) { + // Bottom-right + _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height; + _left = widget.availableScreenSize.width - _padding - _width; + } + }); + } +} diff --git a/lib/pages/conference/widgets/noise_box.dart b/lib/pages/conference/widgets/noise_box.dart index 5087415f..37d94fb5 100644 --- a/lib/pages/conference/widgets/noise_box.dart +++ b/lib/pages/conference/widgets/noise_box.dart @@ -1,5 +1,6 @@ import 'dart:math' as math; import 'dart:ui'; + import 'package:flutter/material.dart'; enum NoiseBoxDensity { diff --git a/lib/pages/conference/widgets/platform_alert_dialog.dart b/lib/pages/conference/widgets/platform_alert_dialog.dart index 1adaa223..ce5c086c 100644 --- a/lib/pages/conference/widgets/platform_alert_dialog.dart +++ b/lib/pages/conference/widgets/platform_alert_dialog.dart @@ -1,7 +1,7 @@ import 'dart:io'; -import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import './platform_widget.dart'; diff --git a/lib/pages/conference/widgets/platform_exception_alert_dialog.dart b/lib/pages/conference/widgets/platform_exception_alert_dialog.dart index 931a6e10..12faf640 100644 --- a/lib/pages/conference/widgets/platform_exception_alert_dialog.dart +++ b/lib/pages/conference/widgets/platform_exception_alert_dialog.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + import './platform_alert_dialog.dart'; class PlatformExceptionAlertDialog extends PlatformAlertDialog { diff --git a/lib/pages/conference/widgets/platform_widget.dart b/lib/pages/conference/widgets/platform_widget.dart index 5773190f..d3366d5e 100644 --- a/lib/pages/conference/widgets/platform_widget.dart +++ b/lib/pages/conference/widgets/platform_widget.dart @@ -1,4 +1,5 @@ import 'dart:io'; + import 'package:flutter/material.dart'; abstract class PlatformWidget extends StatelessWidget { diff --git a/lib/pages/feedback/feedback-detail.dart b/lib/pages/feedback/feedback-detail.dart index 6135aee9..62ab1aa7 100644 --- a/lib/pages/feedback/feedback-detail.dart +++ b/lib/pages/feedback/feedback-detail.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class FeedbackDetails extends StatelessWidget { final COCItem items; @@ -15,6 +15,8 @@ class FeedbackDetails extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).feedbackTitle, body: Container( margin: EdgeInsets.all(5), diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index 15f348f9..72f09bed 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -3,8 +3,8 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/feedback/send_feedback_page.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,14 +14,13 @@ import 'status_feedback_page.dart'; class FeedbackHomePage extends StatefulWidget { final AppoitmentAllHistoryResultList appointment; final MessageType messageType; - const FeedbackHomePage({Key key, this.appointment, this.messageType= MessageType.NON}) : super(key: key); + const FeedbackHomePage({Key key, this.appointment, this.messageType = MessageType.NON}) : super(key: key); @override _FeedbackHomePageState createState() => _FeedbackHomePageState(); } -class _FeedbackHomePageState extends State - with SingleTickerProviderStateMixin { +class _FeedbackHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -43,79 +42,44 @@ class _FeedbackHomePageState extends State isBottomBar: false, isShowDecPage: false, appBarTitle: TranslationBase.of(context).feedbackTitle, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, width: 0.7), - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).send), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).status), - ), - ), - ], - ), - ), - ), - ), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).send), Text(TranslationBase.of(context).status)], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [SendFeedbackPage(appointment: widget.appointment,messageType: widget.messageType,), StatusFeedbackPage()], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + SendFeedbackPage( + appointment: widget.appointment, + messageType: widget.messageType, + ), + StatusFeedbackPage() + ], + ), + ) + ], ), ); } diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index bbef1757..298e617e 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -1,20 +1,23 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart'; @@ -24,9 +27,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; -import 'dart:convert'; -import 'dart:io'; -import 'appointment_history.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class SendFeedbackPage extends StatefulWidget { @@ -51,8 +51,11 @@ class _SendFeedbackPageState extends State { var _currentLocaleId; stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; + int selectedStatusIndex = 5; var event = RobotProvider(); + List appoList = []; + String getSelected(BuildContext context) { switch (messageType) { case MessageType.ComplaintOnAnAppointment: @@ -102,447 +105,302 @@ class _SendFeedbackPageState extends State { builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, - body: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: SingleChildScrollView( - child: Form( - key: formKey, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 65, - ), - Container( - margin: EdgeInsets.only(left: 20, right: 20, top: 8), - child: Texts( - TranslationBase.of(context).likeToHear, - textAlign: TextAlign.center, - ), - ), - InkWell( - onTap: () { - confirmBox(model); - }, - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Texts( - getSelected(context), - variant: 'bodyText', - ), - margin: EdgeInsets.only(left: 10, right: 10), - ), - Icon( - Icons.arrow_drop_down, - size: 22, - color: Colors.grey, - ) - ], + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).likeToHear, + // textAlign: TextAlign.center, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), - ), - ), - if (appointHistory != null && - messageType == MessageType.ComplaintOnAnAppointment) - InkWell( - onTap: () { - setState(() { - isShowListAppointHistory = true; - }); - }, - child: Container( - margin: EdgeInsets.all(8.0), - decoration: BoxDecoration( + SizedBox(height: 21), + InkWell( + onTap: () { + confirmBox(model); + }, + child: Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), color: Colors.white, - borderRadius: BorderRadius.circular(8) - ), - child: Row( - children: [ - Container( - width: projectViewModel.isArabic ? 27 : 20, - height: projectViewModel.isArabic ? 105 : 90, - decoration: BoxDecoration( - //Colors.red[900] Color(0xff404545) - color: appointHistory.isLiveCareAppointment - ? Color(0xff404545) - : !appointHistory.isInOutPatient - ? Colors.red[900] - : Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - bottomLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - topRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - bottomRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - ), - ), - child: RotatedBox( - quarterTurns: 3, - child: Center( - child: Text( - appointHistory.isLiveCareAppointment - ? TranslationBase.of(context).liveCare.toUpperCase() - : !appointHistory.isInOutPatient - ? TranslationBase.of(context) - .inPatient - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), - style: TextStyle(color: Colors.white,fontSize: 12), - ), - )), + border: Border.all( + color: Color(0xffefefef), + width: 1, ), - Expanded( - flex: 4, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - children: [ - Expanded( - flex: 1, - child: LargeAvatar( - name: appointHistory.doctorNameObj, - url: appointHistory.doctorImageURL, - ), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - appointHistory.doctorNameObj, - bold: true, - ), - Texts( - DateUtil - .getMonthDayYearDateFormatted(DateUtil.convertStringToDate(appointHistory.appointmentDate)), - variant: 'caption3', - ), - StarRating( - totalAverage: appointHistory - .doctorRate - .toDouble(), - forceStars: true), - ], - ), - ), - ), - ], - ), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Center( - child: Icon( - Icons.arrow_forward_ios, - size: 15, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getSelected(context), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff2B353E), ), ), - ) - ], + Icon( + Icons.keyboard_arrow_down, + size: 22, + color: Colors.grey, + ) + ], + ), ), ), - ), - if (messageType == MessageType.ComplaintOnAnAppointment && - model.appointHistoryList.length != 0 && - isShowListAppointHistory) - Container( - height: model.appointHistoryList.length > 2 - ? MediaQuery.of(context).size.height * 0.25 - : MediaQuery.of(context).size.height * 0.15, - child: ListView.builder( - itemCount: model.appointHistoryList.length, - itemBuilder: (context, index) => InkWell( + SizedBox(height: 12), + if (appointHistory != null && messageType == MessageType.ComplaintOnAnAppointment) + InkWell( onTap: () { setState(() { - appointHistory = model.appointHistoryList[index]; - isShowListAppointHistory = false; + isShowListAppointHistory = true; }); }, - child: Container( - margin: EdgeInsets.only(left: 8, right: 8), - color: Colors.white, - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 4, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - children: [ - Expanded( - flex: 1, - child: LargeAvatar( - name: model - .appointHistoryList[ - index] - .doctorNameObj, - url: model - .appointHistoryList[ - index] - .doctorImageURL, - ), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts( - model - .appointHistoryList[ - index] - .doctorNameObj, - bold: true, - ), - Texts( - DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(model.appointHistoryList[index].appointmentDate)), - variant: 'caption3', - ), - StarRating( - totalAverage: model - .appointHistoryList[ - index] - .doctorRate - .toDouble(), - forceStars: true), - ], - ), - ), - ), - ], - ), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Center( - child: Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), - ) - ], - ), - SizedBox( - height: 5, - ), - Divider( - height: 0.5, - color: Colors.grey[400], - ) - ], + child: DoctorCard( + onTap: null, + isInOutPatient: appointHistory.isInOutPatient, + name: appointHistory.doctorTitle + " " + appointHistory.doctorNameObj, + // billNo: _appointmentResult.invoiceNo, + profileUrl: appointHistory.doctorImageURL, + subName: appointHistory.projectName, + isLiveCareAppointment: appointHistory.isLiveCareAppointment, + date: DateUtil.convertStringToDate(appointHistory.appointmentDate), + rating: appointHistory.actualDoctorRate + 0.0, + appointmentTime: appointHistory.startTime.substring(0, 5), + ), + ), + SizedBox(height: 12), + if (messageType == MessageType.ComplaintOnAnAppointment && appoList.length != 0 && isShowListAppointHistory) + Container( + margin: EdgeInsets.only(bottom: 10.0), + height: appoList.length > 2 ? MediaQuery.of(context).size.height * 0.35 : MediaQuery.of(context).size.height * 0.17, + child: ListView.separated( + itemCount: appoList.length, + separatorBuilder: (ctx, index) => SizedBox(height: 12), + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + appointHistory = appoList[index]; + isShowListAppointHistory = false; + }); + }, + child: DoctorCard( + onTap: null, + isInOutPatient: appoList[index].isInOutPatient, + name: appoList[index].doctorTitle + " " + appoList[index].doctorNameObj, + profileUrl: appoList[index].doctorImageURL, + subName: appoList[index].projectName, + isLiveCareAppointment: appoList[index].isLiveCareAppointment, + date: DateUtil.convertStringToDate(appoList[index].appointmentDate), + rating: appoList[index].actualDoctorRate + 0.0, + appointmentTime: appoList[index].startTime.substring(0, 5), + ), ), ), ), - ), - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).subject, - controller: titleController, - fontSize: 13.5, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - onChanged: (v) { - setState(() {}); - }, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context).emptySubject; - else - return null; - }, - ), - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).message, - fontSize: 13.5, - hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: messageController, - suffixIcon: Icons.mic, - onSuffixTap: () { - openSpeechReco(); - }, - onChanged: (v) { - setState(() {}); + inputWidget(TranslationBase.of(context).subject, "", titleController), + SizedBox(height: 12), + inputWidget(TranslationBase.of(context).message, "", messageController, lines: 11, suffixTap: () { + openSpeechReco(); + }), + SizedBox(height: 12), + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, (String image, File file) { + setState(() { + images.add(image); + }); + }); }, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - InkWell( - onTap: () { - ImageOptions.showImageOptions(context, - (String image, File file) { - setState(() { - images.add(image); - }); - }); - }, - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: Center( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.attach_file), - Texts( - TranslationBase.of(context).selectAttachment, - variant: 'bodyText', - textAlign: TextAlign.center, + child: Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), - ], + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.attach_file, + color: Color(0xff2B353E), + ), + Text( + TranslationBase.of(context).selectAttachment, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + ], + ), ), ), - ), - ), - ...List.generate( - images.length, - (index) => Container( - margin: EdgeInsets.all(10), - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, + ...List.generate( + images.length, + (index) => Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Icon(FontAwesomeIcons.paperclip), - SizedBox( - width: 8, - ), - Texts( - 'image ${index + 1}.png', + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon(FontAwesomeIcons.paperclip), + SizedBox( + width: 8, + ), + Texts( + 'image ${index + 1}.png', + ), + ], ), + InkWell( + onTap: () { + setState(() { + images.remove(images[index]); + }); + }, + child: Icon( + FontAwesomeIcons.trashAlt, + color: Colors.red[300], + )) ], ), - InkWell( - onTap: () { - setState(() { - images.remove(images[index]); - }); - }, - child: Icon( - FontAwesomeIcons.trashAlt, - color: Colors.red[300], - )) - ], - ), - )), - SizedBox( - height: 100, + )), + ], ), - ], + ), ), ), - ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).send, + (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty) + ? null + : () { + final form = formKey.currentState; + if (form.validate()) { + GifLoaderDialogUtils.showMyDialog(context); + model + .sendCOCItem( + title: titleController.text, + attachment: images.length > 0 ? images[0] : "", + details: messageController.text, + cOCTypeName: getCOCName(), + appointHistory: messageType == MessageType.ComplaintOnAnAppointment ? appointHistory : null) + .then((value) { + if (value) { + setState(() { + titleController.text = ""; + messageController.text = ""; + images = []; + }); + selectedStatusIndex = 5; + setMessageType(MessageType.NON); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).yourFeedback); + } else { + AppToast.showErrorToast(message: model.error); + GifLoaderDialogUtils.hideDialog(context); + } + }); + } + }, + color: Color(0xffD02127), + textColor: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty) ? Color(0xff000000) : Colors.white, + disabledColor: Color(0xffEAEAEA), + ), + ), + ], ), - bottomSheet: Container( - height: 80, - width: double.infinity, - padding: EdgeInsets.all(15.0), - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - child: SecondaryButton( - label: TranslationBase.of(context).send, - textColor: Colors.white, - disabled: (titleController.text.toString().isEmpty || - messageController.text.toString().isEmpty), - onTap: () { - final form = formKey.currentState; - if (form.validate()) { - GifLoaderDialogUtils.showMyDialog(context); - model - .sendCOCItem( - title: titleController.text, - attachment: images.length > 0 ? images[0] : "", - details: messageController.text, - cOCTypeName: getCOCName(), - appointHistory: messageType == - MessageType.ComplaintOnAnAppointment - ? appointHistory - : null) - .then((value) { - if (value) { - setState(() { - titleController.text = ""; - messageController.text = ""; - images = []; - }); - setMessageType(MessageType.NON); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showSuccessToast( - message: TranslationBase.of(context).yourFeedback); - } else { - AppToast.showErrorToast(message: model.error); - GifLoaderDialogUtils.hideDialog(context); - } - }); - } - }, + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); @@ -574,31 +432,78 @@ class _SendFeedbackPageState extends State { // Show Dialog function void confirmBox(FeedbackViewModel model) { + DoctorsListService service = new DoctorsListService(); + + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).notClassified, 5), + RadioSelectionDialogModel(TranslationBase.of(context).complainAppo, 1), + RadioSelectionDialogModel(TranslationBase.of(context).complainWithoutAppo, 2), + RadioSelectionDialogModel(TranslationBase.of(context).question, 3), + RadioSelectionDialogModel(TranslationBase.of(context).compliment, 4), + RadioSelectionDialogModel(TranslationBase.of(context).suggestion, 6), + ]; + showDialog( - context: context, - child: FeedbackTypeDialog( - messageTypeDialog: messageType, - onValueSelected: (MessageType value) { - if (value == MessageType.ComplaintOnAnAppointment) { - GifLoaderDialogUtils.showMyDialog(context); - model.getPatentAppointmentHistory().then((value) { - GifLoaderDialogUtils.hideDialog(context); - setState(() { - appointHistory = null; - }); + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: selectedStatusIndex, + onValueSelected: (index) { + selectedStatusIndex = index; + + if (index == 1) { + messageType = MessageType.ComplaintOnAnAppointment; + } else if (index == 2) { + messageType = MessageType.ComplaintWithoutAppointment; + } else if (index == 3) { + messageType = MessageType.Question; + } else if (index == 4) { + messageType = MessageType.Compliment; + } else if (index == 5) { + messageType = MessageType.NON; + } else { + messageType = MessageType.Suggestion; + } + + if (messageType == MessageType.ComplaintOnAnAppointment) { + appoList.clear(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) { + GifLoaderDialogUtils.hideDialog(context); + setState(() { + if (res['MessageStatus'] == 1) { + if (res['AppoimentAllHistoryResultList'].length != 0) { + res['AppoimentAllHistoryResultList'].forEach((v) { + appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + }); + setState(() { + appointHistory = null; + isShowListAppointHistory = true; + }); + } else {} + } else {} }); - } - setMessageType(value); - }, - )); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + // print(err); + // AppToast.showErrorToast(message: err); + // Navigator.of(context).pop(); + }); + } else { + isShowListAppointHistory = false; + } + setMessageType(messageType); + }, + ), + ); + + return; } openSpeechReco() async { new RoboSearch(context: context).showAlertDialog(context); - _currentLocaleId = - TranslationBase.of(AppGlobal.context).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -641,259 +546,8 @@ class _SendFeedbackPageState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } -} - -class FeedbackTypeDialog extends StatefulWidget { - final Function(MessageType) onValueSelected; - final MessageType messageTypeDialog; - - const FeedbackTypeDialog( - {Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) - : super(key: key); - - @override - State createState() => new FeedbackTypeDialogState(); -} - -class FeedbackTypeDialogState extends State { - MessageType messageTypeDialog = MessageType.NON; - - setMessageDialogType(MessageType messageType) { - setState(() { - messageTypeDialog = messageType; - }); - } - - @override - void initState() { - messageTypeDialog = widget.messageTypeDialog; - - super.initState(); - } - - Widget build(BuildContext context) { - return BaseView( - builder: (_, model, widge) => SimpleDialog( - title: Text( - TranslationBase.of(context).messageType, - textAlign: TextAlign.center, - ), - children: [ - Container( - // padding: const EdgeInsets.all(10.0), - child: Column( - children: [ - Divider( - height: 2.5, - color: Colors.grey[500], - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => setMessageDialogType(MessageType.NON), - child: ListTile( - title: - Texts(TranslationBase.of(context).notClassified), - leading: Radio( - value: MessageType.NON, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => setMessageDialogType( - MessageType.ComplaintOnAnAppointment), - child: ListTile( - title: - Texts(TranslationBase.of(context).complainAppo), - leading: Radio( - value: MessageType.ComplaintOnAnAppointment, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => setMessageDialogType( - MessageType.ComplaintWithoutAppointment), - child: ListTile( - title: Texts( - TranslationBase.of(context).complainWithoutAppo), - leading: Radio( - value: MessageType.ComplaintWithoutAppointment, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => setMessageDialogType(MessageType.Question), - child: ListTile( - title: Texts(TranslationBase.of(context).question), - leading: Radio( - value: MessageType.Question, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => - setMessageDialogType(MessageType.Compliment), - child: ListTile( - title: Texts(TranslationBase.of(context).compliment), - leading: Radio( - value: MessageType.Compliment, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => - setMessageDialogType(MessageType.Suggestion), - child: ListTile( - title: Texts(TranslationBase.of(context).suggestion), - leading: Radio( - value: MessageType.Suggestion, - groupValue: messageTypeDialog, - activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => - setMessageDialogType(value), - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Divider( - height: 2.5, - color: Colors.grey[500], - ), - SizedBox( - height: 5, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel, - color: Theme.of(context).primaryColor, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(messageTypeDialog); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - )), - ], - ) - ], - ), - ), - ], - ), - ); - } -} +} \ No newline at end of file diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 7541855f..15e3e3dd 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -1,15 +1,22 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.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/button.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/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.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 StatusFeedbackPage extends StatefulWidget { @override @@ -17,117 +24,245 @@ class StatusFeedbackPage extends StatefulWidget { } class _StatusFeedbackPageState extends State { + String countryCode = '966'; + String mobileNo = ""; + TextEditingController complainNumberController = TextEditingController(); + StatusType statusType = StatusType.ComplaintNumber; + int selectedStatusIndex = 3; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCOC(), + allowAny: true, + onModelReady: (model) { + model.cOCItemList.clear(); + if (projectViewModel.isLogin) model.getCOC(); + }, builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, - body: model.cOCItemList.isNotEmpty - ? Container( - margin: EdgeInsets.only( - top: 8.0, left: 8.0, right: 8.0, bottom: 80), - padding: EdgeInsets.all(15.0), - child: ListView.builder( - itemCount: model.cOCItemList.length, - itemBuilder: (context, index) => InkWell( - onTap: () { - gotodetails(model.cOCItemList[index]); - }, - child: Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.white, + body: Column( + children: [ + Expanded( + child: projectViewModel.isLogin + ? model.cOCItemList.isNotEmpty + ? listData(model.cOCItemList, projectViewModel.isArabic, true) + : Center( + child: Column( + children: [ + SizedBox( + height: MediaQuery.of(context).size.height * 0.4, + ), + Image.asset( + 'assets/images/comments.png', + width: 80, + height: 80, + ), + SizedBox( + height: 15, + ), + Text( + TranslationBase.of(context).noSearchResult, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff2B353E), + ), + ), + ], + ), + ) + : SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectSearchCriteria, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), - margin: EdgeInsets.all(4), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, + SizedBox(height: 21), + InkWell( + onTap: () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).complaintNumber, 3), + RadioSelectionDialogModel(TranslationBase.of(context).fileNumber, 1), + RadioSelectionDialogModel(TranslationBase.of(context).identificationNumber, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: selectedStatusIndex, + onValueSelected: (index) { + selectedStatusIndex = index; + setState(() { + if (index == 3) { + statusType = StatusType.ComplaintNumber; + } else if (index == 1) { + statusType = StatusType.FileNumber; + } else { + statusType = StatusType.IdentificationNumber; + } + }); + }, ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - '${model.cOCItemList[index].cOCTitle}'), - Texts( - TranslationBase.of(context).number + - ' : ${model.cOCItemList[index].itemID}', - variant: 'overline', - ), - ], - ), - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - '${model.cOCItemList[index].status}'), - Texts( - '${model.cOCItemList[index].date}', - variant: 'overline', - ), - ], - ), - ), - ], + ); + }, + child: Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), - Texts('${model.cOCItemList[index].formType}'), - Divider( - height: 4.5, - color: Colors.grey[500], - ) - ], + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getSelected(context), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff2B353E), + ), + ), + Icon( + Icons.keyboard_arrow_down, + size: 22, + color: Colors.grey, + ) + ], + ), ), ), - ))), - ) - : Container( - child: Center( - child: Column( - children: [ - SizedBox( - height: MediaQuery.of(context).size.height * 0.4, - ), - Image.asset( - 'assets/images/comments.png', - width: 80, - height: 80, + SizedBox(height: 12), + Directionality( + textDirection: TextDirection.ltr, + child: inputWidget( + statusType == StatusType.ComplaintNumber + ? TranslationBase.of(context).enterComplainNumber + : (statusType == StatusType.FileNumber ? TranslationBase.of(context).enterfileNumber : TranslationBase.of(context).enterIdentificationNumber), + "", + complainNumberController, + isInputTypeNum: true)), + SizedBox(height: 12), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + countryCode = value; + }); + }), + if (model.cOCItemList.length > 0) listData(model.cOCItemList, projectViewModel.isArabic, false), + ], ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).noSearchResult), - ], - ), + ), + ), + if (!projectViewModel.isLogin) + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).search, + projectViewModel.isLogin || (mobileNo.length < 9) || (complainNumberController.text.isEmpty) + ? null + : () { + model.searchFeedback(countryCode, mobileNo, selectedStatusIndex, complainNumberController.text).then((value) { + if (model.state == ViewState.ErrorLocal) { + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: model.error); + }); + } else {} + }); + }, + disabledColor: Colors.grey, ), ), - bottomSheet: Container( - height: 80, - width: double.infinity, - padding: EdgeInsets.all(15.0), - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - child: SecondaryButton( - label: TranslationBase.of(context).search, - textColor: Colors.white, - disabled: true, - onTap: () {}, + ], + ), + ), + ); + } + + Widget listData(List cOCItemList, bool isArabic, bool isLogin) { + return ListView.builder( + padding: isLogin ? EdgeInsets.all(21) : null, + itemCount: cOCItemList.length, + shrinkWrap: isLogin ? false : true, + physics: isLogin ? null : NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => InkWell( + onTap: () { + // sss + }, + child: Container( + margin: EdgeInsets.only(top: 12), + decoration: BoxDecoration( + color: (cOCItemList[index].statusId==7||cOCItemList[index].statusId==8)?CustomColors.accentColor:(cOCItemList[index].statusId==10||cOCItemList[index].statusId==6||cOCItemList[index].statusId==9)?CustomColors.green:CustomColors.orange, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Text(cOCItemList[index].formType.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))), + MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), + Text(cOCItemList[index].cOCTitle, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(cOCItemList[index].date.split(" ")[0], + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + Text(cOCItemList[index].date.split(" ")[1].substring(0, 4), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + ], + ), + ], ), ), ), @@ -136,8 +271,101 @@ class _StatusFeedbackPageState extends State { ); } + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + gotodetails(item) { - Navigator.pushReplacement( - context, FadePage(page: FeedbackDetails(items: item))); + Navigator.pushReplacement(context, FadePage(page: FeedbackDetails(items: item))); + } + + String getSelected(BuildContext context) { + switch (statusType) { + case StatusType.ComplaintNumber: + return TranslationBase.of(context).complaintNumber; + break; + case StatusType.FileNumber: + return TranslationBase.of(context).fileNumber; + break; + case StatusType.IdentificationNumber: + return TranslationBase.of(context).identificationNumber; + break; + } + return TranslationBase.of(context).notClassified; } } + +enum StatusType { + ComplaintNumber, + FileNumber, + IdentificationNumber, +} diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 3e8f35ed..91e953ad 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -2,29 +2,33 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart' as utils ; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/image.dart' as flutterImage; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + import 'base/base_view.dart'; + dynamic languageID; class FinalProductsPage extends StatefulWidget { final String id; final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); FinalProductsPage({this.id, this.productType = 1}); @@ -34,7 +38,9 @@ class FinalProductsPage extends StatefulWidget { class _FinalProductsPageState extends State { String id; + _FinalProductsPageState({this.id}); + String categoriseName = "Personal Care"; String appBarTitle = ""; bool styleOne = true; @@ -56,6 +62,8 @@ class _FinalProductsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { if (widget.productType == 1) { @@ -78,9 +86,7 @@ class _FinalProductsPageState extends State { } }, allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( isPharmacy: true, appBarTitle: appBarTitle, isBottomBar: true, @@ -99,8 +105,7 @@ class _FinalProductsPageState extends State { Padding( padding: EdgeInsets.all(8.0), child: Texts( - "$appBarTitle " + - TranslationBase.of(context).products, + "$appBarTitle " + TranslationBase.of(context).products, fontWeight: FontWeight.w600, ), ), @@ -126,7 +131,7 @@ class _FinalProductsPageState extends State { styleTwo = true; styleIcon = Icon( Icons.auto_awesome_mosaic, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } else { @@ -134,7 +139,7 @@ class _FinalProductsPageState extends State { styleTwo = false; styleIcon = Icon( Icons.widgets_sharp, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } @@ -154,29 +159,21 @@ class _FinalProductsPageState extends State { ? Expanded( child: model.finalProducts.length > 0 ? Container( - height: MediaQuery.of(context).size.height * - 3.90, + height: MediaQuery.of(context).size.height * 3.90, child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 1.0, ), itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: - model.finalProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, + color: model.finalProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, elevation: 0, shape: Border( right: BorderSide( @@ -202,160 +199,80 @@ class _FinalProductsPageState extends State { ), child: Container( decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: Radius.circular( - 110.0), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), ), color: Colors.white, ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ Container( - margin: EdgeInsets - .fromLTRB(0, 16, - 0, 0), - alignment: Alignment - .center, - child: - Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - index] - .images[0] - .thumb + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.finalProducts[index].images.isNotEmpty + ? model.finalProducts[index].images[0].thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 2.8 - : 0, - padding: - EdgeInsets.all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: model - .finalProducts[ - index] - .rxMessage != - null + child: model.finalProducts[index].rxMessage != null ? Texts( - languageID == - 'ar' - ? model - .finalProducts[ - index] - .rxMessagen - : model - .finalProducts[index] - .rxMessage, - color: Colors - .white, - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight - .w600, + projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w600, ) : Texts(""), ), ], ), Container( - margin: EdgeInsets - .symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .finalProducts[ - index] - .discountName != - null) + if (model.finalProducts[index].discountName != null) Container( - width: double - .infinity, + width: double.infinity, height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), + decoration: BoxDecoration( + color: Color(0xff5AB145), ), child: Center( child: Texts( - model - .finalProducts[ - index] - .discountName, - regular: - true, - color: Colors - .white, - fontSize: - 10.4, + model.finalProducts[index].discountName, + regular: true, + color: Colors.white, + fontSize: 10.4, ), ), ), - Texts( - model - .finalProducts[ - index] - .name, + Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name, +// model.finalProducts[index].name, regular: true, fontSize: 12, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: - 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.finalProducts[index].price}", bold: true, @@ -364,21 +281,26 @@ class _FinalProductsPageState extends State { ), Row( children: [ - StarRating( - totalAverage: model.finalProducts[index].approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()) - .toDouble() - : 0, - forceStars: - true), +// StarRating( +// totalAverage: model.finalProducts[index].approvedRatingSum > 0 +// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model.finalProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), Texts( "(${model.finalProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), @@ -393,9 +315,7 @@ class _FinalProductsPageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.finalProducts[ - index]), + page: ProductDetailPage(model.finalProducts[index]), )), }, )); @@ -404,10 +324,8 @@ class _FinalProductsPageState extends State { ) : Container( child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Align( alignment: Alignment.center, @@ -431,12 +349,10 @@ class _FinalProductsPageState extends State { : Expanded( child: model.finalProducts.length > 0 ? Container( - height: MediaQuery.of(context).size.height * - 5.0, + height: MediaQuery.of(context).size.height * 5.0, child: ListView.builder( itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -446,12 +362,9 @@ class _FinalProductsPageState extends State { Column( children: [ Container( - decoration: - BoxDecoration(), + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets - .only( + padding: EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -459,26 +372,13 @@ class _FinalProductsPageState extends State { ), ), Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: Alignment - .center, - child: - Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - index] - .images[0] - .thumb + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.finalProducts[index].images.isNotEmpty + ? model.finalProducts[index].images[0].thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit - .contain, + fit: BoxFit.contain, height: 80, ), ), @@ -487,48 +387,28 @@ class _FinalProductsPageState extends State { Column( children: [ Container( - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: Texts( - model - .finalProducts[ - index] - .rxMessage != - null - ? model - .finalProducts[ - index] - .rxMessage - : "", - color: - Colors.white, + child:model.finalProducts[index].rxMessage != null + ? Texts( + projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, + color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight - .w600, - ), + fontWeight: FontWeight.w600, + ) + : Texts(""), +// Texts( +// model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w600, +// ), ), ], ), @@ -536,37 +416,24 @@ class _FinalProductsPageState extends State { ), Container( height: 100.0, - margin: - EdgeInsets.symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - model - .finalProducts[ - index] - .name, + width: MediaQuery.of(context).size.width * 0.64, + child: Texts(projectViewModel.isArabic ? model.finalProducts[index].namen : model.finalProducts[index].name, +// model.finalProducts[index].name, regular: true, fontSize: 13.2, - fontWeight: - FontWeight.w500, + fontWeight: FontWeight.w500, maxLines: 5, ), ), @@ -574,11 +441,7 @@ class _FinalProductsPageState extends State { height: 8.0, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.finalProducts[index].price}", bold: true, @@ -587,72 +450,51 @@ class _FinalProductsPageState extends State { ), Row( children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum.toDouble() / - model.finalProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), +// StarRating( +// totalAverage: model.finalProducts[index].approvedRatingSum > 0 +// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model.finalProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), Texts( "(${model.finalProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), ], ), ), - widget.authenticatedUserObject - .isLogin + widget.authenticatedUserObject.isLogin ? Container( child: IconButton( icon: Icon( - Icons - .shopping_cart, + Icons.shopping_cart, size: 18, - color: - Colors.blue, + color: CustomColors.green, ), - onPressed: - () async { - if (model - .finalProducts[ - index] - .rxMessage == - null) { - GifLoaderDialogUtils - .showMyDialog( - context); - await addToCartFunction( - 1, - model - .finalProducts[ - index] - .id); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.push( - context, - FadePage( - page: - CartOrderPage())); + onPressed: () async { + if (model.finalProducts[index].rxMessage == null) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.finalProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + // Navigator.push(context, FadePage(page: CartOrderPage())); + utils.Utils.navigateToCartPage(); + + } else { - AppToast.showErrorToast( - message: TranslationBase.of( - context) - .needPrescription); + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } // }), @@ -665,9 +507,7 @@ class _FinalProductsPageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.finalProducts[ - index]), + page: ProductDetailPage(model.finalProducts[index]), )), }, ); @@ -675,10 +515,8 @@ class _FinalProductsPageState extends State { ) : Container( child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Align( alignment: Alignment.center, @@ -707,6 +545,6 @@ class _FinalProductsPageState extends State { addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } } diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index 20e17593..8272f0c2 100644 --- a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -1,7 +1,8 @@ import 'dart:io'; + +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -10,17 +11,13 @@ class AttachInsuranceCardImageDialog extends StatefulWidget { final String fileNo; final Function(File file, String image) image; - const AttachInsuranceCardImageDialog( - {Key key, this.name, this.fileNo, this.image}) - : super(key: key); + const AttachInsuranceCardImageDialog({Key key, this.name, this.fileNo, this.image}) : super(key: key); @override - _AttachInsuranceCardImageDialogState createState() => - _AttachInsuranceCardImageDialogState(); + _AttachInsuranceCardImageDialogState createState() => _AttachInsuranceCardImageDialogState(); } -class _AttachInsuranceCardImageDialogState - extends State { +class _AttachInsuranceCardImageDialogState extends State { @override void initState() { super.initState(); @@ -36,19 +33,41 @@ class _AttachInsuranceCardImageDialogState Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Texts(TranslationBase.of(context).attachInsuraceImage), + Text( + TranslationBase.of(context).attachInsuraceImage, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), Divider(), - Texts(widget.name), + Padding( + padding: const EdgeInsets.only(left: 8, right: 8), + child: Text( + widget.name, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.48, + ), + ), + ), SizedBox( height: 3, ), - Texts(TranslationBase.of(context).fileNo + " " + widget.fileNo), + Text( + TranslationBase.of(context).fileNo + " " + widget.fileNo, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.48, + ), + ), SizedBox( height: 5.0, ), InkWell( onTap: () { - ImageOptions.showImageOptions(context, (String image,File file) { + ImageOptions.showImageOptions(context, (String image, File file) { setState(() { this.image = image; this.file = file; @@ -57,18 +76,18 @@ class _AttachInsuranceCardImageDialogState }, child: image == null ? Padding( - padding: const EdgeInsets.all(18.0), - child: Container( + padding: const EdgeInsets.all(18.0), + child: Container( width: double.maxFinite, height: 250, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - border: Border.all(color: Colors.grey, width: 1.5)), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(2), border: Border.all(color: Colors.grey, width: 1.5)), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment., + // mainAxisAlignment: MainAxisAlignment., children: [ - SizedBox(height: 25,), + SizedBox( + height: 25, + ), Icon( Icons.camera_enhance_rounded, size: 85, @@ -77,17 +96,24 @@ class _AttachInsuranceCardImageDialogState mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.attach_file), - Texts(TranslationBase.of(context).selectAttachment.toUpperCase()) + Text( + TranslationBase.of(context).selectAttachment.toUpperCase(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ) ], ), ], ), ), - ) + ) : Image.file( file, fit: BoxFit.fill, - height: 250, + height: 250, ), ), SizedBox( @@ -106,9 +132,14 @@ class _AttachInsuranceCardImageDialogState padding: const EdgeInsets.all(8.0), child: Container( child: Center( - child: Texts( + child: Text( TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + color: Colors.red, + ), ), ), ), @@ -124,15 +155,23 @@ class _AttachInsuranceCardImageDialogState flex: 1, child: InkWell( onTap: () { - Navigator.pop(context); - widget.image(file, image); + if(file != null && image != null) { + Navigator.pop(context); + widget.image(file, image); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noInsuranceCardAttached); + } }, child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, + child: Text( + TranslationBase.of(context).ok.toUpperCase(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), )), ), ), diff --git a/lib/pages/insurance/insurance_approval_detail_screen.dart b/lib/pages/insurance/insurance_approval_detail_screen.dart new file mode 100644 index 00000000..fa6d0f5a --- /dev/null +++ b/lib/pages/insurance/insurance_approval_detail_screen.dart @@ -0,0 +1,116 @@ +import 'package:diplomaticquarterapp/core/model/insurance/insurance_approval.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class InsuranceApprovalDetail extends StatelessWidget { + final InsuranceApprovalModel insuranceApprovalModel; + + InsuranceApprovalDetail({Key key, this.insuranceApprovalModel}) : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).insuranceApproval, + description: TranslationBase.of(context).infoApprovals, + infoList: TranslationBase.of(context).infoApprovalPoints, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Container( + padding: EdgeInsets.fromLTRB(16, 12, 16, 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + insuranceApprovalModel.approvalStatusDescption, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: insuranceApprovalModel.status == 9 ? Color(0xff359846) : Color(0xffD02127), letterSpacing: -0.4, height: 18 / 10), + ), + Text( + insuranceApprovalModel.doctorName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + SizedBox(height: 6), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LargeAvatar( + name: insuranceApprovalModel.doctorName, + url: insuranceApprovalModel.doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MyRichText(TranslationBase.of(context).clinic + ":", insuranceApprovalModel?.clinicName ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).approvalNo, insuranceApprovalModel?.approvalNo.toString() ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), + SizedBox(height: 6), + MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", + projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", + projectViewModel.isArabic), + ], + ), + ), + ], + ), + SizedBox(height: 21), + Table(columnWidths: { + 0: FlexColumnWidth(1.8), + 1: FlexColumnWidth(1), + 2: FlexColumnWidth(1), + }, children: [ + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).procedure), + Utils.tableColumnTitle(TranslationBase.of(context).status), + Utils.tableColumnTitle(TranslationBase.of(context).usageStatus) + ], + ), + TableRow( + children: [ + Utils.tableColumnValue(insuranceApprovalModel?.apporvalDetails?.procedureName ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(insuranceApprovalModel?.apporvalDetails?.status ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(insuranceApprovalModel?.apporvalDetails?.isInvoicedDesc ?? '', isLast: true, mProjectViewModel: projectViewModel), + ], + ), + ]) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 7283abf8..52ce35c8 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -1,14 +1,20 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; +import 'insurance_approval_detail_screen.dart'; class InsuranceApproval extends StatefulWidget { int appointmentNo; @@ -24,294 +30,144 @@ class _InsuranceApprovalState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); imagesInfo .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/0.png')); imagesInfo .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/apporvals/ar/1.png')); return BaseView( onModelReady: widget.appointmentNo != null ? (model) => model.getInsuranceApproval(appointmentNo: widget.appointmentNo) : (model) => model.getInsuranceApproval(), - builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( - isShowAppBar: true, - baseViewModel: model, - appBarTitle: TranslationBase.of(context).approvals, - description: TranslationBase.of(context).infoApprovals, - infoList: TranslationBase.of(context).infoApprovalPoints, - imagesInfo: imagesInfo, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only( - left: SizeConfig.screenWidth * 0.004, - right: SizeConfig.screenWidth * 0.004, - top: SizeConfig.screenWidth * 0.04, - ), - child: Column( - children: [ - Container( - width: double.infinity, - height: SizeConfig.screenHeight * 0.09, - color: Color(0xffEEEEEE), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Texts( - TranslationBase.of(context).totalApproval, - color: Color(0xff60688B), - fontSize: 19.0, - fontWeight: FontWeight.w600, - ), - if (model.insuranceApproval.length > 0) - Container( - width: 60, - height: 40, - decoration: BoxDecoration(color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(19.0)), - child: Center( - child: Texts( - model.insuranceApproval[0].unUsedCount.toString(), - color: Colors.white, - fontSize: 17.0, - ), - )) - ], - )), - ...List.generate(model.insuranceApproval.length, (index) { - print(model.insuranceApproval[index].isLiveCareAppointment); - return RoundedContainer( - backgroundColor: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ExpansionTile( - title: Container( - //height: 120.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.insuranceApproval[index].isLiveCareAppointment - ? sideBadge(TranslationBase.of(context).liveCare, 0xffA9A089) - : model.insuranceApproval[index].isInOutPatient - ? sideBadge(TranslationBase.of(context).outpatient, 0xff505a5d) - : sideBadge(TranslationBase.of(context).inPatient, 0xffb8372c), - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0), - child: Texts( - model.insuranceApproval[index].clinicName, - fontSize: 20.0, - color: Color(0xff60686B), - fontWeight: FontWeight.w600, - ), - ), - Texts( - model.insuranceApproval[index].doctorName, - fontSize: 17.0, + builder: (BuildContext _context, InsuranceViewModel model, Widget child) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + baseViewModel: model, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + description: TranslationBase.of(context).infoApprovals, + infoList: TranslationBase.of(context).infoApprovalPoints, + imagesInfo: imagesInfo, + body: model.insuranceApproval.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (_, index) { + Color _patientStatusColor; + String _patientStatusString; + + if (model.insuranceApproval[index].isLiveCareAppointment) { + _patientStatusColor = Color(0xff2E303A); + _patientStatusString = TranslationBase.of(context).liveCare.capitalizeFirstofEach; + } else if (!model.insuranceApproval[index].isInOutPatient) { + _patientStatusColor = Color(0xffD02127); + _patientStatusString = TranslationBase.of(context).inPatient.capitalizeFirstofEach; + } else { + _patientStatusString = TranslationBase.of(context).outpatient.capitalizeFirstofEach; + _patientStatusColor = Color(0xffa9a089); + } + return InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceApprovalDetail(insuranceApprovalModel: model.insuranceApproval[index]))); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: _patientStatusColor), + child: Row( + children: [ + SizedBox( + width: 16, + child: RotatedBox( + quarterTurns: 3, + child: Text( + _patientStatusString, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), ), - ], + ), ), - ), - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Texts( - TranslationBase.of(context).approvalNo, - fontSize: 18.0, - ), - Texts( - model.insuranceApproval[index].approvalNo.toString(), - fontSize: 18.0, - fontWeight: FontWeight.w600, - ), - ], - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), - Row( - children: [ - Texts( - TranslationBase.of(context).procedureStatus, - fontSize: 17.5, - ), - SizedBox( - width: 12, - ), - Texts( - model.insuranceApproval[index].approvalStatusDescption, - fontWeight: FontWeight.w600, - fontSize: 17.5, - ), - ], - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), - Row( - children: [ - Texts( - TranslationBase.of(context).unusedCount, - fontSize: 17.5, - ), - Texts( - model.insuranceApproval[index].unUsedCount.toString(), - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), - ], - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), -// Text( -// 'Company Name: ' + -// model.insuranceApproval[index] -// .companyName == -// null -// ? '000' -// : model -// .insuranceApproval[index].companyName, -// style: TextStyle( -// fontSize: 17.5, -// fontWeight: FontWeight.w600), -// ), - Texts( - TranslationBase.of(context).companyName, - fontWeight: FontWeight.w600, - fontSize: 17.5, - ), - - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), - Row( - children: [ - Texts( - TranslationBase.of(context).receiptOn, - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), - Texts( - convertDateFormat(model.insuranceApproval[index].receiptOn), - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), - ], - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), - Row( - children: [ - Texts( - TranslationBase.of(context).expiryDate, - fontSize: 17.5, - fontWeight: FontWeight.w600, - ), - Texts( - convertDateFormat(model.insuranceApproval[index].expiryDate), - fontSize: 17.5, + Expanded( + child: Container( + padding: EdgeInsets.fromLTRB(12, 10, 12, 10), + decoration: BoxDecoration( + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10.0), + topRight: Radius.circular(10.0), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.insuranceApproval[index].approvalStatusDescption, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: model.insuranceApproval[index].status == 9 ? Color(0xff359846) : Color(0xffD02127), + letterSpacing: -0.4, + height: 18 / 10), + ), + Text( + model.insuranceApproval[index].doctorName, + style: TextStyle( + fontSize: 16, fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, ), - ], - ), - Divider( - color: Colors.black, - height: 55.0, - thickness: 1.2, - ), - IntrinsicHeight( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Column( - children: [ - Text(TranslationBase.of(context).procedureName), - Padding( - padding: EdgeInsets.only(top: SizeConfig.heightMultiplier * 3.0), - child: Text( - model.insuranceApproval[index].apporvalDetails?.procedureName ?? '', - style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15.5), - ), - ), - ], - ), - ), - VerticalDivider( - width: 10.0, - thickness: 1.2, - color: Colors.black, + ), + SizedBox(height: 6), + Row( + children: [ + LargeAvatar( + name: model.insuranceApproval[index].doctorName, + url: model.insuranceApproval[index].doctorImageURL, + width: 48, + height: 48, ), + SizedBox(width: 12), Expanded( - flex: 1, child: Column( - children: [ - Text(TranslationBase.of(context).procedureStatus), - Padding( - padding: EdgeInsets.only(top: SizeConfig.heightMultiplier * 3.0), - child: Text( - model.insuranceApproval[index].apporvalDetails?.status ?? '', - style: TextStyle(fontSize: 17.5, fontWeight: FontWeight.w600), - ), - ), + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", + projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), ], ), ), - VerticalDivider( - width: 2.3, - thickness: 1.2, - color: Colors.black, - ), - Expanded( - flex: 1, - child: Column( - children: [ - Text(TranslationBase.of(context).usageStatus), - Padding( - padding: EdgeInsets.only(top: SizeConfig.heightMultiplier * 3.0), - child: Text( - model.insuranceApproval[index].apporvalDetails?.isInvoicedDesc ?? '', - style: TextStyle(fontWeight: FontWeight.w600, fontSize: 17.5), - ), - ), - ], + Container( + height: 48, + alignment: Alignment.bottomRight, + child: Icon( + Icons.arrow_forward, + color: Color(0xff2E303A), ), - ), + ) ], - ), - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 1.0, - ), - ], + ) + ], + ), ), ), ], ), - ], - ), - ); - }), - ], - ), - ), - ), - ), + ), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 12), + itemCount: model.insuranceApproval.length) + : getNoDataWidget(context)), ); } diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index be87f5b8..b84b63d3 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -1,16 +1,16 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -45,142 +45,156 @@ class _InsuranceCardState extends State { description: TranslationBase.of(context).infoInsuranceCards, infoList: TranslationBase.of(context).infoInsuranceCardsPoints, imagesInfo: imagesInfo, - appBarIcons: [ - model.isLogin ? IconButton( - padding: EdgeInsets.zero, - icon: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), - margin: EdgeInsets.only(right: 8), - padding: EdgeInsets.only(right: 4, left: 4), - child: Image.asset( - 'assets/images/medical/insurance_update_icon_.png', - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, - ), - ), - onPressed: () { - Navigator.push(context, FadePage(page: InsuranceUpdate())); - }, - ) : Container(), - ], + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + }, + backgroundColor: CustomColors.accentColor, + label: Text(TranslationBase.of(context).update, style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.bold + )), + ), body: Container( - margin: EdgeInsets.only(left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04), - child: ListView.builder( - itemCount: model.insurance == null ? 0 : model.insurance.length, - itemBuilder: (BuildContext context, int index) { - return RoundedContainer( - backgroundColor: Colors.white, + child: ListView.separated( + itemCount: model.insurance == null ? 0 : model.insurance.length, + itemBuilder: (BuildContext context, int index) { + return Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 10, + right: 10, + top: index == 0 ? 10 : 0, + bottom: index == model.insurance.length - 1 ? 100 : 0, + ), + child: Container( + decoration: cardRadius(12), child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ExpansionTile( - title: Container( - height: 65.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 15.0), - child: Texts( - model.insurance[index].groupName, - ), + children: [ + Text( + model.insurance[index].groupName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + mHeight(8), + Text( + TranslationBase.of(context).companyName + model.insurance[index].companyName, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48), + ), + Divider( + thickness: 2, + color: Colors.black, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).category, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + Text( + model.insurance[index].subCategoryDesc, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), ), ], ), - ), - children: [ - Container( - padding: EdgeInsets.all(14), - width: double.infinity, - decoration: BoxDecoration(shape: BoxShape.rectangle, border: Border.all(color: Colors.grey, width: 0.2), borderRadius: BorderRadius.all(Radius.circular(2)), boxShadow: [ - BoxShadow( - color: Colors.white70, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).expirationDate, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.insurance[index].cardValidTo)), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).status + ": ", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), ), - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).companyName + model.insurance[index].companyName, - fontSize: 20.0, - fontWeight: FontWeight.w700, - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 0.5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).category, fontSize: 18.5), Texts(model.insurance[index].subCategoryDesc, fontSize: 18.5)], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).expirationDate, fontSize: 18.5), - Texts( - convertDateFormat( - model.insurance[index].cardValidTo, - ), - fontSize: 18.5), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).status + ": ", fontSize: 18.5), - model.insurance[index].isActive == true - ? Texts(TranslationBase.of(context).activeInsurence, color: Colors.green, fontWeight: FontWeight.w900, fontSize: 17.9) - : Texts(TranslationBase.of(context).notActive, color: Colors.red, fontWeight: FontWeight.w900, fontSize: 17.9) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).patientCard, fontSize: 18.5), Texts(model.insurance[index].patientCardID, fontSize: 18.5)], - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts( - TranslationBase.of(context).policyNumber, - fontSize: 18.5, + model.insurance[index].isActive == true + ? Text( + TranslationBase.of(context).activeInsurence, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Colors.green), + ) + : Text( + TranslationBase.of(context).notActive, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + color: Colors.red, ), - Texts( - model.insurance[index].insurancePolicyNumber, - fontSize: 18.5, - ) - ]), - ], - ), - SizedBox( - height: 14.5, - ), - if (model.insurance[index].isActive == true) - Container( - color: Colors.transparent, - child: SecondaryButton( - onTap: () => {getDetails(model.insurance[index])}, - label: TranslationBase.of(context).seeDetails, - textColor: Colors.white, - ), - width: double.infinity, - ), - ], - ), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).patientCard, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + Text( + model.insurance[index].patientCardID, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).policyNumber, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ), + Text( + model.insurance[index].insurancePolicyNumber, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), + ) + ], ), ], ), + if (model.insurance[index].isActive == true) + SizedBox( + height: 8.5, + ), + if (model.insurance[index].isActive == true) + Container( + color: Colors.transparent, + child: SecondaryButton( + onTap: () => { + getDetails(model.insurance[index]), + }, + label: TranslationBase.of(context).seeDetails, + textColor: Colors.white, + ), + width: double.infinity, + ), ], ), ), - ); - }), + ), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mHeight(8); + }, + ), ), ), ); diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 87035e0c..f765d9b7 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -3,15 +3,18 @@ import 'package:diplomaticquarterapp/core/model/insurance/Insurance_card_details import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.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/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import 'AttachInsuranceCardImageDialog.dart'; class InsuranceCardUpdateDetails extends StatelessWidget { @@ -20,13 +23,7 @@ class InsuranceCardUpdateDetails extends StatelessWidget { final int patientID; final String name; - const InsuranceCardUpdateDetails( - {Key key, - this.insuranceCardDetailsModel, - this.patientIdentificationID, - this.patientID, - this.name}) - : super(key: key); + const InsuranceCardUpdateDetails({Key key, this.insuranceCardDetailsModel, this.patientIdentificationID, this.patientID, this.name}) : super(key: key); @override Widget build(BuildContext context) { @@ -36,290 +33,323 @@ class InsuranceCardUpdateDetails extends StatelessWidget { isShowAppBar: true, isShowDecPage: false, appBarTitle: TranslationBase.of(context).cardDetail, - body: SingleChildScrollView( - child: Column( - children: [ - ...List.generate( - insuranceCardDetailsModel.length, - (index) => Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - width: double.maxFinite, - margin: EdgeInsets.only(left: 8, right: 8, top: 8), - height: projectViewModel.isArabic ? 320 : 240, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: Color(0xff515B5D), - ), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - insuranceCardDetailsModel[index].memberID, - textScaleFactor: 2.1, - style: TextStyle( - color: Colors.white, - letterSpacing: 8.0, - fontWeight: FontWeight.w400, - fontSize: 15), - ), - SizedBox( - height: 5, - ), - Texts( - insuranceCardDetailsModel[index].companyName, - fontSize: 14, - color: Colors.white, - ), - SizedBox( - height: 25, - ), - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).policyHolder, - color: Colors.white, - fontSize: 14, - ), - Texts( - insuranceCardDetailsModel[index] - .memberName, - color: Colors.white, - fontSize: 14, - ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Texts(TranslationBase.of(context).policyNo, - color: Colors.white), - Texts( - insuranceCardDetailsModel[index] - .policyNumber, - color: Colors.white), - ], - ), - ), - ], - ), - SizedBox( - height: 25, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Container( + width: double.maxFinite, + // height: projectViewModel.isArabic ? 320 : 240, + // decoration: containerRadius(CustomColors.accentColor, 12), + child: Container( + decoration: cardRadius(12,color: CustomColors.accentColor), + + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context) - .expiryDateTitle, - color: Colors.white, - fontSize: 12, + Text( + insuranceCardDetailsModel[index].memberID, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 16, + ), ), - Texts( - insuranceCardDetailsModel[index].dOB, - color: Colors.white, - fontSize: 12, + SizedBox( + height: 2, ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Texts( - TranslationBase.of(context).classTitle, - color: Colors.white, - fontSize: 12, + Text( + insuranceCardDetailsModel[index].companyName, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 14, + ), ), - Texts( - insuranceCardDetailsModel[index] - .subCategory, - color: Colors.white, - fontSize: 12, + SizedBox( + height: 14, ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Texts( - TranslationBase.of(context).approval, - color: Colors.white, - fontSize: 12, + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).policyHolder, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + Text( + insuranceCardDetailsModel[index].memberName, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontSize: 12, + ), + ), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).policyNo, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + Text( + insuranceCardDetailsModel[index].policyNumber, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontSize: 12, + ), + ), + ], + ), + ], ), - Texts( - insuranceCardDetailsModel[index] - .approvalLimit - .toString(), - color: Colors.white, - fontSize: 12, + SizedBox( + height: 14, ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).expiryDateTitle, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + Text( + insuranceCardDetailsModel[index].effectiveTo, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontSize: 12, + ), + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Text( + TranslationBase.of(context).classTitle, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + Text( + insuranceCardDetailsModel[index].subCategory, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontSize: 12, + ), + ), + ], + ), + ), + Expanded( + child: Column( + children: [ + Text( + TranslationBase.of(context).approval, + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + fontSize: 12, + ), + ), + Text( + insuranceCardDetailsModel[index].approvalLimit.toString(), + style: TextStyle( + color: Colors.white, + letterSpacing: -0.48, + fontSize: 12, + ), + ), + ], + ), + ), + ], + ) ], ), ), - ], - ) - ], + ), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + itemCount: insuranceCardDetailsModel.length, ), - ), - ), - ), - ), - if(insuranceCardDetailsModel.isEmpty) - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB( - 8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - flex: 3, + if (insuranceCardDetailsModel.isEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: Container( + + decoration: cardRadius(12), child: Container( - margin: EdgeInsets.only( - top: 2.0, - left: 10.0, - right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ - Texts( - name, - fontSize: 14, - color: Colors.black, - fontWeight: - FontWeight.w500, + Expanded( + child: Container( + margin: EdgeInsets.only(top: 2.0, left: 10.0, right: 20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Text( + TranslationBase.of(context).fileno + ": " + patientID.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ) + ], + ), + ), ), - SizedBox( - height: 8, - ), - Texts( - TranslationBase.of( - context) - .fileno + - ": " +patientID.toString(), - fontSize: 14, - color: Colors.black, - fontWeight: - FontWeight.w500, - ) ], ), ), ), - ], - ), - ), - ), - ), - SizedBox(height: 150,), - Image.asset('assets/images/no-data-found.png',width: 80,height: 80,), - SizedBox(height: 8,), - Texts(TranslationBase.of(context).noDataAvailable) - ], - ) - ], - ), - ), - bottomSheet: Container( - width: double.infinity, - height:insuranceCardDetailsModel.isEmpty? MediaQuery.of(context).size.height * 0.14:MediaQuery.of(context).size.height * 0.21, - child: Container( - margin: EdgeInsets.only(left: 8, right: 8), - child: Column( - children: [ - SizedBox( - height: 8, - ), - if(insuranceCardDetailsModel.isEmpty) - SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).scanNow.toUpperCase(), - color: Theme.of(context).primaryColor, - small: true, - onTap: () async { - confirmAttachInsuranceCardImageDialogDialog( - context: context, - name: name, - fileNo: patientID.toString(), - model: model); - }, + ), + SizedBox( + height: 150, + ), + Image.asset( + 'assets/images/no-data-found.png', + width: 80, + height: 80, + ), + SizedBox( + height: 8, + ), + Text( + TranslationBase.of(context).noDataAvailable, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ) + ], + ) + ], ), - if(insuranceCardDetailsModel.isNotEmpty) - SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).agree.toUpperCase(), - color: Theme.of(context).primaryColor, - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.uploadInsuranceCard( - patientIdentificationID: patientIdentificationID, - patientID: patientID); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).requestSent); - } - }, - ),if(insuranceCardDetailsModel.isNotEmpty) - SizedBox( - height: 12, - ),if(insuranceCardDetailsModel.isNotEmpty) - SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).disagree.toUpperCase(), - color: Colors.grey[800], - onTap: () async { - confirmAttachInsuranceCardImageDialogDialog( - context: context, - name: name, - fileNo: patientID.toString(), - model: model); - }, - ) - ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + if (insuranceCardDetailsModel.isEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).scanNow.toUpperCase(), + color: CustomColors.accentColor, + small: true, + onTap: () async { + confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + }, + ), + if (insuranceCardDetailsModel.isNotEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).agree.toUpperCase(), + color: CustomColors.accentColor, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID).then((res) { + print(res); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); + print(err); + }); + + }, + ), + if (insuranceCardDetailsModel.isNotEmpty) + SizedBox( + height: 12, + ), + if (insuranceCardDetailsModel.isNotEmpty) + SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).disagree.toUpperCase(), + color: Colors.grey[800], + onTap: () async { + confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); + }, + ) + ], + ), ), - ), + ], ), ), ); } - void confirmAttachInsuranceCardImageDialogDialog( - {BuildContext context, - String name, - String fileNo, - InsuranceViewModel model}) { + void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, InsuranceViewModel model}) { showDialog( context: context, child: AttachInsuranceCardImageDialog( @@ -327,17 +357,12 @@ class InsuranceCardUpdateDetails extends StatelessWidget { name: name, image: (file, image) async { GifLoaderDialogUtils.showMyDialog(context); - await model.uploadInsuranceCard( - patientIdentificationID: patientIdentificationID, - patientID: patientID, - image: image); + await model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID, image: image); GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal || - model.state == ViewState.Error) { + if (model.state == ViewState.ErrorLocal || model.state == ViewState.Error) { AppToast.showErrorToast(message: model.error); } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).requestSent); + AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); } Navigator.pop(context); }, diff --git a/lib/pages/insurance/insurance_details.dart b/lib/pages/insurance/insurance_details.dart index 16745e9e..807987c8 100644 --- a/lib/pages/insurance/insurance_details.dart +++ b/lib/pages/insurance/insurance_details.dart @@ -1,11 +1,9 @@ -import 'package:diplomaticquarterapp/config/size_config.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/others/app_scaffold_widget.dart'; -import 'package:flutter_html/flutter_html.dart'; -import 'package:html/dom.dart' as dom; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; class InsuranceCardDetails extends StatelessWidget { final String data; @@ -17,6 +15,9 @@ class InsuranceCardDetails extends StatelessWidget { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).cardDetail, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, body: Center( child: SingleChildScrollView( child: Html( diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index a391f554..22e1b03e 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -3,8 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.d 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/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,227 +16,144 @@ class InsurancePage extends StatelessWidget { InsuranceCardService _insuranceCardService = locator(); InsurancePage({Key key, this.model}) : super(key: key); + @override Widget build(BuildContext context) { return SingleChildScrollView( - child: Column( - children: [ - SizedBox( - height: 65, - ), - Container( - margin: EdgeInsets.all(10.0), - color: Colors.white, - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - if (model.user != null) - Expanded( - flex: 3, - child: Container( - margin: - EdgeInsets.only(top: 2.0, left: 10.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - model.user.firstName + " " + model.user.lastName, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - SizedBox( - height: 8, - ), - Texts( - TranslationBase.of(context).fileno + - ": " + - model.user.patientID.toString(), - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ) - ], - ), - ), - ), - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(top: 2.0), - child: Column( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: InkWell( + onTap: () { + getDetails( + setupID: '010266', + projectID: 15, + patientIdentificationID: model.user.patientIdentificationNo, + patientID: model.user.patientID, + name: model.user.firstName + " " + model.user.lastName, + context: context, + ); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, children: [ - Container( - child: SecondaryButton( - label: TranslationBase.of(context).fetchData, - small: true, - textColor: Colors.white, - onTap: () { - getDetails( - setupID: '010266', - projectID: 15, - patientIdentificationID: - model.user.patientIdentificationNo, - patientID: model.user.patientID, - name: model.user.firstName + - " " + - model.user.lastName, - context: context); - }, + if (model.user != null) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.user.firstName + " " + model.user.lastName, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Text( + TranslationBase.of(context).fileno + ": " + model.user.patientID.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ) + ], + ), ), - ), + Icon(Icons.arrow_forward), ], ), ), - ) - ], + ), + ), ), - ), - if (model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList != - null ?? - false) - ...List.generate( - model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList.length, - (index) => model.getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[index].status == - 3 - ? Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), + if (model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false) + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 + ? InkWell( + onTap: () { + getDetails( + projectID: 15, + patientIdentificationID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientIdenficationNumber, + setupID: '010266', + patientID: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID, + name: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + context: context); + }, child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 2.0, left: 10.0, right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientName, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - SizedBox( - height: 8, - ), - Texts( - TranslationBase.of(context).fileno + - ": " + - model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientID - .toString(), - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ) - ], - ), - ), - ), - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(top: 2.0), - child: Column( - children: [ - Container( - child: SecondaryButton( - label: TranslationBase.of(context) - .fetchData, - small: true, - textColor: Colors.white, - onTap: () { - getDetails( - projectID: 15, - patientIdentificationID: model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientIdenficationNumber, - setupID: '010266', - patientID: model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .responseID, - name: model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList[ - index] - .patientName, - context: context); - }, + width: double.infinity, + margin: EdgeInsets.only(top: 12.0), + child: Container( + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].patientName, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46), + ), + Text( + TranslationBase.of(context).fileno + ": " + model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].responseID.toString(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.46), ), - ), - ], + ], + ), ), - ), - ) - ], + Icon(Icons.arrow_forward), + ], + ), + ), ), ), - ), - ) - : Container()), - ], + ) + : Container(); + }, + separatorBuilder: (context, index) { + return mHeight(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3 ? 8 : 0); + }, + itemCount: model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, + ), + ], + ), ), ); } - getDetails( - {String setupID, - int projectID, - String patientIdentificationID, - int patientID, - String name, - BuildContext context}) { + getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, BuildContext context}) { GifLoaderDialogUtils.showMyDialog(context); - _insuranceCardService - .getPatientInsuranceDetails( - setupID: setupID, - projectID: projectID, - patientID: patientID, - patientIdentificationID: patientIdentificationID) - .then((value) { + _insuranceCardService.getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID).then((value) { GifLoaderDialogUtils.hideDialog(context); - if (!_insuranceCardService.hasError && - _insuranceCardService.isHaveInsuranceCard) { + if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { Navigator.push( context, FadePage( page: InsuranceCardUpdateDetails( - insuranceCardDetailsModel: - _insuranceCardService.insuranceCardDetailsList, + insuranceCardDetailsModel: _insuranceCardService.insuranceCardDetailsList, patientID: patientID, patientIdentificationID: patientIdentificationID, name: name, - ))); + ))).then((value) { + model.getInsuranceUpdated(); + }); } else { AppToast.showErrorToast(message: _insuranceCardService.error); } diff --git a/lib/pages/insurance/insurance_update_screen.dart b/lib/pages/insurance/insurance_update_screen.dart index 6c3ee61c..5b68687f 100644 --- a/lib/pages/insurance/insurance_update_screen.dart +++ b/lib/pages/insurance/insurance_update_screen.dart @@ -1,21 +1,12 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; -import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; -import 'insurance_card_update_details.dart'; +import '../base/base_view.dart'; import 'insurance_page.dart'; class InsuranceUpdate extends StatefulWidget { @@ -23,20 +14,17 @@ class InsuranceUpdate extends StatefulWidget { _InsuranceUpdateState createState() => _InsuranceUpdateState(); } -class _InsuranceUpdateState extends State - with SingleTickerProviderStateMixin { +class _InsuranceUpdateState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); + @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png')); } void dispose() { @@ -47,88 +35,75 @@ class _InsuranceUpdateState extends State Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getInsuranceUpdated(), - builder: (BuildContext context, InsuranceViewModel model, Widget child) => - AppScaffold( - appBarTitle: TranslationBase.of(context).insurCards, + builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold( + appBarTitle: TranslationBase.of(context).updateInsurCards, description: TranslationBase.of(context).infoInsurCards, infoList: TranslationBase.of(context).infoPrescriptionsPoints, imagesInfo: imagesInfo, isShowAppBar: true, isShowDecPage: true, baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(70.0), - child: Stack( - children: [ - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 1.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 5.7, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Container( + height: 45, + child: TabBar( + controller: _tabController, + isScrollable: false, + indicatorWeight: 3.0, + indicatorColor: CustomColors.accentColor, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), + unselectedLabelColor: Colors.grey, + tabs: [ + Container( + child: Center( + child: Text( + TranslationBase.of(context).updateInsuranceSubtitle, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), ), - color: Colors.white, ), + ), + Container( child: Center( - child: TabBar( - controller: _tabController, - isScrollable: true, - indicatorWeight: 4.0, - indicatorColor: Theme.of(context).primaryColor, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.symmetric( - horizontal: 13.0, vertical: 2.0), - unselectedLabelColor: Colors.grey, - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: Center( - child: Texts(TranslationBase.of(context) - .updateInsuranceSubtitle), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: Center( - child: Texts(TranslationBase.of(context).history), - ), - ), - ], + child: Text( + TranslationBase.of(context).history, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), ), ), ), - ) - ], + ], + ), ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - InsurancePage(model: model), - Container( + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + InsurancePage(model: model), + Container( + child: Padding( + padding: const EdgeInsets.all(12.0), child: ListView.builder( - itemCount: model.insuranceUpdate == null - ? 0 - : model.insuranceUpdate.length, + itemCount: model.insuranceUpdate == null ? 0 : model.insuranceUpdate.length, itemBuilder: (BuildContext context, int index) { return Container( - margin: EdgeInsets.all(10.0), child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), color: Colors.white, + elevation: 2, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + borderRadius: BorderRadius.circular(12), ), child: Container( width: MediaQuery.of(context).size.width, @@ -143,47 +118,37 @@ class _InsuranceUpdateState extends State Expanded( flex: 3, child: Container( - margin: EdgeInsets.only( - top: 2.0, - left: 10.0, - right: 20.0), + margin: EdgeInsets.only(top: 2.0, left: 10.0, right: 20.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - model.user.firstName + - " " + - model.user.lastName, - fontSize: 14, - fontWeight: FontWeight.w500, - color: Colors.black, + Text( + model.user.firstName + " " + model.user.lastName, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), SizedBox( - height: 8, + height: 4, ), - Texts( - TranslationBase.of(context) - .fileno + - ": " + - model - .insuranceUpdate[ - index] - .patientID - .toString(), - fontSize: 14, - fontWeight: FontWeight.w500, - color: Colors.black, - ), - SizedBox( - height: 8, + Text( + TranslationBase.of(context).fileno + ": " + model.insuranceUpdate[index].patientID.toString(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), - Texts( - model.insuranceUpdate[index] - .createdOn, - fontSize: 14, - fontWeight: FontWeight.w500, - color: Colors.black, + + Text( + model.insuranceUpdate[index].createdOn, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), ], ), @@ -195,19 +160,16 @@ class _InsuranceUpdateState extends State margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - Image.asset( - "assets/images/new-design/confirm_button.png", - width: 30.0, - height: 30.0), + Image.asset("assets/images/new-design/confirm_button.png", width: 30.0, height: 30.0), Container( - margin: EdgeInsets.only( - top: 13.5, left: 2.0), - child: Texts( - model.insuranceUpdate[index] - .statusDescription, - textAlign: TextAlign.center, - fontSize: 12, - color: Colors.black, + margin: EdgeInsets.only(top: 6.5, left: 2.0), + child: Text( + model.insuranceUpdate[index].statusDescription, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), ), ), ], @@ -223,10 +185,10 @@ class _InsuranceUpdateState extends State ); }), ), - ], - )) - ], - ), + ), + ], + )) + ], ), ), ); diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart new file mode 100644 index 00000000..75b9a473 --- /dev/null +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -0,0 +1,560 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/gradient_color.dart'; +import 'package:diplomaticquarterapp/models/hmg_services.dart'; +import 'package:diplomaticquarterapp/models/slider_data.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; +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/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; +import 'package:diplomaticquarterapp/theme/colors.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/floatingActionButton.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 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; +import 'dart:math' as math; + +class HomePageFragment2 extends StatefulWidget { + DashboardViewModel model; + Function onPharmacyClick, onLoginClick, onMedicalFileClick; + + HomePageFragment2(this.model, {this.onLoginClick, this.onPharmacyClick, this.onMedicalFileClick}); + + @override + _HomePageFragment2State createState() => _HomePageFragment2State(); +} + +class _HomePageFragment2State extends State { + ProjectViewModel projectViewModel; + List hmgServices = []; + List appoList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + + // getPatientAppointmentHistory1(); + // getFamilyFiles(); + } + + initialiseHmgServices(bool isLogin) { + hmgServices.clear(); + hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergency, TranslationBase.of(context).services2, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).reachUs, TranslationBase.of(context).findUs, "assets/images/new/reach_us.svg", isLogin)); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + initialiseHmgServices(false); + var appoCountProvider = Provider.of(context); + List myMedicalList = Utils.myMedicalListHomePage(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); + return Container( + width: double.infinity, + child: Column( + children: [ + projectViewModel.isLogin + ? AspectRatio( + aspectRatio: 2.6, + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6), + child: InkWell( + onTap: () { + widget.onMedicalFileClick(); + }, + child: LoggedSliderView( + projectViewModel, + new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, + "", bannerColor[0].darkColor, bannerColor[0].lightColor), + widget.model, + ), + ), + ), + ) + : AspectRatio( + aspectRatio: 2.6, + child: Container( + margin: EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6), + child: SliderView( + onLoginClick: () { + widget.onLoginClick(); + // navigateTo(context, CallHomePage()); + }, + ), + // height: MediaQuery.of(context).size.width / 2.6, + ), + ), + projectViewModel.isLogin + ? Column( + children: [ + Padding( + padding: projectViewModel.isArabic + ? EdgeInsets.only( + right: 20, + left: 8, + ) + : EdgeInsets.only( + left: 20, + right: 8, + ), + child: Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).myMedicalFile, + style: TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.96, + height: 19 / 16, + ), + ), + ), + FlatButton( + onPressed: () { + widget.onMedicalFileClick(); + // navigateTo(context, MedicalProfilePageNew()); + }, + child: Text( + TranslationBase.of(context).viewMedicalFile, + style: TextStyle( + color: CustomColors.accentColor, + fontSize: 12, + letterSpacing: -0.72, + height: 23 / 12, + ), + ), + ), + ], + ), + ), + mHeight(4), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.26, + child: ListView.separated( + itemCount: 5, + padding: EdgeInsets.zero, + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + return projectViewModel.isArabic + ? Container( + child: myMedicalList[index], + width: MediaQuery.of(context).size.width * 0.26, + height: MediaQuery.of(context).size.width * 0.26, + margin: EdgeInsets.only(left: index == 4 ? 20 : 0, right: index == 0 ? 20 : 0), + ) + : Container( + child: myMedicalList[index], + width: MediaQuery.of(context).size.width * 0.26, + height: MediaQuery.of(context).size.width * 0.26, + margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: index == 4 ? 20 : 0), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mWidth(12); + }, + ), + ), + ], + ) + : Container(), + mHeight(16), + Column( + children: [ + Divider( + height: 1, + color: Color(0xFFC7C7C7), + ), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.3, + padding: EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + color: Colors.white, + child: Row( + children: [ + offersButton(), + mWidth(10), + hmgButton(), + ], + ), + ), + Divider( + height: 1, + color: Color(0xFFC7C7C7), + ), + ], + ), + mHeight(12), + Column( + children: [ + Padding( + padding: projectViewModel.isArabic + ? const EdgeInsets.only( + left: 8, + right: 20, + ) + : const EdgeInsets.only( + left: 20, + right: 8, + ), + child: Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).hMGService, + style: TextStyle( + color: Colors.black, + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.96, + height: 19 / 16, + ), + ), + ), + FlatButton( + onPressed: () { + Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); + }, + child: Text( + TranslationBase.of(context).viewAllServices, + style: TextStyle( + color: CustomColors.accentColor, + fontSize: 12, + letterSpacing: -0.72, + height: 23 / 12, + ), + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 0, + ), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServicesView(hmgServices[index], index); + }, + ), + ), + ], + ), + mHeight(140), + ], + ), + ); + } + + Widget offersButton() { + return Expanded( + flex: 1, + child: InkWell( + onTap: () { + AuthenticatedUser user = projectViewModel.user; + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(user))); + }, + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + // color: Color(0xFF2B353E), + decoration: containerRadius(Color(0xFF2B353E), 20), + ), + Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: projectViewModel.isArabic + ? containerBottomRightRadiusWithGradientForAr(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor) + : containerBottomRightRadiusWithGradient(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + SvgPicture.asset( + "assets/images/new/strips.svg", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + ), + ], + ), + ), + projectViewModel.isArabic + ? Positioned( + left: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/logo.svg", + height: MediaQuery.of(context).size.width * 0.14, + ), + ), + ) + : Positioned( + right: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/logo.svg", + height: MediaQuery.of(context).size.width * 0.14, + ), + ), + ), + projectViewModel.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + TranslationBase.of(context).newDes, + style: TextStyle( + color: Colors.white, + fontSize: 9, + height: 0.8, + letterSpacing: -0.27, + ), + ), + ), + ), + ) + : Positioned( + left: -16, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + TranslationBase.of(context).newDes, + style: TextStyle( + color: Colors.white, + fontSize: 9, + letterSpacing: -0.27, + height: 1.2, + ), + ), + ), + ), + ), + Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 20 : 25, right: projectViewModel.isArabic ? 25 : 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + mFlex(3), + AutoSizeText( + TranslationBase.of(context).offersdiscount, + maxLines: 1, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.75, + height: 1, + ), + ), + projectViewModel.isArabic ? mHeight(4) : Container(), + Text( + TranslationBase.of(context).explore, + style: TextStyle( + color: Colors.black, + fontSize: 9, + fontWeight: FontWeight.w600, + letterSpacing: -0.27, + height: projectViewModel.isArabic ? 0.8 : 1, + ), + ), + mFlex(1), + Row( + children: [ + showFloating("assets/images/new/ear.svg"), + mWidth(4), + showFloating("assets/images/new/head.svg"), + mWidth(4), + showFloating("assets/images/new/tooth.svg"), + ], + ), + mFlex(2) + ], + ), + ), + ], + ), + ), + ), + ); + } + + Widget hmgButton() { + return Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onPharmacyClick(); + }, + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + // color: Color(0xFF2B353E), + decoration: containerRadius(Color(0xFF359846), 20), + ), + Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: projectViewModel.isArabic + ? containerBottomRightRadiusWithGradientForAr(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor) + : containerBottomRightRadiusWithGradient(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + SvgPicture.asset( + "assets/images/new/strips.svg", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + ), + ], + ), + ), + projectViewModel.isArabic + ? Positioned( + left: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/Pharmacy.svg", + height: MediaQuery.of(context).size.width * 0.15, + ), + ), + ) + : Positioned( + right: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/Pharmacy.svg", + height: MediaQuery.of(context).size.width * 0.15, + ), + ), + ), + Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.all(SizeConfig.widthMultiplier * 3.4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + color: Colors.yellow, + // width: MediaQuery.of(context).size.width * 0.065, + child: SvgPicture.asset( + "assets/images/new/Pharmacy.svg", + height: MediaQuery.of(context).size.width * 0.08, + ), + ), + mFlex(1), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).onlinePharmacy, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.45, + height: 1, + ), + ), + projectViewModel.isArabic ? mHeight(5) : Container(), + Text( + TranslationBase.of(context).ecommerceSolution, + style: TextStyle( + color: Colors.black, + fontSize: 9, + fontWeight: FontWeight.w600, + letterSpacing: -0.27, + height: projectViewModel.isArabic ? 0.2 : 1, + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + Widget showFloating(String icon) { + return Container( + width: MediaQuery.of(context).size.width * 0.06, + height: MediaQuery.of(context).size.width * 0.06, + decoration: containerRadius(CustomColors.accentColor, 100), + padding: EdgeInsets.all(4), + child: SvgPicture.asset(icon), + ); + } +} diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 4e19386b..f3af7c74 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -23,7 +23,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import 'landing_page_pharmcy.dart'; @@ -130,6 +129,7 @@ class _HomePageState extends State { height: 25.0, child: RaisedButton( color: Colors.red[800], + elevation: 0, textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -195,7 +195,7 @@ class _HomePageState extends State { width: double.infinity, height: 125, decoration: BoxDecoration( - color: HexColor('#A59E9E'), + color: Color(0xFFA59E9E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), @@ -230,7 +230,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: HexColor('#D81A2E'), + color: Color(0xFFD81A2E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(0)), @@ -254,7 +254,7 @@ class _HomePageState extends State { width: double.infinity, height: projectViewModel.isArabic ? 160 : 130, decoration: BoxDecoration( - color: HexColor('#A59E9E'), + color: Color(0xFFA59E9E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), @@ -340,7 +340,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: HexColor('#D81A2E'), + color: Color(0xFFD81A2E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all( @@ -420,7 +420,7 @@ class _HomePageState extends State { padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15), child: InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(projectViewModel.user))); }, child: Container( decoration: BoxDecoration( @@ -592,7 +592,7 @@ class _HomePageState extends State { )), ), height: MediaQuery.of(context).size.width * 0.4, - color: HexColor("#747C80"), + color: Color(0xFF747C80), imageName: 'emergency_service_image.png', ), ], @@ -825,7 +825,6 @@ class _HomePageState extends State { } else { GifLoaderDialogUtils.showMyDialog(context); await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - await pharmacyModuleViewModel.verifyCustomer().then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); @@ -867,7 +866,7 @@ class DashboardItem extends StatelessWidget { color: !hasBorder ? color != null ? color - : HexColor('#050705').withOpacity(opacity) + : Color(0xFF050705).withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart new file mode 100644 index 00000000..9f395cad --- /dev/null +++ b/lib/pages/landing/home_page_2.dart @@ -0,0 +1,85 @@ +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'fragments/home_page_fragment2.dart'; +import 'landing_page_pharmcy.dart'; + +class HomePage2 extends StatefulWidget { + final Function goToMyProfile; + Function onLoginClick, onMedicalFileClick; + + HomePage2({Key key, this.goToMyProfile, this.onLoginClick, this.onMedicalFileClick}); + + @override + _HomePageState2 createState() => _HomePageState2(); +} + +class _HomePageState2 extends State { + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getPatientRadOrders(), + builder: (_, model, wi) => Container( + color: CustomColors.backgroudGreyColor, + // color: Colors.yellow, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + HomePageFragment2( + model, + onLoginClick: () { + widget.onLoginClick(); + }, + onPharmacyClick: () { + getPharmacyToken(model); + }, + onMedicalFileClick: () { + widget.onMedicalFileClick(); + }, + ) + ], + ), + ), + ), + ); + } + + getPharmacyToken(DashboardViewModel model) async { + if (!model.isLogin) { + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if (!pharmacyModuleViewModel.error.isNotEmpty) { + await pharmacyModuleViewModel.createUser().then((value) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + }); + } else { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } + }); + } + } + + navigateToCovidDriveThru() { + Navigator.push(context, FadePage(page: CovidDrivethruLocation())); + } +} diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index d57e3da7..2bca7a9e 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,55 +1,52 @@ import 'dart:io'; -import 'package:diplomaticquarterapp/analytics/google-analytics.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/geofencing/requests/GeoZonesRequestModel.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.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/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; -import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' - as family; +import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; -import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; -import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart'; -import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; -import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; +import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; -import 'package:firebase_analytics/observer.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; + import '../../locator.dart'; import '../../routes.dart'; -import 'home_page.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class LandingPage extends StatefulWidget { static LandingPage shared; _LandingPageState state; + LandingPage() { LandingPage.shared = this; } @@ -75,10 +72,16 @@ class _LandingPageState extends State with WidgetsBindingObserver { ToDoCountProviderModel model; var notificationCount = ''; var themeNotifier; + DateTime currentBackPressTime; + + SignalRUtil signalRUtil; + + ToDoCountProviderModel toDoProvider; + + bool _showBottomNavigationBar = true; ///inject the user data - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); @@ -87,10 +90,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { var familyFileProvider = family.FamilyFilesProvider(); void _requestIOSPermissions() { - flutterLocalNotificationsPlugin - .resolvePlatformSpecificImplementation< - IOSFlutterLocalNotificationsPlugin>() - ?.requestPermissions( + flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.requestPermissions( alert: true, badge: true, sound: true, @@ -100,23 +100,95 @@ class _LandingPageState extends State with WidgetsBindingObserver { bool isPageNavigated = false; LocationUtils locationUtils; + Future onWillPop() { + if (currentTab != 0) { + changeCurrentTab(0); + return Future.value(false); + } else { + DateTime now = DateTime.now(); + if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { + currentBackPressTime = now; + AppToast.showToast(message: TranslationBase.of(context).pressAgain); + return Future.value(false); + } + return Future.value(true); + } + } + changeCurrentTab(int tab) { + if (!projectViewModel.isLogin) { + if (tab == 3) { + List imagesInfo = []; + imagesInfo.add( + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'), + ); + + imagesInfo.add( + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'), + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (cxt) => NotAutPage( + title: TranslationBase.of(context).myFamilyFiles, + description: TranslationBase.of(context).familyInfo, + infoList: [], + imagesInfo: imagesInfo, + icon: "assets/images/new/bottom_nav/family_files.svg", + ), + ), + ); + return; + } + if (tab == 4) { + List imagesInfo = []; + imagesInfo.add( + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png')); + + Navigator.push( + context, + MaterialPageRoute( + builder: (cxt) => NotAutPage( + title: TranslationBase.of(context).todoList, + description: TranslationBase.of(context).infoTodo, + infoList: [], + imagesInfo: imagesInfo, + icon: "assets/images/new/bottom_nav/todo.svg", + ), + ), + ); + return; + } + } + setState(() { - if (currentTab > 0 && tab == 2) - pageController.jumpToPage(0); - else if (tab != 0) { - if (tab == 4 && projectViewModel.isLogin && model.count == 0) { - AppToast.showErrorToast( - message: TranslationBase.of(context).noBookedAppo); + if (tab == 5) { + IS_VOICE_COMMAND_CLOSED = false; + triggerRobot(); + + // pageController.jumpToPage(tab); + } else { + if (currentTab > 0 && tab == 2) { + pageController.jumpToPage(0); + currentTab = tab; + } else if (tab != 0) { + if (tab == 4 && projectViewModel.isLogin && model.count == 0) { + AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo); + } else { + pageController.jumpToPage(tab); + currentTab = tab; + } } else { pageController.jumpToPage(tab); + currentTab = tab; } - } else { - IS_VOICE_COMMAND_CLOSED = false; - pageController.jumpToPage(tab); + // currentTab = tab; } - currentTab = tab; }); } @@ -126,29 +198,20 @@ class _LandingPageState extends State with WidgetsBindingObserver { var route = ModalRoute.of(context); - if (route != null) { - print(route.settings.name); - } + if (route != null) {} //setState(() { - print("didChangeAppLifecycleState"); - print('state = $state'); AppGlobal.context = context; if (state == AppLifecycleState.resumed) { - print(LandingPage.isOpenCallPage); if (LandingPage.isOpenCallPage) { if (!isPageNavigated) { isPageNavigated = true; - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => IncomingCall( - incomingCallData: LandingPage.incomingCallData))) - .then((value) { + Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { isPageNavigated = false; }); } } + sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); } if (state == AppLifecycleState.paused) { @@ -178,189 +241,162 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); + // signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); + + locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { - locationUtils.getCurrentLocation(); - if (projectViewModel.isLogin) { + if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { familyFileProvider.getSharedRecordByStatus(); } + // if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] - HMGNetworkConnectivity(context, () { - GifLoaderDialogUtils.showMyDialog(context); - PlatformBridge() - .connectHMGGuestWifi() - .then((value) => {GifLoaderDialogUtils.hideDialog(context)}); - }).checkAndConnectIfNoInternet(); + //for now commented to reduce this call will enable it when needed + // HMGNetworkConnectivity(context, () { + // GifLoaderDialogUtils.showMyDialog(context); + // PlatformBridge().connectHMGGuestWifi().then((value) => {GifLoaderDialogUtils.hideDialog(context)}); + // }).checkAndConnectIfNoInternet(); if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } requestPermissions().then((results) { - // registerGeofences(); - - if (results[Permission.notification].isGranted) - _firebaseMessaging.getToken().then((String token) { - sharedPref.setString(PUSH_TOKEN, token); - if (token != null && DEVICE_TOKEN == "") { - DEVICE_TOKEN = token; + locationUtils.getCurrentLocation(); + _firebaseMessaging.getToken().then((String token) { + print("Firebase Token: " + token); + sharedPref.setString(PUSH_TOKEN, token); + if (token != null) { + DEVICE_TOKEN = token; + if (!projectViewModel.isLoginChild) { checkUserStatus(token); - if (projectViewModel.isLogin) - this.getNotificationCount(DEVICE_TOKEN); } - }); - if (results[Permission.location].isGranted) ; - if (results[Permission.storage].isGranted) ; - if (results[Permission.camera].isGranted) ; - if (results[Permission.photos].isGranted) ; - if (results[Permission.accessMediaLocation].isGranted) ; + + // if (projectViewModel.isLogin) this.getNotificationCount(DEVICE_TOKEN); + } + }); + if (results[Permission.location].isGranted) {} + // if (results[Permission.storage].isGranted) ; + // if (results[Permission.camera].isGranted) ; + // if (results[Permission.photos].isGranted) ; + // if (results[Permission.accessMediaLocation].isGranted) ; // if (results[Permission.calendar].isGranted) ; }); - requestPermissions(); // }); // // //_firebase Background message handler - // _firebaseMessaging.configure( - // // onMessage: (Map message) async { - // // showDialog("onMessage: $message"); - // // print("onMessage: $message"); - // // print(message); - // // print(message['name']); - // // print(message['appointmentdate']); - // // - // // if (Platform.isIOS) { - // // if (message['is_call'] == "true") { - // // var route = ModalRoute.of(context); - // // - // // if (route != null) { - // // print(route.settings.name); - // // } - // // - // // Map myMap = new Map.from(message); - // // print(myMap); - // // LandingPage.isOpenCallPage = true; - // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // // if (!isPageNavigated) { - // // isPageNavigated = true; - // // Navigator.push( - // // context, - // // MaterialPageRoute( - // // builder: (context) => IncomingCall( - // // incomingCallData: LandingPage.incomingCallData))) - // // .then((value) { - // // isPageNavigated = false; - // // }); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // - // // if (Platform.isAndroid) { - // // if (message['data'].containsKey("is_call")) { - // // var route = ModalRoute.of(context); - // // - // // if (route != null) { - // // print(route.settings.name); - // // } - // // - // // Map myMap = - // // new Map.from(message['data']); - // // print(myMap); - // // LandingPage.isOpenCallPage = true; - // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // // if (!isPageNavigated) { - // // isPageNavigated = true; - // // Navigator.push( - // // context, - // // MaterialPageRoute( - // // builder: (context) => IncomingCall( - // // incomingCallData: LandingPage.incomingCallData))) - // // .then((value) { - // // isPageNavigated = false; - // // }); - // // } - // // } else { - // // print("Is Call Not Found Android"); - // // } - // // } else { - // // print("Is Call Not Found Android"); - // // } - // // }, - // // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - // // onLaunch: (Map message) async { - // // print("onLaunch: $message"); - // // showDialog("onLaunch: $message"); - // // }, - // // onResume: (Map message) async { - // // print("onResume: $message"); - // // print(message); - // // print(message['name']); - // // print(message['appointmentdate']); - // // - // // showDialog("onResume: $message"); - // // - // // if (Platform.isIOS) { - // // if (message['is_call'] == "true") { - // // var route = ModalRoute.of(context); - // // - // // if (route != null) { - // // print(route.settings.name); - // // } - // // - // // Map myMap = - // // new Map.from(message); - // // print(myMap); - // // LandingPage.isOpenCallPage = true; - // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // // if (!isPageNavigated) { - // // isPageNavigated = true; - // // Navigator.push( - // // context, - // // MaterialPageRoute( - // // builder: (context) => IncomingCall( - // // incomingCallData: LandingPage.incomingCallData))) - // // .then((value) { - // // isPageNavigated = false; - // // }); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // }, - // ); - } + _firebaseMessaging.configure( + onMessage: (Map message) async { + // showDialog("onMessage: $message"); + print("onMessage: $message"); + print(message); + print(message['name']); + print(message['appointmentdate']); + + if (Platform.isIOS) { + if (message['is_call'] == "true") { + var route = ModalRoute.of(context); + + if (route != null) { + print(route.settings.name); + } + + Map myMap = new Map.from(message); + print(myMap); + LandingPage.isOpenCallPage = true; + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + if (!isPageNavigated) { + isPageNavigated = true; + Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { + isPageNavigated = false; + }); + } + } else { + print("Is Call Not Found iOS"); + } + } else { + print("Is Call Not Found iOS"); + } - showDialogs(String message) { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: message, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + if (Platform.isAndroid) { + if (message['data'].containsKey("is_call")) { + var route = ModalRoute.of(context); + + if (route != null) { + print(route.settings.name); + } + + Map myMap = new Map.from(message['data']); + print(myMap); + LandingPage.isOpenCallPage = true; + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + if (!isPageNavigated) { + isPageNavigated = true; + Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { + isPageNavigated = false; + }); + } + } else { + print("Is Call Not Found Android"); + LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']); + } + } else { + print("Is Call Not Found Android"); + } + }, + onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, + onLaunch: (Map message) async { + print("onLaunch: $message"); + // showDialog("onLaunch: $message"); + }, + onResume: (Map message) async { + print("onResume: $message"); + print(message); + print(message['name']); + print(message['appointmentdate']); + + // showDialog("onResume: $message"); + + if (Platform.isIOS) { + if (message['is_call'] == "true") { + var route = ModalRoute.of(context); + + if (route != null) { + print(route.settings.name); + } + + Map myMap = new Map.from(message); + print(myMap); + LandingPage.isOpenCallPage = true; + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + if (!isPageNavigated) { + isPageNavigated = true; + Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { + isPageNavigated = false; + }); + } + } else { + print("Is Call Not Found iOS"); + } + } else { + print("Is Call Not Found iOS"); + } + }, + ); } Future> requestPermissions() async { var permissionResults = [ Permission.location, Permission.locationAlways, - Permission.storage, - Permission.camera, - Permission.photos, - Permission.notification, - Permission.accessMediaLocation, + // Permission.storage, + // Permission.camera, + // Permission.photos, + // Permission.notification, + // Permission.accessMediaLocation, // Permission.calendar, - Permission.activityRecognition + // Permission.activityRecognition ].request(); // var permissionsGranted = await deviceCalendarPlugin.hasPermissions(); @@ -371,19 +407,15 @@ class _LandingPageState extends State with WidgetsBindingObserver { return permissionResults; } - static Future myBackgroundMessageHandler( - Map message) async { + static Future myBackgroundMessageHandler(Map message) async { Map myMap = new Map.from(message['data']); if (message.containsKey('data')) { - print("myBackgroundMessageHandler Inside"); LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - print(LandingPage.incomingCallData.doctorname); LandingPage.isOpenCallPage = true; } if (message.containsKey('notification')) { final dynamic notification = message['notification']; - print(notification); } } @@ -407,8 +439,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { void doIt() { getUserInformation().then((value) { - if (value != null) - projectViewModel.platformBridge().registerHmgGeofences(); + if (value != null) projectViewModel.platformBridge().registerHmgGeofences(); }); } @@ -430,9 +461,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService - .selectDeviceImei(DEVICE_TOKEN) - .then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); @@ -453,24 +482,15 @@ class _LandingPageState extends State with WidgetsBindingObserver { getNotificationCount(token) async { if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { - // authService - // .registeredAuthenticatedUser(data, token, 0, 0) - // .then((res) => {print(res)}); authService.getDashboard().then((value) => { if (value != null) { setState(() { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] > - 99 - ? '99+' - : value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); - + notificationCount = + value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + model.setState(model.count, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); }) } @@ -483,127 +503,158 @@ class _LandingPageState extends State with WidgetsBindingObserver { Widget build(BuildContext context) { projectViewModel = Provider.of(context); model = Provider.of(context); - + // currentTab == 0 ? 45 : 0.0 return Scaffold( - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: TextStyle( - color: Theme.of(context).textTheme.headline1.color, - fontWeight: FontWeight.bold), - ), - title: Text( - getText(currentTab).toUpperCase(), - 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 new Stack( - children: [ - currentTab == 0 - ? IconButton( - icon: Icon(Icons.menu), - color: Theme.of(context).textTheme.headline1.color, - onPressed: () => Scaffold.of(context).openDrawer(), - ) - : IconButton( - icon: Icon(Icons.arrow_back), - color: Theme.of(context).textTheme.headline1.color, - onPressed: () { - setState(() { - currentTab = 0; - }); - - pageController.jumpToPage(0); - }, - ), - notificationCount != '' - ? new Positioned( - right: projectViewModel.isArabic ? 35 : 0, - top: 5, - child: new Container( - padding: EdgeInsets.all(4), - decoration: new BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - notificationCount, - style: new TextStyle( - color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, - ), - textAlign: TextAlign.center, - ), - ), - ) - : SizedBox() - ], - ); - }, - ), - actions: [ - IconButton( - //iconSize: 70, - icon: Icon( - projectViewModel.isLogin ? Icons.settings : Icons.login, - color: Theme.of(context).textTheme.headline1.color, - ), - onPressed: () { - if (projectViewModel.isLogin) - Navigator.of(context).pushNamed( - SETTINGS, - ); - else - login(); - }, //do something, - ) - ], - centerTitle: true, - ), + appBar: currentTab == 0 + ? PreferredSize( + preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0), + child: AppBar( + elevation: 0, + backgroundColor: CustomColors.backgroudGreyColor, + textTheme: TextTheme( + headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), + ), + title: Text( + getText(currentTab).toUpperCase(), + style: TextStyle( + fontWeight: FontWeight.bold, + color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1.color, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + // bold: true, + ), + leading: Builder( + builder: (BuildContext context) { + return new Stack( + children: [ + currentTab == 0 + ? IconButton( + icon: SvgPicture.asset("assets/images/new/menu.svg"), + color: Theme.of(context).textTheme.headline1.color, + onPressed: () => Scaffold.of(context).openDrawer(), + ) + : IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + setState(() { + currentTab = 0; + }); + + pageController.jumpToPage(0); + }, + ), + projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild + ? new Positioned( + right: projectViewModel.isArabic ? 35 : 0, + top: 5, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: CustomColors.accentColor, + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + model.notificationsCount.toString(), + style: new TextStyle( + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 9, + ), + textAlign: TextAlign.center, + ), + ), + ) + : SizedBox() + ], + ); + }, + ), + actions: [ + // IconButton( + // //iconSize: 70, + // icon: Icon( + // projectViewModel.isLogin ? Icons.settings : Icons.login, + // color: Theme.of(context).textTheme.headline1.color, + // ), + // onPressed: () { + // if (projectViewModel.isLogin) + // Navigator.of(context).pushNamed( + // SETTINGS, + // ); + // else + // login(); + // }, //do something, + // ) + ], + centerTitle: true, + ), + ) + : null, drawer: SafeArea(child: AppDrawer()), - extendBody: true, - body: PageView( - physics: NeverScrollableScrollPhysics(), - controller: pageController, - children: [ - HomePage( - goToMyProfile: () { - changeCurrentTab(1); - }, - ), - MedicalProfilePage(), - BookingOptions(), - MyFamily(isAppbarVisible: false), - ToDo(isShowAppBar: false), - ], // Please do not remove the BookingOptions from this array - ), + extendBody: false, + body: WillPopScope( + onWillPop: onWillPop, + child: Stack(children: [ + PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + HomePage2( + goToMyProfile: () { + changeCurrentTab(1); + }, + onLoginClick: () { + login(); + }, + onMedicalFileClick: () { + changeCurrentTab(1); + }, + ), + MedicalProfilePageNew( + onTap: () { + changeCurrentTab(0); + }, + ), + Search( + onBackClick: () { + changeCurrentTab(0); + }, + ), + MyFamily( + isAppbarVisible: false, + onBackClick: () { + changeCurrentTab(0); + }, + ), + ToDo( + isShowAppBar: true, + onBackClick: () { + changeCurrentTab(0); + }, + ), + ], // Please do not remove the BookingOptions from this array + ), + RobotIcon() + ])), bottomNavigationBar: BottomNavBar( changeIndex: changeCurrentTab, index: currentTab, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - floatingActionButton: - (projectViewModel.havePrivilege(34) && currentTab == 0) - ? FloatingButton( - elevation: true, - onTap: () { - changeCurrentTab(2); - }) - : null); + floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0) + ? FloatingButton( + elevation: true, + onTap: () { + changeCurrentTab(2); + }, + ) + : null); } triggerRobot() { - event.setValue({"isRobot": 'true'}); + event.setValue({"isRobotVisible": 'true'}); } getText(currentTab) { @@ -624,26 +675,21 @@ class _LandingPageState extends State with WidgetsBindingObserver { } void checkUserStatus(token) async { - authService - .selectDeviceImei(token) - .then((SelectDeviceIMEIRES value) => setUserValues(value)); - if (projectViewModel.isLoading == true) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + authService.selectDeviceImei(token).then((SelectDeviceIMEIRES value) => setUserValues(value)); + if (authenticatedUserObject.isLogin) { + var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { - authService - .registeredAuthenticatedUser(data, token, 0, 0) - .then((res) => {print(res)}); + authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); authService.getDashboard().then((value) => { setState(() { if (value != null) { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); + notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + model.setState(model.count, true, notificationCount); + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); } - }) + }), }); } - } + } else {} } } diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 7a290383..9e650966 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -5,10 +5,9 @@ import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; @@ -85,6 +84,27 @@ class _LandingPagePharmacyState extends State { ); } + void _scanQrAndGetProduct() async { + try { + String result = await BarcodeScanner.scan(); + try { + String barcode = result; + GifLoaderDialogUtils.showMyDialog(context); + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { + print(response); + var product = PharmacyProduct.fromJson(response["products"][0]); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: ProductDetailPage(product))); + }, onFailure: (String error, int statusCode) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: "Product not found"); + }); + } catch (apiEx) { + AppToast.showErrorToast(message: "Something went wrong, please try again"); + } + } catch (barcodeEx) {} + } + getText(currentTab) { switch (currentTab) { case 2: diff --git a/lib/pages/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart new file mode 100644 index 00000000..54417ee4 --- /dev/null +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -0,0 +1,232 @@ +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/models/slider_data.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class LoggedSliderView extends StatelessWidget { + ProjectViewModel projectViewModel; + SliderData sliderData; + DashboardViewModel model; + + LoggedSliderView(this.projectViewModel, this.sliderData, this.model); + + @override + Widget build(BuildContext context) { + //'${DateUtil.getMonthDayYearDateFormatted(sliderData.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}', + return Container( + decoration: cardRadius(20), + + margin: EdgeInsets.all(0), + child: Container( + decoration: cardRadius(20,color: sliderData.darkColor), + clipBehavior: Clip.antiAlias, + margin: EdgeInsets.zero, + + // padding: EdgeInsets.zero, + child: Stack( + children: [ + Card( + child: Container( + width: double.infinity, + height: double.infinity, + ), + color: Colors.transparent, + margin: EdgeInsets.zero, + elevation: 8, + ), + Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + margin: EdgeInsets.zero, + decoration: projectViewModel.isArabic + ? containerBottomRightRadiusWithGradientForAr(MediaQuery.of(context).size.width / 4, darkColor: sliderData.darkColor, lightColor: sliderData.lightColor) + : containerBottomRightRadiusWithGradient(MediaQuery.of(context).size.width / 4, darkColor: sliderData.darkColor, lightColor: sliderData.lightColor), + child: Card( + color: Colors.transparent, + margin: EdgeInsets.zero, + elevation: 8, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mFlex(2), + Row( + children: [ + Container( + decoration: projectViewModel.isArabic ? containerColorRadiusLeft(Color(0xFFFBF2E31), 100) : containerColorRadiusRight(Color(0xFFFBF2E31), 100), + padding: EdgeInsets.only(left: 20, right: 16, top: 6, bottom: 6), + child: Text( + TranslationBase.of(context).medicalFile, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 10, + letterSpacing: -0.3, + height: 1.2, + ), + ), + ), + mWidth(MediaQuery.of(context).size.width / 50), + //circularAviator(MediaQuery.of(context).size.width / 14, brColor: Colors.white), + mFlex(1), + projectViewModel.isArabic ? circularAviator(MediaQuery.of(context).size.width / 28, brColor: Colors.white, icon: Icons.done, bcColor: Colors.white) : Container(), + Text( + TranslationBase.of(context).verified, + style: TextStyle( + color: Colors.white, + fontSize: 10, + letterSpacing: -0.3, + height: 1, + ), + ), + !projectViewModel.isArabic ? circularAviator(MediaQuery.of(context).size.width / 28, brColor: Colors.white, icon: Icons.done, bcColor: Colors.white) : Container(), + mWidth(MediaQuery.of(context).size.width / 70), + ], + ), + mFlex(1), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + sliderData.pateintName.toLowerCase().capitalizeFirstofEach, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 17, + letterSpacing: -0.25, + height: 25 / 17, + ), + ), + mHeight(2), + Text( + sliderData.pateintId, + style: TextStyle( + color: Colors.white, + fontSize: 12, + letterSpacing: -0.36, + height: 1, + ), + ), + ], + ), + ), + mHeight(3), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Text( + '${DateUtil.getMonthDayYearDateFormatted(projectViewModel.user.dateofBirthDataTime)} ,${projectViewModel.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${projectViewModel.user.age.toString() + " " + TranslationBase.of(context).patientAge.toString()}', + style: TextStyle( + color: Colors.white, + fontSize: 12, + letterSpacing: -0.33, + height: 1, + ), + ), + ), + mFlex(3), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Row( + children: [ + Expanded( + flex: 3, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/new/height.svg', + width: 11, + height: 11, + ), + mWidth(6), + Texts( + "${TranslationBase.of(context).height}: ${model.heightCm} ${TranslationBase.of(context).cm}", + color: Colors.white, + fontSize: 8, + ) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + flex: 3, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/new/weight.svg', + width: 11, + height: 11, + ), + mWidth(6), + Texts( + '${TranslationBase.of(context).weight}: ${model.weightKg} ${TranslationBase.of(context).kg}', + color: Colors.white, + fontSize: 8, + ) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + flex: 3, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/new/blood.svg', + width: 11, + height: 11, + ), + mWidth(6), + Texts( + '${TranslationBase.of(context).bloodType1} ${model.booldType}', + color: Colors.white, + fontSize: 8, + ) + ], + ), + ), + mFlex(1), + ], + ), + ), + mFlex(2), + ], + ), + ), + ), + projectViewModel.isArabic + ? Positioned( + child: Icon( + Icons.arrow_forward, + color: Colors.white, + size: 20, + ), + bottom: 8, + left: 8, + ) + : Positioned( + child: Icon( + Icons.arrow_forward_rounded, + color: Colors.white, + size: 20, + ), + bottom: 8, + right: 8, + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/landing/widgets/offer_view.dart b/lib/pages/landing/widgets/offer_view.dart new file mode 100644 index 00000000..c8269bc6 --- /dev/null +++ b/lib/pages/landing/widgets/offer_view.dart @@ -0,0 +1,87 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; + +class OfferView extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: MediaQuery.of(context).size.width / 5, + decoration: containerColorRadiusBorderWidth(Colors.grey[200], 20, Colors.grey[300], 2), + child: Row( + children: [ + Expanded( + flex: 2, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(left: 20,right: 20,top: 8,bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Kid's Offer", + style: TextStyle( + color: Color(0xFFFBF2E31), + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + Text( + "Take Care of your children's teeth", + style: TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ), + mFlex(1), + Row( + children: [ + Text( + "Only ", + style: TextStyle( + color: Color(0xFFFBF2E31), + fontSize: 14, + ), + ), + Text( + "500 ", + style: TextStyle( + color: Color(0xFFFBF2E31), + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + Text( + "SAR ", + style: TextStyle( + color: Color(0xFFFBF2E31), + fontSize: 14, + ), + ), + mFlex(1), + ], + ), + ], + ), + ), + ), + Expanded( + child: Column( + children: [ + Expanded( + flex: 1, + child: Image.asset("assets/images/pharmacy_module/payment/hmg_shipping_logo.png"), + ), + Expanded( + flex: 1, + child: Image.asset("name"), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/landing/widgets/pharmacy_view.dart b/lib/pages/landing/widgets/pharmacy_view.dart new file mode 100644 index 00000000..ad33f529 --- /dev/null +++ b/lib/pages/landing/widgets/pharmacy_view.dart @@ -0,0 +1,58 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class PharmacyView extends StatelessWidget { + Function onPharmacyClick; + PharmacyView({this.onPharmacyClick}); + @override + Widget build(BuildContext context) { + return InkWell( + onTap: (){ + onPharmacyClick(); + }, + child: Container( + width: double.infinity, + decoration: + containerBottomRightRadiusWithGradientBorder(16, darkColor: CustomColors.darkGreyColor.withOpacity(0.5), lightColor: CustomColors.lightGreyColor, borderColor: Color(0xFFcccccc), w: 1), + padding: EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset("assets/images/new/Pharmacy.svg"), + mWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).HMGPharmacy, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + Text( + TranslationBase.of(context).ecommerceSolution, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ), + ], + ), + ), + mWidth(12), + Opacity( + opacity: 0.2, + child: SvgPicture.asset("assets/images/new/Pharmacy.svg"), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart new file mode 100644 index 00000000..b233c6a7 --- /dev/null +++ b/lib/pages/landing/widgets/services_view.dart @@ -0,0 +1,271 @@ +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/hmg_services.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; +import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +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:url_launcher/url_launcher.dart'; + +import '../../../locator.dart'; +import '../landing_page.dart'; +import '../landing_page_pharmcy.dart'; + +class ServicesView extends StatelessWidget { + HmgServices hmgServices; + int index; + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + + ServicesView(this.hmgServices, this.index); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (index == 0) { + Navigator.push(context, FadePage(page: LiveCareHome())).then((value) { + LiveCareHome.isLiveCareTypeSelected = false; + }); + } else if (index == 1) { + Navigator.push(context, FadePage(page: CovidDrivethruLocation())); + } else if (index == 2) { + Navigator.push(context, FadePage(page: PaymentService())); + } else if (index == 3) { + Navigator.push(context, FadePage(page: HomeHealthCarePage())); + } else if (index == 4) { + Navigator.push(context, FadePage(page: CMCPage())); + } else if (index == 5) { + Navigator.push(context, FadePage(page: ErOptions(isAppbar: true))); + } else if (index == 6) { + Navigator.push(context, FadePage(page: EReferralPage())); + } else if (index == 7) { + Navigator.push(context, FadePage(page: H2OPage())); + } else if (index == 8) { + Navigator.push(context, FadePage(page: ContactUsPage())); + } else if (index == 9) { + Navigator.push( + context, + FadePage( + page: MedicalProfilePageNew(), + ), + ); + } else if (index == 10) { + Navigator.push( + context, + FadePage( + page: Search(), + ), + ); + } else if (index == 11) { + getPharmacyToken(context); + } else if (index == 12) { + Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), + ), + ); + } else if (index == 13) { + Navigator.push( + context, + FadePage( + page: MyFamily(), + ), + ); + } else if (index == 14) { + Navigator.push( + context, + FadePage(page: ChildInitialPage()), + ); + } else if (index == 15) { + // Navigator.pop(context); + LandingPage.shared.switchToDoFromHMGServices(); + } else if (index == 16) { + Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ); + } else if (index == 17) { + Navigator.push( + context, + FadePage( + page: (HealthCalculators()), + ), + ); + } else if (index == 18) { + Navigator.push( + context, + FadePage( + page: HealthConverter(), + ), + ); + } else if (index == 19) { + Navigator.push( + context, + FadePage(page: SmartWatchInstructions()), + ); + } else if (index == 20) { + Navigator.push( + context, + FadePage( + page: ParkingPage(), + ), + ); + } else if (index == 21) { + launch("https://hmgwebservices.com/vt_mobile/html/index.html"); + } else if (index == 22) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => MyWebView( + title: "HMG News", + selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + ),),); + } + }, + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.darkGreyColor), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + mFlex(1), + Flexible( + flex: 8, + child: Column( + children: [ + Flexible( + flex: 5, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Opacity( + opacity: 0.04, + child: hmgServices.action == 2 + ? Image.asset( + hmgServices.icon, + width: double.infinity, + height: double.infinity, + ) + : SvgPicture.asset( + hmgServices.icon, + width: double.infinity, + height: double.infinity, + ), + ), + ), + ), + mFlex(1), + ], + ), + ), + ], + ), + ), + Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.only(left: SizeConfig.widthMultiplier * 3, right: SizeConfig.widthMultiplier * 3, top: SizeConfig.widthMultiplier * 3, bottom: SizeConfig.widthMultiplier * 2), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mFlex(1), + hmgServices.action == 2 + ? Image.asset( + hmgServices.icon, + height: index == 0 ? MediaQuery.of(context).size.width / 18 : MediaQuery.of(context).size.width / 18, + ) + : Container( + // color: Colors.yellow, + width: index == 4 ? MediaQuery.of(context).size.width / 12 : MediaQuery.of(context).size.width / 12, + height: index == 4 ? MediaQuery.of(context).size.width / 10 : MediaQuery.of(context).size.width / 12, + child: SvgPicture.asset( + hmgServices.icon, +// width: MediaQuery.of(context).size.width / 12, + // height: MediaQuery.of(context).size.width / 12, + ), + ), + mFlex(4), + AutoSizeText( + hmgServices.title, + maxLines: 1, + minFontSize: 10, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.bold, + letterSpacing: -0.39, + height: 0.8, + ), + ), + AutoSizeText( + hmgServices.subTitle, + maxLines: 1, + minFontSize: 8, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.4, + letterSpacing: -0.27, + fontWeight: FontWeight.w600, + ), + ), + mFlex(1), + ], + ), + ), + ], + ), + ), + ); + } + + getPharmacyToken(BuildContext context) async { + if (!authProvider.isLogin) { + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if (pharmacyModuleViewModel.error.isNotEmpty) { + await pharmacyModuleViewModel.createUser().then((value) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + }); + } else { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } + }); + } + } +} diff --git a/lib/pages/landing/widgets/slider_view.dart b/lib/pages/landing/widgets/slider_view.dart new file mode 100644 index 00000000..5030d004 --- /dev/null +++ b/lib/pages/landing/widgets/slider_view.dart @@ -0,0 +1,158 @@ +import 'dart:math'; + +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class SliderView extends StatelessWidget { + Function onLoginClick; + + SliderView({this.onLoginClick}); + + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return Container( + decoration: cardRadius(20), + margin: EdgeInsets.all(0), + child: Container( + decoration: cardRadius(20,color: Color(0xFFF2B353E)), + clipBehavior: Clip.antiAlias, + margin: EdgeInsets.zero, + + // padding: EdgeInsets.zero, + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + margin: EdgeInsets.zero, + decoration: projectViewModel.isArabic + ? containerBottomRightRadiusWithGradientForAr(MediaQuery.of(context).size.width / 4) + : containerBottomRightRadiusWithGradient(MediaQuery.of(context).size.width / 4), + child: Card( + color: Colors.transparent, + margin: EdgeInsets.zero, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mFlex(3), + Container( + decoration: projectViewModel.isArabic ? containerColorRadiusLeft(Color(0xFFFBF2E31), 100) : containerColorRadiusRight(Color(0xFFFBF2E31), 100), + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 16 : 20, right: projectViewModel.isArabic ? 20 : 16, top: 6, bottom: 6), + child: Text( + TranslationBase.of(context).medicalFile, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 10, + letterSpacing: -0.3, + height: 1.2, + ), + ), + ), + mFlex(2), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).cantSeeProfile, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 17, + letterSpacing: -0.25, + height: 25 / 17, + ), + ), + Text( + TranslationBase.of(context).loginRegisterNow, + style: TextStyle( + color: Colors.white, + fontSize: 12, + letterSpacing: -0.36, + height: 1, + ), + ), + ], + ), + ), + mFlex(2), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Container( + height: MediaQuery.of(context).size.width / 14, + width: MediaQuery.of(context).size.width / (projectViewModel.isArabic ? 4 : 6), + child: RaisedButton( + shape: cardRadiusNew(8), + color: Color(0xFFFBF2E31), + elevation: 0, + padding: EdgeInsets.zero, + onPressed: () { + onLoginClick(); + }, + child: Center( + child: AutoSizeText( + TranslationBase.of(context).login, + maxLines: 1, + style: TextStyle( + color: Colors.white, + fontSize: 13, + letterSpacing: -0.39, + height: 1, + ), + ), + ), + ), + ), + ), + mFlex(3), + ], + ), + ), + ), + ), + ); + } +} + +class CurvedBottomClipper extends CustomClipper { + @override + Path getClip(Size size) { + // I've taken approximate height of curved part of view + // Change it if you have exact spec for it + final roundingHeight = size.height * 3 / 5; + + // this is top part of path, rectangle without any rounding + final filledRectangle = Rect.fromLTRB(0, 0, size.width, size.height - roundingHeight); + + // this is rectangle that will be used to draw arc + // arc is drawn from center of this rectangle, so it's height has to be twice roundingHeight + // also I made it to go 5 units out of screen on left and right, so curve will have some incline there + final roundingRectangle = Rect.fromLTRB(-size.width, size.height - roundingHeight * 2, size.width, size.height); + + final path = Path(); + path.addRect(filledRectangle); + + // so as I wrote before: arc is drawn from center of roundingRectangle + // 2nd and 3rd arguments are angles from center to arc start and end points + // 4th argument is set to true to move path to rectangle center, so we don't have to move it manually + path.arcTo(roundingRectangle, pi, -pi, true); + path.close(); + + return path; + } + + @override + bool shouldReclip(CustomClipper oldClipper) { + // returning fixed 'true' value here for simplicity, it's not the part of actual question, please read docs if you want to dig into it + // basically that means that clipping will be redrawn on any changes + return true; + } +} diff --git a/lib/pages/livecare/clinic_timings_page.dart b/lib/pages/livecare/clinic_timings_page.dart new file mode 100644 index 00000000..cd1652f2 --- /dev/null +++ b/lib/pages/livecare/clinic_timings_page.dart @@ -0,0 +1,118 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class ClinicTimingsPage extends StatefulWidget { + final clinicName; + final List patientERGetClinicsServiceTimingsList; + + ClinicTimingsPage({@required this.clinicName, @required this.patientERGetClinicsServiceTimingsList}); + + @override + _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); +} + +class _LiveCarePatmentPageState extends State { + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).clinicSchedule, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).erConsultation, + body: Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(top: index == 0 ? 12 : 0, bottom: (index == widget.patientERGetClinicsServiceTimingsList.length - 1) ? 12 : 0), + child: showItem(widget.patientERGetClinicsServiceTimingsList[index]), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + itemCount: widget.patientERGetClinicsServiceTimingsList.length, + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(12), + color: Colors.white, + child: DefaultButton( + TranslationBase.of(context).back, + () { + Navigator.pop(context); + }, + ), + ), + ], + ), + ), + ); + } + + Widget showItem(PatientERGetClinicsServiceTimingsList item) { + return Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 2, + child: Text( + item.dayOfWeekStr, + style: TextStyle( + fontSize: 18, + letterSpacing: -0.72, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + flex: 4, + child: Container( + width: double.infinity, + decoration: cardRadius(12), + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + for (int i = 0; i < item.shiftTimings.length; i++) + Text( + TranslationBase.of(context).from + " " + item.shiftTimings[i].startTime + " " + TranslationBase.of(context).to + " " + item.shiftTimings[i].endTime, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.42, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index de80b4ae..9e164c09 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; import 'package:diplomaticquarterapp/pages/conference/conference_page.dart'; +import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -15,16 +16,14 @@ class IncomingCall extends StatefulWidget { _IncomingCallState createState() => _IncomingCallState(); } -class _IncomingCallState extends State - with SingleTickerProviderStateMixin { +class _IncomingCallState extends State with SingleTickerProviderStateMixin { AnimationController _animationController; final player = AudioPlayer(); @override void initState() { - _animationController = - AnimationController(vsync: this, duration: Duration(milliseconds: 500)); + _animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 500)); WidgetsBinding.instance.addPostFrameCallback((_) => _runAnimation()); @@ -57,18 +56,12 @@ class _IncomingCallState extends State Container( margin: EdgeInsets.only(top: 30.0), alignment: Alignment.center, - child: Text("Incoming Video Call", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 26.0, - color: Colors.white, - letterSpacing: 1.0)), + child: Text("Incoming Video Call", textAlign: TextAlign.center, style: TextStyle(fontSize: 26.0, color: Colors.white, letterSpacing: 1.0)), ), Container( alignment: Alignment.center, margin: EdgeInsets.fromLTRB(50.0, 30.0, 50.0, 20.0), - child: Image.asset( - 'assets/images/new-design/hmg_full_logo_hd_white.png'), + child: Image.asset('assets/images/new-design/hmg_full_logo_hd_white.png'), ), Container( margin: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 0.0), @@ -80,33 +73,17 @@ class _IncomingCallState extends State Container( margin: EdgeInsets.only(top: 20.0), alignment: Alignment.center, - child: Text("Dr Eyad Ismail Abu Jayab", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("Dr Eyad Ismail Abu Jayab", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, letterSpacing: 0.8, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text("ENT Clinic", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text("Speciality", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 22.0, - letterSpacing: 0.8, - color: Colors.white)), + child: Text("Speciality", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), ), Container( decoration: BoxDecoration( @@ -117,30 +94,14 @@ class _IncomingCallState extends State margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - Text("Appointment Information", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - letterSpacing: 1.0, - color: Colors.white)), + Text("Appointment Information", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, letterSpacing: 1.0, color: Colors.white)), Container( margin: EdgeInsets.only(top: 20.0), - child: Text("Sun, 15th Dec, 2019, 09:00", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 1.0, - color: Colors.white)), + child: Text("Sun, 15th Dec, 2019, 09:00", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), ), Container( margin: EdgeInsets.only(top: 20.0), - child: Text("ENT Clinic", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - letterSpacing: 1.0, - color: Colors.white)), + child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), ), ], ), @@ -153,9 +114,7 @@ class _IncomingCallState extends State mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ RotationTransition( - turns: Tween(begin: 0.0, end: -.1) - .chain(CurveTween(curve: Curves.elasticIn)) - .animate(_animationController), + turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), child: Container( child: RawMaterialButton( onPressed: () { @@ -208,16 +167,19 @@ class _IncomingCallState extends State Future _submit() async { backToHome(); try { - final roomModel = RoomModel( - name: widget.incomingCallData.name, - token: widget.incomingCallData.sessionId, - identity: widget.incomingCallData.identity); - + final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); + + // await Navigator.of(context).push( + // MaterialPageRoute( + // fullscreenDialog: true, + // builder: (BuildContext context) => + // ConferencePage(roomModel: roomModel), + // ), + // ); await Navigator.of(context).push( MaterialPageRoute( fullscreenDialog: true, - builder: (BuildContext context) => - ConferencePage(roomModel: roomModel), + builder: (BuildContext context) => CallHomePage(), ), ); } catch (err) { diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart new file mode 100644 index 00000000..3980c5a7 --- /dev/null +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -0,0 +1,316 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class LiveCarePatmentPage extends StatefulWidget { + GetERAppointmentFeesList getERAppointmentFeesList; + int waitingTime; + String clinicName; + + LiveCarePatmentPage({@required this.getERAppointmentFeesList, @required this.waitingTime, @required this.clinicName}); + + @override + _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); +} + +class _LiveCarePatmentPageState extends State { + int _selected = 0; + + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemWidth = size.width / 2; + projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).livecare, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).erConsultation, + body: Container( + width: double.infinity, + + height: double.infinity, + child: Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + widget.clinicName, + style: TextStyle( + fontSize: 19.0, + fontWeight: FontWeight.bold, + letterSpacing: -1.44, + ), + ), + mHeight(8), + Text( + TranslationBase.of(context).expectedWaiting, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), + ), + Text( + widget.waitingTime.toString() + " " + TranslationBase.of(context).minute, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: CustomColors.accentColor, + letterSpacing: -0.66, + ), + ), + mHeight(16), + Container( + decoration: cardRadius(12), + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).erConsultFee, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(10), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientShareToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.amount + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + mHeight(4), + mDivider(CustomColors.lightGreyColor), + mHeight(4), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientTaxToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.tax + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + mHeight(4), + mDivider(CustomColors.lightGreyColor), + mHeight(4), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientShareTotalToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.total + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ], + ), + ), + mHeight(12), + Container( + padding: EdgeInsets.all(12), + decoration: cardRadius(12), + child: Row( + children: [ + SvgPicture.asset( + "assets/images/new/services/raise_comp.svg", + color: CustomColors.green, + width: 18, + height: 18, + ), + mWidth(10), + Expanded( + child: Text( + TranslationBase.of(context).insuredPatient, + style: TextStyle( + fontSize: 10.0, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + 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), + Text( + TranslationBase.of(context).termsConditoins, + style: new TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: CustomColors.accentColor, + ), + ), + ], + ), + ), + mFlex(1), + Text( + TranslationBase.of(context).upComingPayOption, + style: new TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), + child: getPaymentMethods(), + ), + + + ], + ), + ), + ), + Container( + padding: EdgeInsets.all(12), + color: Colors.white, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel, + () { + Navigator.pop(context, false); + }, + ), + ), + mWidth(12), + Expanded( + child: DefaultButton( + TranslationBase.of(context).next, + () { + if (_selected == 0) { + AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); + } else { + Navigator.pop(context, true); + } + }, + color: CustomColors.green, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } + + void onRadioChanged(int value) { + setState(() { + _selected = value; + }); + } + + _getNormalText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, color: Colors.black)), + ); + } + + _getMarginText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), + ); + } +} diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index 2cadd239..b0150c03 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -1,6 +1,5 @@ -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingRequest.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; @@ -10,17 +9,17 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:provider/provider.dart'; class LiveCareHome extends StatefulWidget { static bool showFooterButton = true; + static bool isLiveCareTypeSelected = false; @override _LiveCareHomeState createState() => _LiveCareHomeState(); } -class _LiveCareHomeState extends State - with SingleTickerProviderStateMixin { +class _LiveCareHomeState extends State with SingleTickerProviderStateMixin { TabController _tabController; bool isDataLoaded = false; @@ -31,7 +30,7 @@ class _LiveCareHomeState extends State ErRequestHistoryList pendingERRequestHistoryList; - AuthenticatedUserObject authenticatedUserObject = locator(); + ProjectViewModel projectViewModel; @override void initState() { @@ -40,12 +39,9 @@ class _LiveCareHomeState extends State pendingERRequestHistoryList = new ErRequestHistoryList(); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_ar/ar/0.png')); WidgetsBinding.instance.addPostFrameCallback((_) { - if (!isDataLoaded && authenticatedUserObject.isLogin) getLiveCareHistory(); + if (!isDataLoaded && projectViewModel.isLogin) getLiveCareHistory(); }); super.initState(); @@ -53,25 +49,59 @@ class _LiveCareHomeState extends State @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( - appBarTitle: "LiveCare", + appBarTitle: TranslationBase.of(context).livecare, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).erConsultation, body: Container( child: Column(children: [ - /// this is will not colored with theme data TabBar( - labelColor: Colors.black, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ - Tab(text: TranslationBase.of(context).consultation), - Tab(text: TranslationBase.of(context).logs), + Tab( + child: Text( + TranslationBase.of(context).consultation, + style: TextStyle( + color: Colors.black, + fontSize: 14, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + ), + Tab( + child: Text( + TranslationBase.of(context).logs, + style: TextStyle( + color: Colors.black, + fontSize: 14, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + ), ], - controller: _tabController, - ), - Divider( - color: Colors.grey[600], - thickness: 0.5, ), Expanded( child: TabBarView( @@ -82,10 +112,7 @@ class _LiveCareHomeState extends State getLiveCareHistory: getLiveCareHistory, ) : isDataLoaded - ? LiveCarePendingRequest( - getLiveCareHistory: getLiveCareHistory, - pendingERRequestHistoryList: - pendingERRequestHistoryList) + ? LiveCarePendingRequest(getLiveCareHistory: getLiveCareHistory, pendingERRequestHistoryList: pendingERRequestHistoryList) : Container(), isDataLoaded ? LiveCareLogs( @@ -108,23 +135,17 @@ class _LiveCareHomeState extends State hasLiveCareRequest = false; }); LiveCareService service = new LiveCareService(); - PatientERVirtualHistoryResponse patientERVirtualHistoryResponse = - new PatientERVirtualHistoryResponse(); + PatientERVirtualHistoryResponse patientERVirtualHistoryResponse = new PatientERVirtualHistoryResponse(); service.getLivecareHistory(context).then((res) { GifLoaderDialogUtils.hideDialog(context); setState(() { print(res['ErRequestHistoryList'].length); if (res['ErRequestHistoryList'].length != 0) { - patientERVirtualHistoryResponse = - PatientERVirtualHistoryResponse.fromJson(res); - erRequestHistoryList = - patientERVirtualHistoryResponse.erRequestHistoryList; + patientERVirtualHistoryResponse = PatientERVirtualHistoryResponse.fromJson(res); + erRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList; - if (patientERVirtualHistoryResponse - .erRequestHistoryList[0].callStatus < - 4) { - pendingERRequestHistoryList = - patientERVirtualHistoryResponse.erRequestHistoryList[0]; + if (patientERVirtualHistoryResponse.erRequestHistoryList[0].callStatus < 4) { + pendingERRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList[0]; hasLiveCareRequest = true; } else { hasLiveCareRequest = false; diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart index 72ca4ce9..7884b37e 100644 --- a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class ScheduleClinicCard extends StatefulWidget { bool isSelected; final ClinicsHaveScheduleList clinicsHaveScheduleList; var languageID; - ScheduleClinicCard( - {this.isSelected, - this.languageID, - @required this.clinicsHaveScheduleList}); + ScheduleClinicCard({this.isSelected, this.languageID, @required this.clinicsHaveScheduleList}); @override _ScheduleClinicCardState createState() => _ScheduleClinicCardState(); @@ -18,29 +18,68 @@ class ScheduleClinicCard extends StatefulWidget { class _ScheduleClinicCardState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( - child: Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.transparent, + ), + child: Container( + decoration: BoxDecoration( + color: CustomColors.green, + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), ), child: Container( - width: MediaQuery.of(context).size.width * 0.8, - padding: EdgeInsets.all(12.0), + margin: EdgeInsets.only( + left: projectViewModel.isArabic + ? 0 + : widget.isSelected + ? 4 + : 6, + right: projectViewModel.isArabic + ? widget.isSelected + ? 4 + : 6 + : 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ Container( child: Text( - widget.languageID == 'ar' - ? widget.clinicsHaveScheduleList.clinicDescN != null ? widget.clinicsHaveScheduleList.clinicDescN: "" - : widget.clinicsHaveScheduleList.clinicDesc != null ? widget.clinicsHaveScheduleList.clinicDesc: "Test Clinic", - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), + widget.clinicsHaveScheduleList.clinicDesc, + style: TextStyle( + fontSize: 16.0, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + ), ), ], ), diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 00c2b717..e07c5615 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; 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'; @@ -21,188 +23,77 @@ class _LiveCareTypeSelectState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - leading: InkWell( - onTap: () { - Navigator.pop(context, null); - }, - child: Icon( - Icons.close, - color: Colors.white, - ), - ), - title: Text(TranslationBase.of(context).bookAppo, - style: TextStyle(color: Colors.white)), - ), + return AppScaffold( + isShowDecPage: true, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).livecare.toUpperCase(), body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).livecareService, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0, bottom: 10.0), - child: Image.asset( - languageID == 'ar' - ? "assets/images/new-design/liveCare_ar_bg.png" - : "assets/images/new-design/liveCare_en_bg.png", - width: 120), - ), - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).livecareService, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).livecareServiceDesc, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18.0))), + margin: EdgeInsets.only(top: 7.0), + child: Text(TranslationBase.of(context).livecareServiceDesc, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).whyLivecare, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).whyLivecare, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.only(top: 20.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).livecarePoint1, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(TranslationBase.of(context).livecarePoint1, + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns4, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns5, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( margin: EdgeInsets.only(top: 20.0), - child: Text( - TranslationBase.of(context).livecareSummary, - style: TextStyle(fontSize: 16.0))), - InkWell( - onTap: (){ - Navigator.pop(context, "immediate"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red[900], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 120.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon_white.svg", - width: 80), - ), - Container( - width: MediaQuery.of(context).size.width * 0.56, - margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0), - child: Column( - children: [ - Text(TranslationBase.of(context).livecareOption1, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption2, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), - ), - InkWell( - onTap: (){ - Navigator.pop(context, "schedule"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[700], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 120.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Image.asset( - "assets/images/new-design/calendar.png", - width: 70), - ), - Container( - width: MediaQuery.of(context).size.width * 0.58, - margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0), - child: Column( - children: [ - Container( - child: Text(TranslationBase.of(context).livecareOption3, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption4, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), + child: Text(TranslationBase.of(context).livecareSummary, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), + + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 40.0), + shrinkWrap: true, + children: [ + _loginOptionButton(TranslationBase.of(context).livecareOption1, 'assets/images/new/Live_Care.svg', 1), + _loginOptionButton(TranslationBase.of(context).livecareOption4, 'assets/images/new/book appointment.svg', 2), + ], ), SizedBox( height: 40.0, @@ -214,6 +105,44 @@ class _LiveCareTypeSelectState extends State { ); } + Widget _loginOptionButton(String _title, String _icon, int _loginIndex) { + return InkWell( + onTap: () { + if (_loginIndex == 1) { + Navigator.pop(context, "immediate"); + } else { + Navigator.pop(context, "schedule"); + } + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: _loginIndex == 1 ? 60 : 50, + width: _loginIndex == 1 ? 60 : 50, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); + } + getLanguageID() async { var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { diff --git a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart index d5fce79e..df0a5286 100644 --- a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart +++ b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class ClinicTimingsDialog extends StatefulWidget { @@ -31,7 +32,7 @@ class _ClinicTimingsDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.68, + height: 580.0, margin: EdgeInsets.all(20.0), width: 450.0, child: Column( @@ -41,7 +42,7 @@ class _ClinicTimingsDialogState extends State { Container( alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0), - child: Text("Clinic Schedule", + child: Text(TranslationBase.of(context).clinicSchedule, textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), @@ -98,7 +99,7 @@ class _ClinicTimingsDialogState extends State { Navigator.pop(context); }, child: Container( - child: Text("OK", + child: Text(TranslationBase.of(context).ok, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 36e8274f..91659278 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -1,20 +1,29 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_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/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.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 LiveCareHistoryCard extends StatefulWidget { ErRequestHistoryList erRequestHistoryList; + int isFirstOrLast; - LiveCareHistoryCard({this.erRequestHistoryList}); + LiveCareHistoryCard({this.erRequestHistoryList, this.isFirstOrLast}); @override _LiveCareHistoryCardState createState() => _LiveCareHistoryCardState(); @@ -24,6 +33,8 @@ class _LiveCareHistoryCardState extends State { AuthenticatedUser authUser = new AuthenticatedUser(); AppSharedPreferences sharedPref = AppSharedPreferences(); + ProjectViewModel projectViewModel; + @override void initState() { getAuthenticatedUser(); @@ -32,143 +43,193 @@ class _LiveCareHistoryCardState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + margin: EdgeInsets.only(left: 12, right: 12, top: widget.isFirstOrLast == 0 ? 12 : 6, bottom: widget.isFirstOrLast == 1 ? 12 : 6), + decoration: BoxDecoration( + color: CustomColors.accentColor, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - child: Container( - width: MediaQuery.of(context).size.width, - // height: MediaQuery.of(context).size.height * 0.22, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text("Requested date:", - style: - TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(widget.erRequestHistoryList.sArrivalTime, - style: TextStyle(fontSize: 14.0)), - Text( - "Call Duration\n" + - getCallTime( - widget.erRequestHistoryList.callDuration), - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 14.0, color: Colors.grey[600])), - ], - ), - ), - Container( - padding: EdgeInsets.all(7.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.green, - ), - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text(widget.erRequestHistoryList.stringCallStatus, - style: TextStyle(fontSize: 14.0, color: Colors.white)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 0, right: projectViewModel.isArabic ? 0 : 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(10), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(10), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + widget.erRequestHistoryList.stringCallStatus , + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.green, + //color: widget.erRequestHistoryList.stringCallStatus == "Completed" ? CustomColors.green : CustomColors.orange, ), - Divider( - color: Colors.grey[500], + ), + mHeight(12), + Text( + TranslationBase.of(context).requestedDate + ": " + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.erRequestHistoryList.arrivalTime)), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), - Container( - margin: EdgeInsets.all(5.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: InkWell( - onTap: () { - print("Invoice"); - openInvoice(); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.content_paste, color: Colors.blue), - Container( - margin: EdgeInsets.only(left: 10.0), - child: Text("Invoice", - textAlign: TextAlign.center), + ), + mHeight(4), + Row( + children: [ + Text( + TranslationBase.of(context).callDuration + ": ", + style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), + ), + Text( + getCallTime(widget.erRequestHistoryList.callDuration), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ),mHeight(12), + Container( + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + openInvoice(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset("assets/images/new/services/invoice_list.svg",width: 18,height: 18,), + mWidth(10), + Text( + TranslationBase.of(context).invoice, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, ), - ], - ), + ), + ], ), ), ), - Expanded( - child: InkWell( - onTap: () { - print("Complaints"); - openComplaint(); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.add, size: 24.0, color: Colors.red), - Container( - margin: EdgeInsets.only(left: 10.0), - child: Text("Complaints", - textAlign: TextAlign.center), + ), + mWidth(12), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + openComplaint(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 7, bottom: 7), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset("assets/images/new/services/raise_comp.svg",width: 16,height: 16,), + mWidth(10), + Expanded( + child: AutoSizeText( + TranslationBase.of(context).complaint, + textAlign: TextAlign.center, + maxLines: 1,minFontSize: 8, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, + ), ), - ], - ), + ), + ], ), ), ), - Expanded( - child: InkWell( - onTap: () { - print("Rate Dr & Appointment"); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.star, - size: 24.0, color: Colors.yellow[700]), - Container( - width: MediaQuery.of(context).size.width * 0.2, - margin: EdgeInsets.only(left: 10.0), - child: Text("Rate Dr & Appointment", - overflow: TextOverflow.clip, - textAlign: TextAlign.center), + ), + mWidth(12), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + rateLiveCareAppo(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + Icon( Icons.star,size: 18,), + mWidth(10), + Text( + TranslationBase.of(context).rate, + overflow: TextOverflow.clip, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, ), - ], - ), + ), + ], ), ), ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), ), ); } + rateLiveCareAppo() { + if (widget.erRequestHistoryList.isAppointmentHaveRating) { + AppToast.showErrorToast(message: TranslationBase.of(context).alreadyRated); + } else {} + } + openInvoice() { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: "Send a copy of this invoice to the email: " + - authUser.emailAddress, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {sendInvoiceEmail(context)}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + sendInvoiceEmail(context); + }, + ), + ); } openComplaint() { @@ -176,17 +237,10 @@ class _LiveCareHistoryCardState extends State { } sendInvoiceEmail(context) { - ConfirmDialog.closeAlertDialog(context); LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .sendLiveCareInvoiceEmail( - widget.erRequestHistoryList.appointmentNo.toString(), - widget.erRequestHistoryList.projectID, - authUser.emailAddress, - context) - .then((res) { - AppToast.showSuccessToast(message: "LiveCare invoice sent successfully"); + service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { + AppToast.showSuccessToast(message: TranslationBase(context).emailSentSuccessfully); }).catchError((err) { AppToast.showErrorToast(message: err); print(err); @@ -195,8 +249,7 @@ class _LiveCareHistoryCardState extends State { getAuthenticatedUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index c06c9464..1e2eaa1b 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class LiveCarePaymentDialog extends StatefulWidget { GetERAppointmentFeesList getERAppointmentFeesList; @@ -20,20 +23,24 @@ class LiveCarePaymentDialog extends StatefulWidget { class _LiveCarePaymentDialogState extends State { int _selected = 0; + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; final double itemWidth = size.width / 2; + projectViewModel = Provider.of(context); return Container( child: Dialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.691, + height: 600.0, margin: EdgeInsets.all(20.0), - width: 450.0, + width: 500.0, + color: Colors.red, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -66,7 +73,7 @@ class _LiveCarePaymentDialogState extends State { ), ), Expanded( - child: Text(widget.waitingTime.toString() + " Minutes", + child: Text(widget.waitingTime.toString() + " " + TranslationBase.of(context).minute, textAlign: TextAlign.start, style: TextStyle( fontSize: 16.0, @@ -76,10 +83,8 @@ class _LiveCarePaymentDialogState extends State { ], ), Container( - alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text(widget.clinicName, - textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), ), @@ -156,7 +161,7 @@ class _LiveCarePaymentDialogState extends State { children: [ Image.asset("assets/images/new-design/alert-triangle.png"), Container( - margin: EdgeInsets.only(left: 10.0), + margin: EdgeInsets.only(left: 10.0, right: 10.0), width: MediaQuery.of(context).size.width * 0.55, child: Text(TranslationBase.of(context).insuredPatient, style: TextStyle(fontSize: 13.0)), @@ -181,14 +186,6 @@ class _LiveCarePaymentDialogState extends State { style: new TextStyle(fontSize: 14.0), ), ), -// Container( -//// alignment: Alignment.centerRight, -// child: new Text( -// 'Click Here', -// textAlign: TextAlign.end, -// style: new TextStyle(fontSize: 16.0), -// ), -// ), ], ), ), @@ -197,21 +194,13 @@ class _LiveCarePaymentDialogState extends State { color: Colors.grey[400], ), Container( - alignment: Alignment.center, margin: EdgeInsets.only(top: 10.0), child: new Text( TranslationBase.of(context).upComingPayOption, - textAlign: TextAlign.center, style: new TextStyle(fontSize: 14.0), ), ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset( - "assets/images/new-design/payment_options_invoice_confirmation.png", - width: 300), - ), + Container(margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), child: getPaymentMethods()), Divider( thickness: 1.0, color: Colors.grey[400], @@ -228,7 +217,7 @@ class _LiveCarePaymentDialogState extends State { Navigator.pop(context, false); }, child: Container( - child: Text("Cancel", + child: Text(TranslationBase.of(context).cancel, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, color: Colors.red[700])), @@ -247,7 +236,7 @@ class _LiveCarePaymentDialogState extends State { } }, child: Container( - child: Text("Ok", + child: Text(TranslationBase.of(context).ok, textAlign: TextAlign.center, style: TextStyle( fontSize: 18.0, @@ -275,10 +264,9 @@ class _LiveCarePaymentDialogState extends State { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), child: Text(text, - textAlign: TextAlign.end, + textAlign: TextAlign.start, style: TextStyle( fontSize: 14, - fontFamily: 'Open-Sans', letterSpacing: 0.5, color: Colors.black)), ); @@ -288,10 +276,9 @@ class _LiveCarePaymentDialogState extends State { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), child: Text(text, - textAlign: TextAlign.end, + textAlign: TextAlign.start, style: TextStyle( fontSize: 14, - fontFamily: 'Open-Sans', letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index 839fb02c..26d2e829 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -132,6 +132,7 @@ class _LiveCarePendingRequestState extends State { child: RaisedButton( color: Colors.red[800], textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 6a7573d7..0f534d98 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -1,10 +1,17 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.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_new.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:provider/provider.dart'; +import '../clinic_timings_page.dart'; import 'ClinicTimingsDialog.dart'; // ignore: must_be_immutable @@ -14,11 +21,7 @@ class ClinicCard extends StatefulWidget { var languageID; int isOnline; - ClinicCard( - {this.isSelected, - this.languageID, - this.isOnline, - @required this.patientERGetClinicsList}); + ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList}); @override _State createState() => _State(); @@ -35,99 +38,160 @@ class _State extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 8.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : widget.patientERGetClinicsList.isOnline == 1 ? Colors.white : Colors.grey, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), - child: Container( - width: MediaQuery.of(context).size.width * 0.75, - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - child: Text( - widget.languageID == 'ar' - ? widget.patientERGetClinicsList.serviceNameN - : widget.patientERGetClinicsList.serviceName, - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), - ), - ], - ), + ], + color: Colors.transparent, + ), + child: Container( + decoration: BoxDecoration( + color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), ), - InkWell( - onTap: () { - getClinicTimings(widget.patientERGetClinicsList); - }, - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 8.0), + child: Container( + margin: EdgeInsets.only( + left: projectViewModel.isArabic + ? 0 + : widget.isSelected + ? 4 + : 6, + right: projectViewModel.isArabic ? widget.isSelected + ? 4 + : 6: 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - child: Container( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Icon(Icons.access_time, size: 26.0, color: Colors.red[800]), - ], + ), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Container( + width: 4, + height: 4, + decoration: containerRadius( + widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + 100, + ), + ), + mWidth(4), + Text( + widget.patientERGetClinicsList.isOnline == 1 ? TranslationBase.of(context).onlineTag : TranslationBase.of(context).offlineTag, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ), ), - ), + InkWell( + onTap: (){ getClinicTimings(widget.patientERGetClinicsList);}, + child: Container( + padding: EdgeInsets.only(left: 8,right: 8,top: 4,bottom: 4), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset( + "assets/images/new-design/ic_schedule.svg", + width: 16, + height: 16, + color: Colors.black, + ), + mWidth(4), + Text( + TranslationBase.of(context).schedule, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ), + ], ), ), - ], + ), ); } getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) - .then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - clinicsServiceTimingsResponse = - ClinicsServiceTimingsResponse.fromJson(res); - print(clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList.length); + clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res); + print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length); - 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: ClinicTimingsDialog( - clinicName: patientERGetClinicsList.serviceName, - patientERGetClinicsServiceTimingsList: - clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList, - ), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); + navigateTo(context, ClinicTimingsPage( + clinicName: patientERGetClinicsList.serviceName, + patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, + )); + // 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: ClinicTimingsDialog( + // clinicName: patientERGetClinicsList.serviceName, + // patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, + // ), + // ), + // ); + // }, + // transitionDuration: Duration(milliseconds: 500), + // barrierDismissible: true, + // barrierLabel: '', + // context: context, + // pageBuilder: (context, animation1, animation2) {}); }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 94bce343..bf4d33c7 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; @@ -15,17 +16,22 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.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/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../live_care_payment_page.dart'; + class ClinicList extends StatefulWidget { final Function getLiveCareHistory; @@ -58,8 +64,6 @@ class _clinic_listState extends State { MyInAppBrowser browser; - bool isLiveCareTypeSelected = false; - String liveCareClinicIDs; @override @@ -72,8 +76,13 @@ class _clinic_listState extends State { liveCareScheduleClinicsListResponse = new LiveCareScheduleClinicsListResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (!isLiveCareTypeSelected) { + if (LiveCareHome.isLiveCareTypeSelected != true) { openLiveCareSelectionDialog(); + } else { + setState(() { + currentSelectedLiveCareType = "immediate"; + getLiveCareClinicsList(); + }); } }); @@ -83,7 +92,9 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView(child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList()); + return Container( + child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), + ); } void startLiveCare() { @@ -157,7 +168,6 @@ class _clinic_listState extends State { GifLoaderDialogUtils.showMyDialog(context); service.getERAppointmentTime(selectedClinicID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -167,32 +177,43 @@ class _clinic_listState extends State { } showLiveCarePaymentDialog(GetERAppointmentFeesList getERAppointmentFeesList, int waitingTime) { - 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: LiveCarePaymentDialog(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName), - ), - ); - }, - 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") { - showLiveCareInfoDialog(getERAppointmentFeesList); - } else { - navigateToPaymentMethod(getERAppointmentFeesList, context); + navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then( + (value) { + if (value) { + if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + showLiveCareInfoDialog(getERAppointmentFeesList); + } else { + navigateToPaymentMethod(getERAppointmentFeesList, context); + } } - } - }); + }, + ); + // 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: LiveCarePaymentDialog(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName), + // ), + // ); + // }, + // 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") { + // showLiveCareInfoDialog(getERAppointmentFeesList); + // } else { + // navigateToPaymentMethod(getERAppointmentFeesList, context); + // } + // } + // }); } showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { @@ -236,6 +257,7 @@ class _clinic_listState extends State { appo.clinicID = selectedClinicID; appo.appointmentNo = DateTime.now().millisecondsSinceEpoch; + appo.projectID = 12; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -244,7 +266,9 @@ class _clinic_listState extends State { }); } - Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { print(value); if (value != null) { openPayment(value, authUser, double.parse(getERAppointmentFeesList.total), appo); @@ -253,9 +277,9 @@ class _clinic_listState extends State { } openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { - browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(12, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod, + browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod, authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID.toString()); } @@ -368,7 +392,6 @@ class _clinic_listState extends State { if (res['MessageStatus'] == 1) { setState(() { liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse.fromJson(res); - print(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length); selectedClinicID = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].serviceID; selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].clinicDesc; isDataLoaded = true; @@ -405,15 +428,16 @@ class _clinic_listState extends State { Navigator.pop(context); } else { print(value); - isLiveCareTypeSelected = true; if (value == "immediate") { setState(() { + LiveCareHome.isLiveCareTypeSelected = true; currentSelectedLiveCareType = "immediate"; }); getLiveCareClinicsList(); } if (value == "schedule") { setState(() { + LiveCareHome.isLiveCareTypeSelected = true; currentSelectedLiveCareType = "schedule"; }); getLiveCareScheduleClinicsList(); @@ -427,67 +451,63 @@ class _clinic_listState extends State { return Column( children: [ isDataLoaded - ? Container( - height: MediaQuery.of(context).size.height * 0.7, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ -// Container( -// margin: EdgeInsets.all(15.0), -// child: Text("Online Clinics: ", -// style: TextStyle( -// fontSize: 20.0, fontWeight: FontWeight.bold)), -// ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); - }, - child: ScheduleClinicCard( - isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, - clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], - languageID: languageID, - ), - ); - }, - ), - Container( - height: 10.0, - ), - ], + ? Expanded( + child: Container( + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mHeight(10), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); + }, + child: ScheduleClinicCard( + isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, + clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 10.0, + ), + ], + ) + : getNoDataWidget(context), ), - ) + ) : Container(), isDataLoaded - ? Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: startScheduleLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), - ), - ), + ? Container( + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), ), - ) + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startScheduleLiveCare, + child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), + ), + ), + ) : Container(), ], ); @@ -497,93 +517,67 @@ class _clinic_listState extends State { return Column( children: [ isDataLoaded - ? Container( - height: MediaQuery.of(context).size.height * 0.7, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text("Online Clinics: ", style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, - itemCount: liveCareOnlineClinicsListResponse.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); - }, - child: ClinicCard( - isSelected: selectedClinicID == liveCareOnlineClinicsListResponse[index].serviceID ? true : false, - patientERGetClinicsList: liveCareOnlineClinicsListResponse[index], - languageID: languageID, - ), - ); - }, - ), - Container( - margin: EdgeInsets.all(15.0), - child: Text("Offline Clinics: ", style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, - itemCount: liveCareOfflineClinicsListResponse.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - // if (liveCareClinicsListResponse.patientERGetClinicsList[index].isOnline == 1) { - // updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); - // } else { - // AppToast.showErrorToast(message: "Clinic is offline"); - // } - }, - child: ClinicCard( + ? Expanded( + child: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: const EdgeInsets.only(top: 16.0), + itemCount: liveCareOnlineClinicsListResponse.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == liveCareOnlineClinicsListResponse[index].serviceID ? true : false, + patientERGetClinicsList: liveCareOnlineClinicsListResponse[index], + languageID: languageID, + ), + ); + }, + ), + // Container( + // margin: EdgeInsets.all(15.0), + // child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareOfflineClinicsListResponse.length, + itemBuilder: (context, index) { + return ClinicCard( isSelected: selectedClinicID == liveCareOfflineClinicsListResponse[index].serviceID ? true : false, patientERGetClinicsList: liveCareOfflineClinicsListResponse[index], languageID: languageID, - ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - )), + ); + }, + ), + Container( + height: 10.0, + ), + ], + )), + ), ) : Container(), isDataLoaded - ? Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: startLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), - ), - ), + ? Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(16), + child: DefaultButton( + TranslationBase.of(context).start, + () { + startLiveCare(); + }, ), ) : Container(), @@ -632,7 +626,7 @@ class _clinic_listState extends State { } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: true, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { diff --git a/lib/pages/livecare/widgets/livecare_logs.dart b/lib/pages/livecare/widgets/livecare_logs.dart index a7f7fdc0..8898faa6 100644 --- a/lib/pages/livecare/widgets/livecare_logs.dart +++ b/lib/pages/livecare/widgets/livecare_logs.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareHistoryCard.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; class LiveCareLogs extends StatefulWidget { @@ -20,21 +21,25 @@ class _LiveCareLogsState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - child: Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.erRequestHistoryList.length, - itemBuilder: (context, index) { - return widget.erRequestHistoryList[index].callStatus < 4 - ? Container() - : LiveCareHistoryCard( - erRequestHistoryList: widget.erRequestHistoryList[index]); - }, - ), - ), + child: widget.erRequestHistoryList.length > 0 + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.erRequestHistoryList.length, + itemBuilder: (context, index) { + return widget.erRequestHistoryList[index].callStatus < 4 + ? Container() + : LiveCareHistoryCard( + erRequestHistoryList: widget.erRequestHistoryList[index], + isFirstOrLast: index==0?0:(index==widget.erRequestHistoryList.length-1)?1:2, + ); + }, + ), + ) + : Container(margin: EdgeInsets.only(top: 200.0), child: getNoDataWidget(context)), ); } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 35e9ee15..1903e561 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,9 +1,11 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -11,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -20,23 +23,26 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -// import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmLogin extends StatefulWidget { + final Function changePageViewIndex; + + const ConfirmLogin({Key key, this.changePageViewIndex}) : super(key: key); + @override _ConfirmLogin createState() => _ConfirmLogin(); } @@ -47,8 +53,7 @@ class _ConfirmLogin extends State { var sharedPref = new AppSharedPreferences(); bool authenticated; final authService = new AuthProvider(); - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); int mobileNumber; String errorMsg = ''; SelectDeviceIMEIRES user; @@ -78,14 +83,16 @@ class _ConfirmLogin extends State { int fingrePrintBefore; - AuthenticatedUserObject authenticatedUserObject = - locator(); - AppointmentRateViewModel appointmentRateViewModel = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); + AppointmentRateViewModel appointmentRateViewModel = locator(); ProjectViewModel projectViewModel; ToDoCountProviderModel toDoProvider; + var dob; + int isHijri; + var healthId; + @override void initState() { _getAvailableBiometrics(); @@ -97,168 +104,178 @@ class _ConfirmLogin extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); - return AppScaffold( - appBarTitle: TranslationBase.of(context).confirm, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(20), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - children: [ - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + + return Scaffold( + backgroundColor: Color(0xfff8f8f8), + resizeToAvoidBottomPadding: false, + appBar: AppBar( + backgroundColor: Colors.transparent, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Color(0xff2B353E), + onPressed: () => Navigator.pop(context), + ), + ), + body: Padding( + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + if (user != null && isMoreOption == false) + Column( + mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 90, - width: 90, + children: [ + Text( + TranslationBase.of(context).welcomeBack, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), - Texts( - TranslationBase.of(context).welcomeBack + - ' ' + - user.name, - fontSize: SizeConfig.textMultiplier * 3.5, - ), - SizedBox( - height: 20, + Text( + user.name.toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), ), - Texts( + SizedBox(height: 10), + Text( TranslationBase.of(context).accountInfo, - fontSize: SizeConfig.textMultiplier * 2.5, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), ), - SizedBox( - height: 20, - ), - Card( - color: Colors.grey[300], - child: Row( - children: [ - Flexible( - child: ListTile( - title: Text( - TranslationBase.of(context).lastLoginAt, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - ), - subtitle: Text( - user.editedOn != null - ? formatDate( - DateUtil.convertStringToDate( - user.editedOn)) - : user.createdOn != null - ? formatDate( - DateUtil.convertStringToDate( - user.createdOn)) - : '--', - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center), - )), - Flexible( - child: ListTile( - title: Text( - TranslationBase.of(context).lastLoginWith, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center), - subtitle: Text( - getType(user.logInType, context), - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center), - )) - ], - )), - ], - ) - : Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/habib-logo.png', - height: 90, - width: 90, + Container( + height: 72, + margin: EdgeInsets.only(top: 23, bottom: 23), + alignment: Alignment.center, + padding: EdgeInsets.only(left: 17, right: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), ), - this.onlySMSBox == false - ? Texts( - TranslationBase.of(context).verifyLoginWith, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.left, - ) - : Texts( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: SizeConfig.textMultiplier * 2.5, - textAlign: TextAlign.start, - ), - ]), - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - authenticateUser( - 3, BiometricType.face.index) - }, - child: getButton(user.logInType))), - Expanded(child: getButton(5)) - ]) - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: getButton(3)), - Expanded(child: getButton(2)) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child: getButton(1)), - Expanded(child: getButton(4)) + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).lastLoginAt.toCamelCase, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), + ), + Text( + user.editedOn != null + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn)) + : user.createdOn != null + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn)) + : '--', + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + TranslationBase.of(context).lastLoginWith.toCamelCase, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + ), + ), + Text( + " " + getType(user.logInType, context), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + ), + ), + Expanded(child: SizedBox()), + Text( + user.editedOn != null + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn), false) + : user.createdOn != null + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn), false) + : '--', + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), + ), + ], + ) ], ), - ]), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - user != null - ? Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).useAnotherAccount, - () => { - Navigator.of(context).pushNamed( - LOGIN_TYPE, - ) - }, - )), - ], - ) - : SizedBox(), - ], - ), - ) - ], - ), + ), + Text( + TranslationBase.of(context).pleaseVerify, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 9), + shrinkWrap: true, + children: [ + getButton(3), + getButton(2), + getButton(1), + getButton(4), + ], + ) + ], + ) + else + Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Image.asset( + 'assets/images/habib-logo.png', + height: 90, + width: 90, + ), + SizedBox(height: 23), + this.onlySMSBox == false + ? Text( + TranslationBase.of(context).verifyLoginWith, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), + ) + : Text( + TranslationBase.of(context).verifyFingerprint2, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), + ), + SizedBox(height: 23), + Text( + TranslationBase.of(context).pleaseVerify, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 9), + shrinkWrap: true, + children: [ + if (onlySMSBox == false) getButton(3), + if (onlySMSBox == false) getButton(2), + getButton(1), + getButton(4), + ], + ), + ]), + ], + ), + ), + SizedBox( + height: 12, + ), + DefaultButton( + TranslationBase.of(context).useAnotherAccount, + () => {Navigator.of(context).pushNamed(LOGIN_TYPE)}, + ), + ], ), ), ); @@ -279,7 +296,7 @@ class _ConfirmLogin extends State { }); } - authenticateUser(type, isActive) { + authenticateUser(int type, {int isActive}) { GifLoaderDialogUtils.showMyDialog(context); if (type == 2 || type == 3) { fingrePrintBefore = type; @@ -288,7 +305,7 @@ class _ConfirmLogin extends State { switch (type) { case 1: - this.loginWithSMS(type, isActive); + this.loginWithSMS(type); break; case 2: this.loginWithFingurePrintFace(type, isActive); @@ -297,16 +314,15 @@ class _ConfirmLogin extends State { this.loginWithFingurePrintFace(type, isActive); break; case 4: - this.loginWithSMS(type, isActive); + this.loginWithSMS(type); break; default: break; } - sharedPref.setInt(LAST_LOGIN, - this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN); + sharedPref.setInt(LAST_LOGIN, this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN); } - loginWithSMS(type, isActive) { + loginWithSMS(type) { //if (!el.disabled) { if (this.user != null && this.registerd_data == null) { this.checkUserAuthentication(type); @@ -357,17 +373,39 @@ class _ConfirmLogin extends State { var request = this.getCommonRequest(type: type); request.sMSSignature = await SMSOTP.getSignature(); GifLoaderDialogUtils.showMyDialog(context); - await this.authService.sendActivationCode(request).then((result) { - GifLoaderDialogUtils.hideDialog(context); - if (result != null && result['isSMSSent'] == true) { - this.startSMSService(type); - } - }).catchError((r) { - GifLoaderDialogUtils.hideDialog(context); - }); + if (healthId != null) { + // final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); + // final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); + request.healthId = healthId; + request.isHijri = isHijri; + await this.authService.sendActivationCodeRegister(request).then((result) { + GifLoaderDialogUtils.hideDialog(context); + if (result != null && result['isSMSSent'] == true) { + this.startSMSService(type); + } + }).catchError((r) { + GifLoaderDialogUtils.hideDialog(context); + }); + } else { + request.dob = ""; + request.healthId = ""; + request.isHijri = 0; + await this.authService.sendActivationCode(request).then((result) { + GifLoaderDialogUtils.hideDialog(context); + if (result != null && result['isSMSSent'] == true) { + this.startSMSService(type); + } + }).catchError((r) { + GifLoaderDialogUtils.hideDialog(context); + }); + } } + var tempType; + startSMSService(type) { + tempType = type; new SMSOTP( context, type, @@ -377,38 +415,30 @@ class _ConfirmLogin extends State { }, () => { Navigator.pop(context), - print('Faild..'), }, ).displayDialog(context); } - loginWithFingurePrintFace(type, isActive) async { - if (isActive == 1) { - // this.startBiometricLoginIfAvailable(); - const iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please reenable your Touch ID'); + loginWithFingurePrintFace(type, int isActive) async { + if (isActive == 1 || isActive == 0) { + const iosStrings = + const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); try { - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true, - iOSAuthStrings: iosStrings); + authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: 'Please enable your Touch or Face ID'); } if (authenticated == true) { - if (user != null && (user.logInType == 2 || user.logInType == 3)) { - this.checkActivationCode(); - } else { - var request = this.getCommonRequest(type: type); - this.getMobileInfo(request); - } + // if (user != null && (user.logInType == 2 || user.logInType == 3)) { + // this.checkActivationCode(); + // } else { + + var request = this.getCommonRequest(type: type); + this.getMobileInfo(request); + //} } } } @@ -418,13 +448,18 @@ class _ConfirmLogin extends State { this.authService.getLoginInfo(request).then((result) { GifLoaderDialogUtils.hideDialog(context); if (result['SMSLoginRequired'] == false) { - this.loginTokenID = result.logInTokenID; - this.patientOutSA = result.patientOutSA; + this.loginTokenID = result['LogInTokenID']; + this.patientOutSA = result['PatientOutSA']; // sms for register the biometric - if (result.isSMSSent) { - this.onlySMSBox = false; + if (result['isSMSSent']) { + setState(() { + isMoreOption = true; + this.onlySMSBox = true; + // this.fingrePrintBefore = true; + }); //this.button(); } else { + setDefault(); checkActivationCode(); } } else { @@ -443,19 +478,14 @@ class _ConfirmLogin extends State { } setDefault() async { - if (await sharedPref.getObject(IMEI_USER_DATA) != null) - user = SelectDeviceIMEIRES.fromJson( - await sharedPref.getObject(IMEI_USER_DATA)); + if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson(await sharedPref.getObject(IMEI_USER_DATA)); if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) { isMoreOption = true; - this.registerd_data = CheckPatientAuthenticationReq.fromJson( - await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); + this.registerd_data = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); } - this.mobileNumber = this.registerd_data != null - ? this.registerd_data.patientMobileNumber - : int.parse(this.user.mobile); + this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile); this.zipCode = this.registerd_data != null ? this.registerd_data.zipCode : this.user.outSA == true @@ -470,6 +500,15 @@ class _ConfirmLogin extends State { this.loginTokenID = await sharedPref.getString(LOGIN_TOKEN_ID); this.loginType = this.registerd_data.searchType; } + var nhic = await sharedPref.getObject(NHIC_DATA); + if (nhic != null) { + final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); + final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); + + isHijri = nhic['IsHijri'] ? 1 : 0; + healthId = nhic['HealthId']; + } this.deviceToken = await sharedPref.getString(PUSH_TOKEN); this.lastLogin = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) @@ -487,33 +526,22 @@ class _ConfirmLogin extends State { request.deviceToken = this.deviceToken; request.projectOutSA = this.patientOutSA == true ? true : false; request.loginType = this.selectedOption; - request.oTPSendType = - type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; + request.oTPSendType = type == 1 ? type : 2; //this.selectedOption == 1 ? 1 : 2; request.zipCode = this.zipCode; request.logInTokenID = this.loginTokenID ?? ""; if (this.registerd_data != null) { - request.searchType = this.registerd_data.searchType != null - ? this.registerd_data.searchType - : 1; - request.patientID = this.registerd_data.patientID != null - ? this.registerd_data.patientID - : 0; - request.patientIdentificationID = request.nationalID = - this.registerd_data.patientIdentificationID != null - ? this.registerd_data.patientIdentificationID - : '0'; + request.searchType = this.registerd_data.searchType != null ? this.registerd_data.searchType : 1; + request.patientID = this.registerd_data.patientID != null ? this.registerd_data.patientID : 0; + request.patientIdentificationID = request.nationalID = this.registerd_data.patientIdentificationID != null ? this.registerd_data.patientIdentificationID : '0'; request.isRegister = this.registerd_data.isRegister; } else { request.searchType = request.searchType != null ? request.searchType : 2; request.patientID = this.user.patientID != null ? this.user.patientID : 0; - request.nationalID = - request.nationalID != null ? request.nationalID : '0'; - request.patientIdentificationID = request.patientIdentificationID != null - ? request.patientIdentificationID - : '0'; + request.nationalID = request.nationalID != null ? request.nationalID : '0'; + request.patientIdentificationID = request.patientIdentificationID != null ? request.patientIdentificationID : '0'; request.isRegister = false; } request.deviceTypeID = request.searchType; @@ -521,101 +549,135 @@ class _ConfirmLogin extends State { } checkActivationCode({value}) async { + // Navigator.pop(context); GifLoaderDialogUtils.showMyDialog(context); var request = this.getCommonRequest().toJson(); - - authService - .checkActivationCode(request, value) - .then((result) => { - if (result is Map) - { - result = CheckActivationCode.fromJson(result), - if (this.registerd_data != null && - this.registerd_data.isRegister == true) - { - Navigator.of(context).pushNamed( - REGISTER_INFO, - ) - } - else - { - sharedPref.remove(FAMILY_FILE), - result.list.isFamily = false, - userData = result.list, - // sharedPref.setString( - // BLOOD_TYPE, result['PatientBloodType']), - authenticatedUserObject.user = result.list, - - sharedPref.setObject(MAIN_USER, result.list), - sharedPref.setObject(USER_PROFILE, result.list), - loginTokenID = result.logInTokenID, - sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), - sharedPref.setString(TOKEN, result.authenticationTokenID), - checkIfUserAgreedBefore(result), - } - } - else - { - // Navigator.of(context).pop(), - GifLoaderDialogUtils.hideDialog(context), - Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: result); - }), - } - }) - .catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - Future.delayed(Duration(seconds: 1), () { - AppToast.showErrorToast(message: err); + dynamic res; + if (healthId != null) { + request['DOB'] = dob; + request['HealthId'] = healthId; + request['IsHijri'] = isHijri; + + authService + .checkActivationCodeRegister(request, value) + .then((result) => { + res = result, + if (result is Map) + { + result = CheckActivationCode.fromJson(result), + if (this.registerd_data != null && this.registerd_data.isRegister == true) + { + widget.changePageViewIndex(1), + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), + } + } + else + { + // Navigator.of(context).pop(), + GifLoaderDialogUtils.hideDialog(context), + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: result); + }), + } + }) + .catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + startSMSService(tempType); + }); }); - }); + } else { + authService + .checkActivationCode(request, value) + .then((result) => { + res = result, + if (result is Map) + { + result = CheckActivationCode.fromJson(result), + if (this.registerd_data != null && this.registerd_data.isRegister == true) + { + widget.changePageViewIndex(1), + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), + } + else + { + sharedPref.remove(FAMILY_FILE), + result.list.isFamily = false, + userData = result.list, + sharedPref.setString(BLOOD_TYPE, result.patientBloodType), + authenticatedUserObject.user = result.list, + projectViewModel.setPrivilege(privilegeList: res), + sharedPref.setObject(MAIN_USER, result.list), + sharedPref.setObject(USER_PROFILE, result.list), + loginTokenID = result.logInTokenID, + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + sharedPref.setString(TOKEN, result.authenticationTokenID), + checkIfUserAgreedBefore(result), + } + } + else + { + // Navigator.of(context).pop(), + GifLoaderDialogUtils.hideDialog(context), + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: result); + startSMSService(tempType); + }), + } + }) + .catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: err); + startSMSService(tempType); + }); + }); + } } checkIfUserAgreedBefore(CheckActivationCode result) { if (result.isNeedUserAgreement == true) { //move to agreement page. } else { - insertIMEI(); + goToHome(); } } insertIMEI() { - authService - .insertDeviceImei(selectedOption) - .then((value) => {goToHome()}) - .catchError((err) { + authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { print(err); }); } getToDoCount() { - toDoProvider.setState(0, true); + toDoProvider.setState(0, true, "0"); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { - print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true); + toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); } else {} }).catchError((err) { print(err); }); } - goToHome() { + goToHome() async { authenticatedUserObject.isLogin = true; appointmentRateViewModel.isLogin = true; projectViewModel.isLogin = true; projectViewModel.user = authenticatedUserObject.user; - Provider.of(context, listen: false) - .setUser(authenticatedUserObject.user); - getToDoCount(); + await authenticatedUserObject.getUser(getUser: true); + + // getToDoCount(); appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { getToDoCount(), - // GifLoaderDialogUtils.hideDialog(context), + GifLoaderDialogUtils.hideDialog(AppGlobal.context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { Navigator.pushAndRemoveUntil( @@ -633,13 +695,12 @@ class _ConfirmLogin extends State { page: LandingPage(), ), (r) => false) - } + }, + insertIMEI() }) .catchError((err) { print(err); - //GifLoaderDialogUtils.hideDialog(context); }); - // SMSOTP.showLoadingDialog(context, false), } loading(flag) { @@ -648,163 +709,101 @@ class _ConfirmLogin extends State { }); } - Widget getButton(flag) { + Widget _loginOptionButton(String _title, String _icon, int _flag, int _loginIndex) { + bool isDisable = (_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) || _flag == 2 && !checkIfBiometricAvailable(BiometricType.fingerprint)); + + return InkWell( + onTap: isDisable + ? null + : () { + if (_flag == 0) { + setState(() { + isMoreOption = true; + }); + } else { + authenticateUser(_flag, isActive: _loginIndex); + } + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: isDisable ? Colors.grey.withOpacity(0.3) : Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: 38, + width: 38, + color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : null, + ), + Text( + TranslationBase.of(context).verifyThrough + " " + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: isDisable ? Color(0xff2B353E).withOpacity(0.7) : Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); + } + + // todo 'sikander' optimize this after knowing usage + Widget getButton(int flag) { switch (flag) { case 4: - return InkWell( - onTap: () => {authenticateUser(4, true)}, - child: RoundedContainer( - height: 150, - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - child: Column( - children: [ - Image.asset( - 'assets/images/login/104.png', - height: SizeConfig.imageSizeMultiplier * 13, - width: SizeConfig.imageSizeMultiplier * 16, - ), - SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).verifyWhatsApp, - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black) - ], - ), - ))); + return _loginOptionButton(TranslationBase.of(context).verifyWhatsApp, 'assets/images/new/verify_whatsapp.svg', flag, null); break; case 1: - return InkWell( - onTap: () => {authenticateUser(1, true)}, - child: RoundedContainer( - height: 150, - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/login/103.png', - height: SizeConfig.imageSizeMultiplier * 13, - width: SizeConfig.imageSizeMultiplier * 16, - ), - projectViewModel.isArabic - ? SizedBox( - height: 0, - ) - : SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).verifySMS, - fontSize: SizeConfig.textMultiplier * 2, - textAlign: TextAlign.center, - color: Colors.black) - ], - ), - ))); + return _loginOptionButton(TranslationBase.of(context).verifySMS, 'assets/images/new/verify_sms.svg', flag, null); break; case 2: - return InkWell( - onTap: () => {authenticateUser(2, BiometricType.fingerprint.index)}, - child: RoundedContainer( - height: 150, - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - child: Column( - children: [ - Image.asset( - 'assets/images/login/102.png', - height: SizeConfig.imageSizeMultiplier * 13, - width: SizeConfig.imageSizeMultiplier * 16, - ), - SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).verifyFingerprint, - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black) - ], - ), - ))); + return _loginOptionButton(TranslationBase.of(context).verifyFingerprint, 'assets/images/new/verify_thumb.svg', flag, BiometricType.fingerprint.index); break; case 3: - return InkWell( - onTap: () => {authenticateUser(3, BiometricType.face.index)}, - child: RoundedContainer( - height: 150, - backgroundColor: checkIfBiometricAvailable(BiometricType.face) - ? Colors.white - : Colors.white.withOpacity(.7), - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/login/101.png', - height: SizeConfig.imageSizeMultiplier * 13, - width: SizeConfig.imageSizeMultiplier * 16, - ), - SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).verifyFaceID, - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.black) - ], - ), - ))); + return _loginOptionButton(TranslationBase.of(context).verifyFaceID, 'assets/images/new/verify_face.svg', flag, BiometricType.face.index); break; default: return InkWell( - onTap: () => { - setState(() { - isMoreOption = true; - }) - }, - child: RoundedContainer( - height: 150, - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB(0, 0, 0, 5), - child: Column( - children: [ - Image.asset( - 'assets/images/login/more_icon.png', - height: 45, - width: SizeConfig.imageSizeMultiplier * 16, - ), - projectViewModel.isArabic - ? SizedBox( - height: 15, - ) - : SizedBox( - height: 20, - ), - Texts(TranslationBase.of(context).moreVerification, - fontSize: SizeConfig.textMultiplier * 1.8, - textAlign: TextAlign.center, - color: Colors.black) - ], + onTap: () => { + setState(() { + isMoreOption = true; + }) + }, + child: RoundedContainer( + height: 150, + backgroundColor: BiometricType.fingerprint.index == 1 ? Colors.white : Colors.white.withOpacity(.7), + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB(0, 0, 0, 5), + child: Column( + children: [ + Image.asset( + 'assets/images/login/more_icon.png', + height: 45, + width: SizeConfig.imageSizeMultiplier * 16, ), - ))); + projectViewModel.isArabic + ? SizedBox( + height: 15, + ) + : SizedBox( + height: 20, + ), + Texts(TranslationBase.of(context).moreVerification, fontSize: SizeConfig.textMultiplier * 1.8, textAlign: TextAlign.center, color: Colors.black) + ], + ), + ), + ), + ); } } diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index d6478c92..d943ba98 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/habib_logo_widget.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; @@ -27,6 +28,67 @@ class _ForgotPassword extends State { @override Widget build(BuildContext context) { con = context; + + return Scaffold( + backgroundColor: Color(0xfff8f8f8), + appBar: AppBar( + backgroundColor: Colors.transparent, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Color(0xff2B353E), + onPressed: () => Navigator.pop(context), + ), + ), + body: Padding( + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column(children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + HabibLogoWidget(), + SizedBox(height: 50), + Text( + TranslationBase.of(context).forgotDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 20), + PhoneNumberSelectorWidget(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + countryCode = value; + }); + }), + ], + ), + ), + SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + sendPatientIDBySMS(); + }, + child: Text( + TranslationBase.of(context).submit, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + ), + // color: Color(0xffD02127), + color: (mobileNo.length >= 9) == true ? Color(0xffD02127) : Color(0xff575757), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + ), + ]), + ), + ); + return AppScaffold( appBarTitle: TranslationBase.of(context).forgotFileNoTitle, isShowAppBar: true, @@ -82,9 +144,7 @@ class _ForgotPassword extends State { if (mobileNo.length >= 9) sendPatientIDBySMS(); // print(mobileNo.text); }, - color: mobileNo.length >= 9 == true - ? Colors.grey[900] - : Colors.grey, + color: mobileNo.length >= 9 == true ? Colors.grey[900] : Colors.grey, textColor: Colors.white, )), ], diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index f8af8eac..b77d34f3 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -1,184 +1,261 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/login/forgot-password.dart'; import 'package:diplomaticquarterapp/pages/login/login.dart'; -import 'package:diplomaticquarterapp/pages/login/register.dart'; -import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/habib_logo_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; class LoginType extends StatelessWidget { static int loginType = 0; @override Widget build(BuildContext context) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).login, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - padding: - EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - children: [ - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/logo.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).logintypeRadio, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - marginBottom: 20.0, - marginTop: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - LoginType.loginType = 1, - Navigator.of(context) - .push(FadePage(page: Login())), - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 20, 10, 20, 10), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/id_card_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .idNo, - fontSize: SizeConfig - .textMultiplier * - 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))), - Expanded( - child: InkWell( - onTap: () => { - LoginType.loginType = 2, - Navigator.of(context) - .push(FadePage(page: Login())), - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 25, 10, 25, 10), - child: Column( - children: [ - Image.asset( - 'assets/images/my_file_white_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .fileNo, - fontSize: SizeConfig - .textMultiplier * - 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))) - ], - ), - SizedBox( - height: 25, - ), - Divider( - color: Colors.grey, - height: 2, - ), - Center( - child: InkWell( - onTap: () => { - Navigator.of(context) - .push(FadePage(page: ForgotPassword())), - }, - child: AppText( - TranslationBase.of(context) - .forgotPassword, - fontSize: - SizeConfig.textMultiplier * 2.5, - marginTop: 20.0, - underline: true))) - ]), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox( - height: 10, - ), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => { - Navigator.of(context) - .push(FadePage(page: Register())), - }, - )), - ], - ), - ], - )) + return Scaffold( + backgroundColor: Color(0xfff8f8f8), + resizeToAvoidBottomPadding: false, + appBar: AppBar( + backgroundColor: Colors.transparent, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Color(0xff2B353E), + onPressed: () => Navigator.pop(context), + ), + ), + body: Padding( + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column(children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + HabibLogoWidget(), + SizedBox(height: 50), + Text( + TranslationBase.of(context).logintypeRadio, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 25), + shrinkWrap: true, + children: [ + getButton(context, TranslationBase.of(context).nationalIdNumber, 'assets/images/new/national_id.svg', 1), + getButton(context, TranslationBase.of(context).medicalFileNumber, 'assets/images/new/medical_file.svg', 2), ], - )))); + ), + SizedBox(height: 20), + RichText( + text: TextSpan( + 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 = () => Navigator.of(context).push(FadePage(page: ForgotPassword())), + ), + ), + ], + ), + ), + SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + Navigator.of(context).push(FadePage(page: RegisterNew())); + }, + child: Text( + TranslationBase.of(context).registerNow, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + ), + color: Color(0xffD02127), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + ), + ]), + ), + ); + + // AppScaffold( + // appBarTitle: TranslationBase.of(context).login, + // isShowAppBar: true, + // isShowDecPage: false, + // body: SingleChildScrollView( + // child: Container( + // padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + // height: SizeConfig.realScreenHeight * .9, + // width: SizeConfig.realScreenWidth, + // child: Column( + // children: [ + // Expanded( + // flex: 4, + // child: Column( + // // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Image.asset( + // 'assets/images/DQ/logo.png', + // height: 90, + // width: 90, + // ), + // AppText( + // TranslationBase.of(context).logintypeRadio, + // fontSize: SizeConfig.textMultiplier * 3.5, + // textAlign: TextAlign.start, + // marginBottom: 20.0, + // marginTop: 20.0, + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Expanded( + // child: InkWell( + // onTap: () => { + // LoginType.loginType = 1, + // Navigator.of(context).push(FadePage(page: Login())), + // }, + // child: RoundedContainer( + // borderColor: Colors.grey, + // showBorder: true, + // child: Padding( + // padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // 'assets/images/id_card_icon.png', + // height: SizeConfig.imageSizeMultiplier * 12, + // width: SizeConfig.imageSizeMultiplier * 15, + // ), + // SizedBox( + // height: 20, + // ), + // AppText( + // TranslationBase.of(context).idNo, + // fontSize: SizeConfig.textMultiplier * 2, + // fontWeight: FontWeight.bold, + // ) + // ], + // ), + // )))), + // Expanded( + // child: InkWell( + // onTap: () => { + // LoginType.loginType = 2, + // Navigator.of(context).push(FadePage(page: Login())), + // }, + // child: RoundedContainer( + // borderColor: Colors.grey, + // showBorder: true, + // child: Padding( + // padding: EdgeInsets.fromLTRB(25, 10, 25, 10), + // child: Column( + // children: [ + // Image.asset( + // 'assets/images/my_file_white_icon.png', + // height: SizeConfig.imageSizeMultiplier * 12, + // width: SizeConfig.imageSizeMultiplier * 15, + // ), + // SizedBox( + // height: 20, + // ), + // AppText( + // TranslationBase.of(context).fileNo, + // fontSize: SizeConfig.textMultiplier * 2, + // fontWeight: FontWeight.bold, + // ) + // ], + // ), + // )))) + // ], + // ), + // SizedBox( + // height: 25, + // ), + // Divider( + // color: Colors.grey, + // height: 2, + // ), + // Center( + // child: InkWell( + // onTap: () => { + // Navigator.of(context).push(FadePage(page: ForgotPassword())), + // }, + // child: AppText(TranslationBase.of(context).forgotPassword, fontSize: SizeConfig.textMultiplier * 2.5, marginTop: 20.0, underline: true))) + // ]), + // ), + // Expanded( + // flex: 1, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Divider( + // color: Colors.grey, + // height: 2, + // ), + // SizedBox( + // height: 10, + // ), + // Row( + // children: [ + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).registerNow, + // () => { + // Navigator.of(context).push(FadePage(page: Register())), + // }, + // )), + // ], + // ), + // ], + // )) + // ], + // )))); + } + + Widget getButton(BuildContext _context, String _title, String _icon, int _flag) { + return InkWell( + onTap: () { + LoginType.loginType = _flag; + Navigator.of(_context).push(FadePage(page: Login())); + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: 38, + width: 38, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); } } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 1f3fb133..49c8d0d6 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; @@ -9,30 +8,29 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; -import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.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'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/habib_logo_widget.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.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:flutter/rendering.dart'; import 'package:provider/provider.dart'; -import '../../Constants.dart'; - class Login extends StatefulWidget { @override _Login createState() => _Login(); @@ -42,37 +40,37 @@ class _Login extends State { final util = Utils(); final nationalIDorFile = TextEditingController(); final mobileNumberController = TextEditingController(); - final int loginType = LoginType.loginType; + int loginType = LoginType.loginType; String mobileNo; String countryCode = '966'; bool isButtonDisabled = true; final authService = new AuthProvider(); var sharedPref = new AppSharedPreferences(); bool isLoading = false; - AppointmentRateViewModel appointmentRateViewModel = - locator(); - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + AppointmentRateViewModel appointmentRateViewModel = locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ProjectViewModel projectViewModel; ToDoCountProviderModel toDoProvider; + var familyFileProvider = FamilyFilesProvider(); + @override void initState() { // getDeviceToken(); super.initState(); - if(BASE_URL.contains("uat.")){ - nationalIDorFile.text = "2001273"; - mobileNumberController.text = mobileNo = "0555416043"; - } else { + // if (BASE_URL.contains("uat.")) { + // nationalIDorFile.text = "2001273"; + // mobileNumberController.text = mobileNo = "0555416043"; + // } + getRegisterData(); + /* else { nationalIDorFile.text = "3376044"; mobileNumberController.text = mobileNo = "0555416575"; - } - + }*/ } getDeviceToken() async { @@ -85,89 +83,139 @@ class _Login extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); toDoProvider = Provider.of(context); - return AppScaffold( - appBarTitle: TranslationBase.of(context).login, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - children: [ - Expanded( - flex: 2, - child: Texts( - loginType == 1 - ? TranslationBase.of(context).enterNationalId - : TranslationBase.of(context).enterFile, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - )), - Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Directionality( - textDirection: TextDirection.ltr, - child: MobileNo( - controller: mobileNumberController, - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value)), - Directionality( - textDirection: TextDirection.ltr, - child: Container( - child: TextFields( - keyboardType: TextInputType.number, - fontWeight: FontWeight.normal, - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: secondaryColor), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - ))) - ], + + return Scaffold( + backgroundColor: Color(0xfff8f8f8), + appBar: AppBar( + backgroundColor: Colors.transparent, + leading: IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Color(0xff2B353E), + onPressed: () => Navigator.pop(context), + ), + ), + body: Padding( + padding: EdgeInsets.only(bottom: 20, left: 21, right: 21), + child: Column(children: [ + Expanded( + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + HabibLogoWidget(), + SizedBox(height: 50), + Text( + loginType == 1 ? TranslationBase.of(context).enterNationalId : TranslationBase.of(context).enterFile, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), - ), - Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox( - height: 10, - ), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).login, - () => {this.startLogin()}, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900], - textColor: Colors.white, - )) - ], - ), - ], - )) - ], + SizedBox(height: 20), + PhoneNumberSelectorWidget( + onNumberChange: (value) => {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value, + mobileNo: this.mobileNo, + ), + SizedBox(height: 12), + Directionality( + textDirection: TextDirection.ltr, + child: inputWidget(loginType == 1 ? TranslationBase.of(context).nationalIdNumber : TranslationBase.of(context).medicalFileNumber, "Xxxxxxxxx", nationalIDorFile)), + ], + ), + ), + SizedBox( + height: 12, + ), + DefaultButton( + TranslationBase.of(context).login, + isButtonDisabled + ? null + : () { + this.startLogin(); + }, + disabledColor: Color(0xff575757), ), + ]), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); @@ -180,8 +228,7 @@ class _Login extends State { } void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && - util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); @@ -234,9 +281,9 @@ class _Login extends State { cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { ConfirmDialog.closeAlertDialog(context), - Navigator.of(context).push(FadePage(page: Register())), + Navigator.of(context).push(FadePage(page: RegisterNew())), }, - cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + cancelFunction: () => {}); dialog.showAlertDialog(context); }); // SMSOTP.showLoadingDialog(context, false), @@ -268,7 +315,7 @@ class _Login extends State { projectViewModel.setPrivilege(privilegeList: result); result = CheckActivationCode.fromJson(result); result.list.isFamily = false; - // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), + this.sharedPref.setString(BLOOD_TYPE, result.patientBloodType); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(MAIN_USER, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); @@ -282,6 +329,11 @@ class _Login extends State { // result['CRSVerificationStatus']; projectViewModel.user = authenticatedUserObject.user; + //await familyFileProvider.getSharedRecordByStatus(); + // await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + // if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); + // }); + appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -314,12 +366,12 @@ class _Login extends State { } getToDoCount() { - toDoProvider.setState(0, true); + toDoProvider.setState(0, true, toDoProvider.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { print(res['AppointmentActiveNumber']); if (res['MessageStatus'] == 1) { - toDoProvider.setState(res['AppointmentActiveNumber'], true); + toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount); } else {} }).catchError((err) { print(err); @@ -330,9 +382,17 @@ class _Login extends State { projectViewModel.platformBridge().registerHmgGeofences(); } -// showLoader(bool isTrue) { -// setState(() { -// isLoading = isTrue; -// }); -// } + getRegisterData() async { + var registerData = await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN); + await sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + + if (registerData != null) { + setState(() { + this.nationalIDorFile.text = registerData['PatientIdentificationID'].toString(); + this.isButtonDisabled = false; + this.loginType = 1; + this.mobileNo = registerData['PatientMobileNumber'].toString(); + }); + } + } } diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index e1152032..341f6098 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -1,11 +1,18 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as checkActivation; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' - as checkActivation; -import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -14,19 +21,19 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hijri/hijri_calendar.dart'; import 'package:intl/intl.dart'; -import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; class RegisterInfo extends StatefulWidget { + final Function changePageViewIndex; + final int page; + const RegisterInfo({Key key, this.changePageViewIndex, this.page = 1}) : super(key: key); @override _RegisterInfo createState() => _RegisterInfo(); } @@ -36,7 +43,7 @@ class _RegisterInfo extends State { final sharedPref = new AppSharedPreferences(); RegisterInfoResponse registerInfo; bool isLoading; - int page = 1; + int page; final List locationList = [ new Location(name: 'KSA', value: '1'), new Location(name: 'Dubai', value: '2'), @@ -49,240 +56,339 @@ class _RegisterInfo extends State { ]; String email = ''; + ToDoCountProviderModel toDoProvider; String location = '1'; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ProjectViewModel projectViewModel; - AppointmentRateViewModel appointmentRateViewModel = - locator(); + AppointmentRateViewModel appointmentRateViewModel = locator(); @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { getRegisterInfo(); }); + setState(() { + page = widget.page; + }); + super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).register, - isShowAppBar: true, + isShowAppBar: false, isShowDecPage: false, body: SingleChildScrollView( - padding: EdgeInsets.all(20), - child: Column(children: [ - AppText( - TranslationBase.of(context).patientInfo, - fontSize: SizeConfig.textMultiplier * 3, - textAlign: TextAlign.left, + padding: EdgeInsets.all(30), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context).personalInfo, + fontSize: 16, + textAlign: TextAlign.left, + fontWeight: FontWeight.bold, + ), + ), + Expanded(child: SizedBox()) + ], ), + SizedBox(height: 20), registerInfo != null && page == 1 ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AppText(TranslationBase.of(context).nationalID), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.idNumber, - prefixIcon: Icon(Icons.chrome_reader_mode, - color: Colors.red), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).firstName), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.firstNameEn == '-' - ? registerInfo.firstNameAr - : registerInfo.firstNameEn, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).middleName), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.secondNameEn == '-' - ? registerInfo.secondNameAr - : registerInfo.secondNameEn, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).lastName), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.lastNameEn == '-' - ? registerInfo.lastNameAr - : registerInfo.lastNameEn, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).gender), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.maritalStatusCode == 'U' - ? 'Unknown' - : registerInfo.maritalStatusCode == 'M' - ? 'Male' - : 'Female', - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).maritalStatus), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.maritalStatus, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).nationality), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.nationalityCode, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).mobileNumber), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: - registerd_data.patientMobileNumber.toString(), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), - AppText(TranslationBase.of(context).dob), - Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - hintText: registerInfo.dateOfBirth, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - readOnly: true, - )), + children: [ + SizedBox(height: 20), + getnameField(TranslationBase.of(context).identificationNumber, registerInfo.idNumber, TranslationBase.of(context).firstName, + registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn), + SizedBox(height: 20), + getnameField(TranslationBase.of(context).middleName, registerInfo.secondNameEn == '-' ? registerInfo.secondNameEn : registerInfo.secondNameEn, + TranslationBase.of(context).lastName, registerInfo.lastNameEn == '-' ? registerInfo.lastNameEn : registerInfo.lastNameEn), + SizedBox(height: 20), + getnameField( + TranslationBase.of(context).gender, + registerInfo.maritalStatusCode == 'U' + ? 'Unknown' + : registerInfo.maritalStatusCode == 'M' + ? 'Male' + : 'Female', + TranslationBase.of(context).maritalStatus, + registerInfo.maritalStatus), + SizedBox(height: 20), + getnameField(TranslationBase.of(context).nationality, registerInfo.nationality, TranslationBase.of(context).mobileNumber, registerd_data.patientMobileNumber.toString()), + SizedBox(height: 20), + getnameField(TranslationBase.of(context).dateOfBirth, registerInfo.dateOfBirth, "", ""), + SizedBox(height: 20), ], ) - : registerInfo != null && page == 2 + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // AppText(TranslationBase.of(context).nationalID), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.idNumber, + // prefixIcon: Icon(Icons.chrome_reader_mode, color: Colors.red), + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).firstName), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.firstNameEn == '-' ? registerInfo.firstNameAr : registerInfo.firstNameEn, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).middleName), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.secondNameEn == '-' ? registerInfo.secondNameAr : registerInfo.secondNameEn, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).lastName), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.lastNameEn == '-' ? registerInfo.lastNameAr : registerInfo.lastNameEn, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).gender), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.maritalStatusCode == 'U' + // ? 'Unknown' + // : registerInfo.maritalStatusCode == 'M' + // ? 'Male' + // : 'Female', + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).maritalStatus), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.maritalStatus, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).nationality), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.nationalityCode, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).mobileNumber), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerd_data.patientMobileNumber.toString(), + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // AppText(TranslationBase.of(context).dob), + // Container( + // margin: EdgeInsets.only(bottom: 10), + // child: TextFields( + // hintText: registerInfo.dateOfBirth, + // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + // readOnly: true, + // )), + // ], + // ) + + : registerInfo != null && widget.page == 2 ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText(TranslationBase.of(context).language, - textAlign: TextAlign.start), Container( - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(10)), - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: language, - iconSize: 40, - elevation: 16, - onChanged: (value) => { - setState(() { - language = value; - }) - }, - items: languageList - .map>( - (Language value) { - return DropdownMenuItem( - value: value.value, - child: Text(value.name), - ); - }).toList()))), - AppText(TranslationBase.of(context).location), + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 25), + child: Row(children: [ + Flexible( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + TranslationBase.of(context).prefferedLanguage, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + isExpanded: true, + value: language, + hint: Text(TranslationBase.of(context).prefferedLanguage), + iconSize: 40, + elevation: 16, + onChanged: (value) => { + setState(() { + language = value; + }) + }, + items: languageList.map>((Language value) { + return DropdownMenuItem( + value: value.value, + child: Text(value.name), + ); + }).toList()))) + ])) + ])), + SizedBox( + height: 20, + ), Container( - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(10)), - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: location, - iconSize: 40, - elevation: 16, - onChanged: (value) => { - setState(() { - location = value; - }) - }, - items: locationList - .map>( - (Location value) { - return DropdownMenuItem( - value: value.value, - child: Text(value.name), - ); - }).toList()))), - AppText(TranslationBase.of(context).email), + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 25), + 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( + isExpanded: true, + value: location, + hint: Text(TranslationBase.of(context).selectLocation), + iconSize: 40, + elevation: 16, + onChanged: (value) => { + setState(() { + location = value; + }) + }, + items: locationList.map>((Location value) { + return DropdownMenuItem( + value: value.value, + child: Text( + value.name, + ), + ); + }).toList()))) + ])) + ])), + SizedBox( + height: 20, + ), Container( - margin: EdgeInsets.only(bottom: 10), - child: TextFields( - onChanged: (value) => { - setState(() { - email = value; - }) - }, - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - )), + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 12), + margin: EdgeInsets.only(bottom: 0), + child: Row(children: [ + Flexible( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + TranslationBase.of(context).email, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + child: TextField( + onChanged: (value) { + setState(() { + email = value; + }); + }, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + )) + ])) + ])), ], ) : SizedBox(), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - page == 1 - ? TranslationBase.of(context).next - : TranslationBase.of(context).register, - () => {nextPage()}, - textColor: Colors.white, - color: this.isValid() == false && page == 2 - ? Colors.grey - : Colors.black, - )) - ], + // Column( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Row( + // children: [ + // Expanded( + // child: DefaultButton( + // page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register, + // () => {nextPage()}, + // textColor: Colors.white, + // color: this.isValid() == false && page == 2 ? Colors.grey : Colors.black, + // )) + // ], + // ), + // ], + // ) + ]), + ), + bottomSheet: Container( + width: double.maxFinite, + height: 80.0, + child: Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).cancel, () => {Navigator.of(context).pop()}, textColor: Colors.white, color: Color(0xffD02127))), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(10), + child: DefaultButton(page == 1 ? TranslationBase.of(context).next : TranslationBase.of(context).register, () => {nextPage()}, + textColor: Colors.white, color: isValid() == true && page == 2 || page == 1 ? Color(0xff359846) : Colors.grey)), ), ], - ) - ]), - )); + ))); } nextPage() { if (page == 1) { setState(() { - page++; + widget.changePageViewIndex(2); }); } else { registerNow(); @@ -292,6 +398,7 @@ class _RegisterInfo extends State { registerNow() { dynamic request = getTempUserRequest(); GifLoaderDialogUtils.showMyDialog(context); + dynamic res; this .authService .registerUser(request) @@ -306,21 +413,31 @@ class _RegisterInfo extends State { confirmMessage: result, okText: TranslationBase.of(context).ok, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => - {ConfirmDialog.closeAlertDialog(context)}, - cancelFunction: () => { - ConfirmDialog.closeAlertDialog(context) - }).showAlertDialog(context) + okFunction: () => {ConfirmDialog.closeAlertDialog(context)}, + cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}).showAlertDialog(context) } else { + res = result, result = checkActivation.CheckActivationCode.fromJson(result), + // result.list.isFamily = false, + // sharedPref.setObject(USER_PROFILE, result.list), + // this.sharedPref.setObject(MAIN_USER, result.list), + // sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + // sharedPref.setString(TOKEN, result.authenticationTokenID), + // this.setUser(result), + sharedPref.remove(FAMILY_FILE), result.list.isFamily = false, + + sharedPref.setString(BLOOD_TYPE, result.patientBloodType), + authenticatedUserObject.user = result.list, + projectViewModel.setPrivilege(privilegeList: res), + sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), - this.sharedPref.setObject(MAIN_USER, result.list), + sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), - this.setUser(result), + checkIfUserAgreedBefore(result), } }) .catchError((err) { @@ -346,11 +463,9 @@ class _RegisterInfo extends State { } getRegisterInfo() async { - var data = - RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA)); + var data = RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA)); if (await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN) != null) { - var data2 = CheckPatientAuthenticationReq.fromJson( - await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); + var data2 = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); setState(() { this.registerInfo = data; @@ -363,8 +478,7 @@ class _RegisterInfo extends State { getTempUserRequest() { DateFormat dateFormat = DateFormat("mm/dd/yyyy"); print(dateFormat.parse(registerInfo.dateOfBirth)); - var hDate = - new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth)); + var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth)); var date = hDate.toString(); return { "Patientobject": { @@ -380,8 +494,7 @@ class _RegisterInfo extends State { "LastNameN": registerInfo.lastNameAr, "LastName": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, - "DateofBirth": DateUtil.convertISODateToJsonDate( - registerInfo.dateOfBirth.replaceAll('/', '-')), + "DateofBirth": DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth.replaceAll('/', '-')), "Gender": registerInfo.gender == 'M' ? 1 : 2, "NationalityID": registerInfo.nationalityCode, "eHealthIDField": registerInfo.healthId, @@ -396,19 +509,116 @@ class _RegisterInfo extends State { : '2', }, "PatientIdentificationID": registerInfo.idNumber, - "PatientMobileNumber": registerd_data.patientMobileNumber, + "PatientMobileNumber": registerd_data.patientMobileNumber.toString()[0] == '0' ? registerd_data.patientMobileNumber : '0' + registerd_data.patientMobileNumber.toString(), }; } bool isValid() { - if (location != null || - language != null || - Utils.validEmail(email) == true) { + if (location != null && language != null && Utils.validEmail(email) == true) { return true; } else { return false; } } + + Widget getnameField(name1, value1, name2, value2) { + return Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + name1, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + AppText( + value1, + ), + ], + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + name2, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + AppText(value2), + ], + )) + ], + ); + } + + checkIfUserAgreedBefore(checkActivation.CheckActivationCode result) { + if (result.isNeedUserAgreement == true) { + //need to implement agreement page here + insertIMEI(); + } else { + insertIMEI(); + } + } + + insertIMEI() async { + var selectedOption = await sharedPref.getInt(LAST_LOGIN); + authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) { + print(err); + }); + // authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); + } + + goToHome() async { + authenticatedUserObject.isLogin = true; + appointmentRateViewModel.isLogin = true; + projectViewModel.isLogin = true; + projectViewModel.user = authenticatedUserObject.user; + await authenticatedUserObject.getUser(getUser: true); + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + getToDoCount(), + GifLoaderDialogUtils.hideDialog(AppGlobal.context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + //GifLoaderDialogUtils.hideDialog(context); + }); + // SMSOTP.showLoadingDialog(context, false), + } + + getToDoCount() { + toDoProvider.setState(0, true, "0"); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + } else {} + }).catchError((err) { + print(err); + }); + } } class Language { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 1591d1d5..11ed7c79 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -14,16 +15,19 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:intl/intl.dart' as intl; class Register extends StatefulWidget { + final Function changePageViewIndex; + + const Register({Key key, this.changePageViewIndex}) : super(key: key); + @override _Register createState() => _Register(); } @@ -36,7 +40,9 @@ class _Register extends State { var isHijri; final util = Utils(); DateTime selectedDate; - String dob; + TextEditingController dob = TextEditingController(); + TextEditingController dobEn = TextEditingController(); + bool isButtonDisabled = true; final authService = new AuthProvider(); final sharedPref = new AppSharedPreferences(); @@ -47,8 +53,10 @@ class _Register extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).register, - isShowAppBar: true, + isShowAppBar: false, isShowDecPage: false, + showNewAppBar: false, + showNewAppBarTitle: true, body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), @@ -56,32 +64,22 @@ class _Register extends State { width: SizeConfig.realScreenWidth, child: Column(children: [ Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3, - textAlign: TextAlign.left, - )), - Expanded( - flex: 4, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - MobileNo( - onNumberChange: (value) => - {mobileNo = value, validateForm()}, - onCountryChange: (value) => countryCode = value), - Container( - child: TextFields( - controller: nationalIDorFile, - onChanged: (value) => validateForm(), - keyboardType: TextInputType.number, - prefixIcon: Icon(Icons.chrome_reader_mode, - color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: TranslationBase.of(context).nationalID, - )), + child: ListView( + padding: EdgeInsets.zero, + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 10), + Padding( + padding: EdgeInsets.all(10), + child: Text( + TranslationBase.of(context).enterNationalId, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + )), + SizedBox(height: 10), + PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + SizedBox(height: 12), + Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).nationalIdNumber, "Xxxxxxxxx", nationalIDorFile)), + SizedBox(height: 20), Row( children: [ Expanded( @@ -120,103 +118,179 @@ class _Register extends State { ), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - width: SizeConfig.realScreenWidth * .9, - height: 60, - child: isHijri == 1 - ? TextFields( - onChanged: (value) => {dob = value}, - hintText: 'DD/MM/YYYY', - prefixIcon: Icon(Icons.date_range), - ) - : RaisedButton.icon( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), - color: Colors.white, - onPressed: () => { - if (isHijri != null) - _selectDate(context) - }, - icon: Icon(Icons.date_range), - label: Text(selectedDate != null - ? "${selectedDate.toLocal()}" - .split(' ')[0] - : TranslationBase.of(context).dob))) - ]) + Row(children: [ + Container( + width: SizeConfig.realScreenWidth * .9, + child: isHijri == 1 + ? Directionality( + textDirection: TextDirection.ltr, + child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dob, + isNumber: false, + suffix: Icon( + Icons.calendar_today, + size: 16, + ))) + : Container( + child: InkWell( + onTap: () { + if (isHijri != null) _selectDate(context); + }, + child: Directionality( + textDirection: TextDirection.ltr, + child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dobEn, + isNumber: false, + isEnable: false, + suffix: Icon( + Icons.calendar_today, + size: 16, + )))))), + ]) ], ), ), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox( - height: 10, - ), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => {startRegistration()}, - textColor: Colors.white, - color: isButtonDisabled == true - ? Colors.grey - : Colors.grey[900])) - ], - ), - ], - )) ]), - ))); + )), + bottomSheet: Container( + width: double.maxFinite, + // height: 80.0, + color: Colors.white, + margin: EdgeInsets.only(bottom: 50.0), + child: Row( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(10), child: DefaultButton(TranslationBase.of(context).cancel, () => {Navigator.of(context).pop()}, textColor: Colors.white, color: Color(0xffD02127))), + ), + Expanded( + child: Padding( + padding: EdgeInsets.all(10), + child: DefaultButton(TranslationBase.of(context).next, () => {startRegistration()}, textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Color(0xff359846))), + ), + ], + ))); } Future _selectDate(BuildContext context) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime(1950, 8), - lastDate: DateTime.now()); - if (picked != null && picked != selectedDate) - setState(() { - selectedDate = picked; - }); + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 100, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + selectedDate = date; + setState(() { + final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); + dobEn.text = dateFormat.format(date); + }); + }, + currentTime: DateTime.now(), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon suffix}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isNumber ? TextInputType.number : TextInputType.datetime, + controller: _controller, + onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + if (suffix != null) suffix + ], + ), + ), + ); } startRegistration() { + final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); if (isButtonDisabled == false) { var request = CheckPatientForRegistration(); request.patientMobileNumber = int.parse(mobileNo); request.zipCode = countryCode; request.patientOutSA = countryCode == '966' ? 0 : 1; - // if (this.loginType == 1) { + request.patientIdentificationID = int.parse(nationalIDorFile.text); request.patientID = 0; request.isRegister = true; - // } else { - // request.patientIdentificationID = 0; - // request.patientID = int.parse(nationalIDorFile.text); - // } + request.dob = isHijri == 1 ? dob.text : dateFormat.format(selectedDate); + request.isHijri = isHijri; this.checkPatientForRegisteration(request); } } checkPatientForRegisteration(request) { GifLoaderDialogUtils.showMyDialog(context); - this - .authService - .checkPatientForRegisteration(request) - .then((response) => {checkUserStatus(response, request)}) - .catchError((err) { + this.authService.checkPatientForRegisteration(request).then((response) => {checkUserStatus(response, request)}).catchError((err) { GifLoaderDialogUtils.hideDialog(context); ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -236,7 +310,8 @@ class _Register extends State { if (util.validateIDBox(nationalIDorFile.text, loginType) == true && mobileNo.length >= 9 && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true && - isHijri != null) { + isHijri != null && + (dobEn.text != null || dob.text != null)) { setState(() { isButtonDisabled = false; }); @@ -253,20 +328,22 @@ class _Register extends State { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { - // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); - AlertDialogBox( - context: context, - confirmMessage: response['ErrorEndUserMessage'], - okText: TranslationBase.of(context).ok, - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - Navigator.of(context).pop(); - }).showAlertDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: response['ErrorEndUserMessage'], + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); + Navigator.of(context).push(FadePage(page: Login())); + }, + cancelFunction: () {}) + .showAlertDialog(context); } else { nRequest['forRegister'] = true; nRequest['isRegister'] = true; - nRequest["PatientIdentificationID"] = - nRequest["PatientIdentificationID"].toString(); + nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString(); sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']); this.chekUserData(response['LogInTokenID']); @@ -296,11 +373,11 @@ class _Register extends State { // IsHijri: Number(this.dateOption) // } - final DateFormat dateFormat = DateFormat('dd/MM/yyyy'); + final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); GifLoaderDialogUtils.showMyDialog(context); var request = CheckUserStatusRequest(); request.patientIdentificationID = nationalIDorFile.text; - request.dOB = isHijri == 1 ? dob : dateFormat.format(selectedDate); + request.dOB = isHijri == 1 ? dob.text : dateFormat.format(selectedDate); request.isHijri = isHijri; request.patientOutSA = countryCode == '966' ? 0 : 1; this.authService.checkUserStatus(request).then((result) => { @@ -309,21 +386,10 @@ class _Register extends State { { result = CheckUserStatusResponse.fromJson(result), sharedPref.setObject(NHIC_DATA, result), - Navigator.of(context).push(FadePage(page: ConfirmLogin())), + Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))), } else - { - AppToast.showErrorToast( - message: result - ? result - : TranslationBase.of(context).somethingWentWrong) - } + {AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)} }); } - - showLoader(bool isTrue) { - setState(() { - isLoading = isTrue; - }); - } } diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart new file mode 100644 index 00000000..90b9d225 --- /dev/null +++ b/lib/pages/login/register_new.dart @@ -0,0 +1,203 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/register-info.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.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/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; + +class RegisterNew extends StatefulWidget { + @override + _RegisterNew createState() => _RegisterNew(); +} + +class _RegisterNew extends State { + final nationalIDorFile = TextEditingController(); + final int loginType = LoginType.loginType; + String mobileNo; + String countryCode = '966'; + var isHijri; + final util = Utils(); + DateTime selectedDate; + String dob; + bool isButtonDisabled = true; + final authService = new AuthProvider(); + final sharedPref = new AppSharedPreferences(); + PageController _controller; + bool isLoading; + int _currentIndex = 0; + + @override + void initState() { + super.initState(); + _controller = new PageController(); + } + + @override + void dispose() { + super.dispose(); + } + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).register, + isShowAppBar: true, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + child: Container( + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column(children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 20, right: 20, top: 12), + child: Row( + children: [ + Expanded( + child: showProgress( + title: TranslationBase.of(context).enterDetails, + status: _currentIndex == 0 + ? TranslationBase.of(context).inPrgress + : _currentIndex > 0 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: _currentIndex == 0 ? CustomColors.orange : CustomColors.green, + ), + ), + Expanded( + child: showProgress( + title: TranslationBase.of(context).patientInfo, + status: _currentIndex == 1 + ? TranslationBase.of(context).inPrgress + : _currentIndex > 1 + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + color: _currentIndex == 1 + ? CustomColors.orange + : _currentIndex > 1 + ? CustomColors.green + : CustomColors.grey2, + ), + ), + showProgress( + title: TranslationBase.of(context).otherInfo, + status: _currentIndex == 2 ? TranslationBase.of(context).inPrgress : TranslationBase.of(context).locked, + color: _currentIndex == 2 + ? CustomColors.orange + : _currentIndex > 3 + ? CustomColors.green + : CustomColors.grey2, + isNeedBorder: false, + ), + ], + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + Register( + changePageViewIndex: changePageViewIndex, + ), + + RegisterInfo( + changePageViewIndex: changePageViewIndex, + ), + RegisterInfo(changePageViewIndex: changePageViewIndex, page: 2), + // NewEReferralStepOnePage( + // changePageViewIndex: changePageViewIndex, + // createEReferralRequestModel: createEReferralRequestModel, + // ), + // NewEReferralStepTowPage( + // changePageViewIndex: changePageViewIndex, + // createEReferralRequestModel: createEReferralRequestModel, + // ), + // NewEReferralStepThreePage( + // changePageViewIndex: changePageViewIndex, + // createEReferralRequestModel: createEReferralRequestModel, + // ), + ], + ), + ), + ]), + )), + ); + } + + Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 26, + height: 26, + decoration: containerRadius(color, 200), + child: Icon( + Icons.done, + color: Colors.white, + size: 16, + ), + ), + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: mDivider(Colors.grey), + )), + ], + ), + mHeight(8), + Text( + title, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.44, + ), + ), + mHeight(2), + Container( + padding: EdgeInsets.all(5), + decoration: containerRadius(color.withOpacity(0.2), 4), + child: Text( + status, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, + ), + ), + ), + ], + ) + ], + ); + } +} diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 6a007e0a..8688fec3 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,14 +1,14 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; -import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; class WelcomeLogin extends StatefulWidget { @override @@ -21,82 +21,85 @@ class _WelcomeLogin extends State { @override void initState() { isLoading = true; - // checkUser(context); super.initState(); } Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).welcome, - isShowDecPage: false, - isShowAppBar: true, - body: Padding( - padding: EdgeInsets.all(20), - child: Column( + appBarTitle: TranslationBase.of(context).welcome, + isShowDecPage: false, + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: false, + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.only(left: 21, right: 21), + physics: BouncingScrollPhysics(), + children: [ + SizedBox(height: 12), + Row( + children: [ + SvgPicture.asset( + "assets/images/new/hmg_icon.svg", + height: 62, + width: 62, + ), + ], + ), + SizedBox(height: 24), + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 23 / 24), + ), + SizedBox(height: 16), + Text( + TranslationBase.of(context).welcomeText, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + Text( + TranslationBase.of(context).welcomeText2, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox( + height: 14, + ), + ], + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, children: [ Expanded( - flex: 6, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset('assets/images/DQ/logo.png', - height: 90, width: 90), - AppText( - TranslationBase.of(context).welcome, - fontSize: 30, - fontWeight: FontWeight.bold, - ), - AppText( - TranslationBase.of(context).welcomeText, - fontSize: 24, - textAlign: TextAlign.start, - ), - AppText( - TranslationBase.of(context).welcomeText2, - fontSize: 24, - textAlign: TextAlign.start, - ), - SizedBox( - height: SizeConfig.realScreenHeight * .15, - ) - ]), + child: DefaultButton( + TranslationBase.of(context).no, + () => { + Navigator.of(context).push(FadePage(page: RegisterNew())), + }, + color: CustomColors.accentColor, + textColor: Colors.white, + ), ), + SizedBox(width: 8), Expanded( - flex: 2, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).yes, - () => { - Navigator.of(context) - .push(FadePage(page: LoginType())), - }, - color: Color(0xFFc5272c), - textColor: Colors.white, - )) - ], - ), - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).no, - () => { - Navigator.of(context) - .push(FadePage(page: Register())), - }, - )) - ], - ), - ], - )) + child: DefaultButton( + TranslationBase.of(context).yes, + () => { + Navigator.of(context).push(FadePage(page: LoginType())), + }, + color: CustomColors.green, + ), + ), ], - ))); + ), + ), + ], + ), + ); } } diff --git a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart index a6fc5fef..6af41514 100644 --- a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart +++ b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/medical/active_medications/reminder_p import 'package:diplomaticquarterapp/uitl/date_uitl.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -17,122 +18,186 @@ class ActiveMedicationsPage extends StatelessWidget { return BaseView( onModelReady: (model) => model.getActiveMedication(), builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).activeMedications, - isShowAppBar: true, - body: Container( + body: model.activePrescriptionReport.length > 0 ? Container( child: ListView.builder( itemCount: model.activePrescriptionReport.length, itemBuilder: (context, index) => Container( - padding: EdgeInsets.all(10), - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Row( - children: [ - Image.memory( - Utils.dataFromBase64String(model - .activePrescriptionReport[index].productImageBase64), - height: SizeConfig.imageSizeMultiplier * 19, - width: SizeConfig.imageSizeMultiplier * 18, - fit: BoxFit.cover, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - model.activePrescriptionReport[index].itemDescription, - bold: true, - ), - SizedBox( - height: 5, - ), - Texts( - TranslationBase.of(context).expDate + - ' :' + - DateUtil.getDayMonthYearDateFormatted(model - .activePrescriptionReport[index].orderDate), - ), - SizedBox( - height: 5, - ), - Texts( - TranslationBase.of(context).route + - ' :' + - model.activePrescriptionReport[index].route, - ), - SizedBox( - height: 5, - ), - Texts( - TranslationBase.of(context).frequency + - ' :' + - model.activePrescriptionReport[index].frequency, - ), - SizedBox( - height: 5, + width: double.infinity, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 20, left: 20, right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.activePrescriptionReport[index].itemDescription, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), - Texts( - TranslationBase.of(context).dailyQuantity + - ' :${model.activePrescriptionReport[index].doseDailyQuantity}', - ), - ], - ), - ), - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Icon( - Icons.notifications, - color: Colors.red, - size: 28, - ), - SizedBox( - height: 25, - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReminderPage( - frequency: model - .activePrescriptionReport[index] - .frequencyNumber, - days: model - .activePrescriptionReport[index].days, - itemDescription: model - .activePrescriptionReport[index] - .itemDescription, + ), + mHeight(10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Container( + child: Container( + child: Image.memory( + Utils.dataFromBase64String(model.activePrescriptionReport[index].imageString), + fit: BoxFit.cover, + height: SizeConfig.imageSizeMultiplier * 19, + width: SizeConfig.imageSizeMultiplier * 18, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), ), + clipBehavior: Clip.antiAlias, + decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1), ), - ); - }, - child: Row( - children: [ - Icon( - Icons.notifications_active, - color: Colors.red, - size: 28, + mWidth(12), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + TranslationBase.of(context).expiryDateTitle + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(model.activePrescriptionReport[index].orderDate), + style: TextStyle( + fontSize: 13, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).frequency + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.activePrescriptionReport[index].frequency, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).route + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.activePrescriptionReport[index].route, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).dailyDoses + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.activePrescriptionReport[index].doseDailyQuantity.toString(), + style: TextStyle( + fontSize: 13, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + mHeight(12), + ], ), - Texts( - TranslationBase.of(context).addReminder, - color: Colors.red, - ) ], ), - ) - ], - ), - ) - ], + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReminderPage( + frequency: model.activePrescriptionReport[index].frequencyNumber, + days: model.activePrescriptionReport[index].days, + itemDescription: model.activePrescriptionReport[index].itemDescription, + ), + ), + ); + }, + child: Column( + children: [ + Icon( + Icons.notifications_outlined, + color: Colors.red, + size: 28, + ), + Texts( + TranslationBase.of(context).addReminder, + color: Colors.red, + fontSize: 11.0, + ) + ], + ), + ), + ), + ], + ), + ], + ), + ), ), ), ), - ), + ) : getNoDataWidget(context), ), ); } diff --git a/lib/pages/medical/active_medications/reminder_page.dart b/lib/pages/medical/active_medications/reminder_page.dart index 7980d941..a6df5f28 100644 --- a/lib/pages/medical/active_medications/reminder_page.dart +++ b/lib/pages/medical/active_medications/reminder_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -22,15 +23,7 @@ class ReminderPage extends StatefulWidget { final String itemDescription; List _scheduleList = List(); - List daysOfWeek = [ - DayOfWeek.Monday, - DayOfWeek.Tuesday, - DayOfWeek.Wednesday, - DayOfWeek.Thursday, - DayOfWeek.Friday, - DayOfWeek.Saturday, - DayOfWeek.Sunday - ]; + List daysOfWeek = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday]; DateTime startDay; DateTime endDay; @@ -41,8 +34,7 @@ class ReminderPage extends StatefulWidget { int hour = (24 ~/ frequency).round(); int durations = 24 ~/ hour; for (int count = 0; count < durations; count++) { - _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, (hour * count))); + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, (hour * count))); } } @@ -59,6 +51,9 @@ class _ReminderPageState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, appBarTitle: TranslationBase.of(context).reminder, body: SingleChildScrollView( child: Container( @@ -68,7 +63,7 @@ class _ReminderPageState extends State { children: [ Container( width: double.maxFinite, - child: Texts(TranslationBase.of(context).reminderDes), + child: Texts(TranslationBase.of(context).reminderDes, textAlign: TextAlign.start), ), Divider(), SizedBox( @@ -80,25 +75,17 @@ class _ReminderPageState extends State { ), InkWell( onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime( - DateTime.now().year, DateTime.now().month - 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year, DateTime.now().month - 1, 1), maxTime: DateTime.now(), onConfirm: (date) { setState(() { widget.startDay = date; }); - }, - currentTime: widget.startDay, - locale: projectViewModel.localeType); + }, currentTime: widget.startDay, locale: projectViewModel.localeType); }, child: Container( 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: [ @@ -120,25 +107,17 @@ class _ReminderPageState extends State { ), InkWell( onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime( - DateTime.now().year, DateTime.now().month - 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year, DateTime.now().month - 1, 1), maxTime: DateTime.now(), onConfirm: (date) { setState(() { widget.endDay = date; }); - }, - currentTime: widget.endDay, - locale: projectViewModel.localeType); + }, currentTime: widget.endDay, locale: projectViewModel.localeType); }, child: Container( 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: [ @@ -163,10 +142,7 @@ class _ReminderPageState extends State { child: Container( 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: [ @@ -196,28 +172,21 @@ class _ReminderPageState extends State { ), InkWell( onTap: () { - DatePicker.showTimePicker(context, - showTitleActions: true, onConfirm: (date) { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { setState(() { widget._scheduleList[index] = date; }); - }, - currentTime: widget._scheduleList[index], - locale: projectViewModel.localeType); + }, currentTime: widget._scheduleList[index], locale: projectViewModel.localeType); }, child: Container( 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, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(getDateTime( - widget._scheduleList[index])), + Texts(getDateTime(widget._scheduleList[index])), Icon( Icons.access_time, color: Colors.black, @@ -238,29 +207,29 @@ class _ReminderPageState extends State { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.2, + color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Row( + mainAxisSize: MainAxisSize.min, children: [ - SecondaryButton( - label: TranslationBase.of(context).ok, - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - schedule(); - }, - ), - SizedBox( - height: 15, - ), - SecondaryButton( - label: TranslationBase.of(context).cancel, - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - Navigator.pop(context); - }, + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).cancel, + // () { + // Navigator.pop(context); + // }, + // color: Color(0xffC5272D), + // ), + // ), + // SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).ok.toUpperCase(), + () { + schedule(); + }, + color: Color(0xff359846), + ), ), ], ), @@ -270,16 +239,11 @@ class _ReminderPageState extends State { } schedule() async { - List scheduleDateTime = - calculateDaysInterval(widget.startDay, widget.endDay); + List scheduleDateTime = calculateDaysInterval(widget.startDay, widget.endDay); CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - calendarUtils.createOrUpdateEvents( - scheduleList: widget._scheduleList, - description: widget.itemDescription, - title: widget.itemDescription, - scheduleDateTime: scheduleDateTime); + calendarUtils.createOrUpdateEvents(scheduleList: widget._scheduleList, description: widget.itemDescription, title: widget.itemDescription, scheduleDateTime: scheduleDateTime); Navigator.pop(context); } @@ -288,8 +252,7 @@ class _ReminderPageState extends State { List days = []; for (int i = 0; i <= endDate.difference(startDate).inDays; i++) { widget._scheduleList.forEach((element) { - days.add(startDate.add( - Duration(days: i, hours: element.hour, minutes: element.minute))); + days.add(startDate.add(Duration(days: i, hours: element.hour, minutes: element.minute))); }); } return days; diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart index 459ef0f8..e83cf1d5 100644 --- a/lib/pages/medical/allergies_page.dart +++ b/lib/pages/medical/allergies_page.dart @@ -16,6 +16,8 @@ class AllergiesPage extends StatelessWidget { onModelReady: (model) => model.getAllergies(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).allergies, baseViewModel: model, description: TranslationBase.of(context).infoAllergies, diff --git a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart index bf892940..0332fd91 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart @@ -1,8 +1,9 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -18,6 +19,8 @@ class AskDoctorHomPage extends StatefulWidget { class _AskDoctorHomPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + int filterType = 0; + @override void initState() { super.initState(); @@ -35,87 +38,40 @@ class _AskDoctorHomPageState extends State with SingleTickerPr return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).askDoctor, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), isShowDecPage: true, description: TranslationBase.of(context).infoAskDoc, imagesInfo: [ ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/ask-doctor/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/ask-doctor/ar/0.png'), ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/ask-doctor/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/ask-doctor/ar/1.png') ], - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide(color: Theme.of(context).dividerColor, width: 0.9), - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Tab( - child: Container( - width: MediaQuery.of(context).size.width * 0.36, - child: Center( - child: Texts(TranslationBase.of(context).askDoctor), - ), - ), - ), - Tab( - child: Container( - width: MediaQuery.of(context).size.width * 0.36, - child: Center( - child: Texts( - TranslationBase.of(context).doctorResponses, - textAlign: TextAlign.start, - ), - ), - ), - ) - ], - ), - ), - ), - ), + body: Column( + children: [ + Row( + children: [ + MyTabView(TranslationBase.of(context).askDoctor, FilterType.Clinic, filterType == 0 ? FilterType.Clinic : FilterType.Hospital, () { + if (filterType != 0) + setState(() { + filterType = 0; + }); + }), + MyTabView(TranslationBase.of(context).doctorResponses, FilterType.Hospital, filterType != 0 ? FilterType.Hospital : FilterType.Clinic, () { + if (filterType == 0) + setState(() { + filterType = 1; + }); + }), ], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [AskDoctorPage(), DoctorResponse()], - ), - ) - ], - ), + Expanded( + child: IndexedStack( + index: filterType, + children: [AskDoctorPage(), DoctorResponse()], + ), + ) + ], ), ); } diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 795d1869..877c52fc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -1,216 +1,114 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/medical/ask_doctor_services.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/request_type.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.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:rating_bar/rating_bar.dart'; class AskDoctorPage extends StatelessWidget { + AskDoctorService service = new AskDoctorService(); + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getMyDoctor(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - children: [ - SizedBox( - height: 70, - ), - ...List.generate( - model.patientDoctorAppointmentListHospital.length, - (index) => AppExpandableNotifier( - title: - model.patientDoctorAppointmentListHospital[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: - model.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList.map((doctor) { - return InkWell( - onTap: () { - model - .getCallInfoHoursResult( - doctorId: doctor.doctorID, - projectId: doctor.projectID) - .then((value) { - if (model.state != ViewState.ErrorLocal && - model.state != ViewState.Error) { - // Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: RequestTypePage(doctorList: doctor,), - ), - ); - } else { - AppToast.showErrorToast(message: model.error); - } - }); + body: model.patientDoctorAppointmentListHospital.length > 0 ? _appointmentExpandableList(model.patientDoctorAppointmentListHospital, model) : noDoctor(context), + ), + ); + } - ///.showProgressBar( - // text: "Loading", - // backgroundColor: - // Colors.blue.withOpacity(0.6)) - }, - child: Card( - margin: - EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - decoration: BoxDecoration(), - padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.network( - doctor.doctorImageURL, - fit: BoxFit.fill, - height: 60.0, - width: 60.0), - ), - ), - Expanded( - flex: 4, - child: Container( - width: - MediaQuery.of(context).size.width * - 0.55, - margin: EdgeInsets.fromLTRB( - 20.0, 10.0, 10.0, 0.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (doctor.doctorTitle != null) - Text( - doctor.doctorTitle + - " " + - doctor.name, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.clinicName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.projectName, - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - if (doctor.speciality != null) - Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - doctor.speciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - doctor.nearestFreeSlot != null - ? Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDate(doctor - .nearestFreeSlot), - style: TextStyle( - fontSize: 14.0, - fontWeight: - FontWeight.bold, - color: Colors - .green[600], - letterSpacing: - 1.0)), - ) - : Container(), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: doctor - .actualDoctorRate - .toDouble(), - size: 20.0, - filledColor: - Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: - Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - Container( - child: Image.network( - doctor.nationalityFlagURL, - width: 25.0, - height: 25.0), - ), - ], - ), - ], - ), - ), - ), - ], - ), - ), - ), - ); - }).toList(), - )), - ) - ], - ), - ), - ), + Widget noDoctor(BuildContext context) { + return Container( + margin: EdgeInsets.only(left: 50.0, right: 50.0), + child: Center( + child: Text(TranslationBase.of(context).askDocEmpty, textAlign: TextAlign.center, style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: CustomColors.accentColor + )), ), ); } - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; + Widget _appointmentExpandableList(List _patientDoctorAppointmentList, model) { + return ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + List _doctorList = _patientDoctorAppointmentList[index].patientDoctorAppointmentList; + return AppExpandableNotifier( + title: _patientDoctorAppointmentList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + DoctorList _doctor = _doctorList[_index]; + DoctorList doctorList = DoctorList( + projectID: _doctor.projectID, + setupID: _doctor.setupID, + clinicID: _doctor.clinicID, + projectName: _doctor.projectName, + clinicName: _doctor.clinicName, + actualDoctorRate: _doctor.actualDoctorRate, + doctorID: _doctor.doctorID, + doctorRate: _doctor.doctorRate, + gender: _doctor.gender, + doctorTitle: _doctor.doctorTitle, + name: _doctor.name, + speciality: _doctor.speciality, + doctorImageURL: _doctor.doctorImageURL, + nationalityFlagURL: _doctor.nationalityFlagURL); + return DoctorView( + doctor: doctorList, + isLiveCareAppointment: false, + onTap: () { + GifLoaderDialogUtils.showMyDialog(context); + service.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['ErrorEndUserMessage'] == null) { + Navigator.push( + context, + FadePage( + page: RequestTypePage(doctorList: _doctor), + ), + ); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + if (err != null) AppToast.showErrorToast(message: err); + print(err); + }); + }, + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: _doctorList.length), + ); + }, + itemCount: _patientDoctorAppointmentList.length, + ); } String getDate(String date) { @@ -236,4 +134,3 @@ class AskDoctorPage extends StatelessWidget { } } } - diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index 846c9a05..decca583 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -99,7 +99,7 @@ class DoctorResponse extends StatelessWidget { ), ), Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios + ? Icons.arrow_forward : Icons.arrow_back_ios) ], ), @@ -169,7 +169,7 @@ class DoctorResponse extends StatelessWidget { ), ), Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios + ? Icons.arrow_forward : Icons.arrow_back_ios) ], ), diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index eaf2913d..66cd9344 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -3,9 +3,8 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_mod import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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'; @@ -32,6 +31,8 @@ class _RequestTypePageState extends State { isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, body: SingleChildScrollView( child: Container( margin: EdgeInsets.all(10), @@ -43,16 +44,13 @@ class _RequestTypePageState extends State { (index) => Container( width: double.maxFinite, height: 55, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0)), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8.0)), margin: EdgeInsets.all(8.0), child: InkWell( onTap: () { setState(() { selected = model.askDoctorReqTypes[index].description; - parameterCode = - model.askDoctorReqTypes[index].parameterCode; + parameterCode = model.askDoctorReqTypes[index].parameterCode; }); }, child: Row( @@ -60,8 +58,7 @@ class _RequestTypePageState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Text( - model.askDoctorReqTypes[index].description), + child: Text(model.askDoctorReqTypes[index].description), ), Radio( value: model.askDoctorReqTypes[index].description, @@ -70,8 +67,7 @@ class _RequestTypePageState extends State { onChanged: (value) { setState(() { selected = value; - parameterCode = model - .askDoctorReqTypes[index].parameterCode; + parameterCode = model.askDoctorReqTypes[index].parameterCode; }); }, ), @@ -104,28 +100,24 @@ class _RequestTypePageState extends State { ), bottomSheet: Container( width: double.maxFinite, - // height: MediaQuery.of(context).size.height * 0.1, height: 80.0, child: Padding( padding: const EdgeInsets.all(12.0), - child: SecondaryButton( - label: TranslationBase.of(context).submit, - loading: model.state == ViewState.BusyLocal, - textColor: Colors.white, - onTap: () { - model - .sendRequestLOV( - doctorList: widget.doctorList, - requestType: parameterCode.toString(), - remark: question) - .then((value) { - if (model.state != ViewState.ErrorLocal || - model.state != ViewState.Error) { - Navigator.pop(context); - } - }); - }, - color: Colors.grey[800], + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + child: DefaultButton( + TranslationBase.of(context).submit, + () => { + model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { + if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { + Navigator.pop(context); + } + }) + }, + color: Color(0xffD02127), + textColor: Colors.white, + disabledColor: Color(0xffEAEAEA), + ), ), ), ), diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index d1d0293b..051b9b95 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -8,14 +8,14 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -23,9 +23,6 @@ import 'package:flutter/material.dart'; import '../../../core/model/my_balance/AdvanceModel.dart'; import 'confirm_payment_page.dart'; -import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectPatientFamilyDialog.dart'; -import 'dialogs/SelectPatientInfoDialog.dart'; import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } @@ -57,325 +54,368 @@ class _AdvancePaymentPageState extends State { super.initState(); getAuthUser(); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/en/0.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/advance-payment/ar/0.png')); } @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getHospitals(), + onModelReady: (model) { + model.getHospitals(); + model.getFamilyFiles(); + }, builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - imagesInfo: imagesInfo, - appBarTitle: TranslationBase.of(context).advancePayment, - description: TranslationBase.of(context).infoAdvancePayment, - isBottomBar: model.isLogin ? true : false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).advancePaymentLabel, - textAlign: TextAlign.center, - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectBeneficiaryDialog(model), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getBeneficiaryType()), - Icon(Icons.arrow_drop_down) - ], + isShowAppBar: true, + imagesInfo: imagesInfo, + appBarTitle: TranslationBase.of(context).advancePayment, + description: TranslationBase.of(context).infoAdvancePayment, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).advancePaymentLabel, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), ), - ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - SizedBox( - height: 12, - ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + SizedBox(height: 12), InkWell( onTap: () { - GifLoaderDialogUtils.showMyDialog(context); - model.getFamilyFiles().then((value) { - GifLoaderDialogUtils.hideDialog(context); - confirmSelectFamilyDialog(model - .getAllSharedRecordsByStatusResponse - .getAllSharedRecordsByStatusList); - }); + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).myAccount, 0), + RadioSelectionDialogModel(TranslationBase.of(context).myFamilyFiles, 1), + RadioSelectionDialogModel(TranslationBase.of(context).otherAccount, 2), + ]; + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: + beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)), + onValueSelected: (index) { + var type; + if (index == 0) { + type = BeneficiaryType.MyAccount; + } else if (index == 1) { + type = BeneficiaryType.MyFamilyFiles; + } else { + type = BeneficiaryType.OtherAccount; + } + + setState(() { + if (type == BeneficiaryType.MyAccount) { + _fileTextController.text = model.user.patientID.toString(); + advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; + } else + _fileTextController.text = ""; + + beneficiaryType = type; + }); + }, + ), + ); }, child: Container( - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(8), 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(getFamilyMembersName()), + Text( + getBeneficiaryType(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), Icon(Icons.arrow_drop_down) ], ), ), ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).fileNumber, - controller: _fileTextController, - ), - if (beneficiaryType == BeneficiaryType.OtherAccount) - SizedBox( - height: 12, - ), - if (beneficiaryType == BeneficiaryType.OtherAccount) - InkWell( - onTap: () { - if (_fileTextController.text.isNotEmpty) { + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) SizedBox(height: 12), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + InkWell( + onTap: () { GifLoaderDialogUtils.showMyDialog(context); - model - .getPatientInfoByPatientID( - id: _fileTextController.text) - .then((value) { + model.getFamilyFiles().then((value) { GifLoaderDialogUtils.hideDialog(context); - confirmSelectPatientDialog(model.patientInfoList); + confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); }); - } else - AppToast.showErrorToast( - message: 'Please Enter The File Number'); - }, + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getFamilyMembersName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), + SizedBox(height: 12), + NewTextFields( + hintText: TranslationBase.of(context).fileNumber, + controller: _fileTextController, + readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) SizedBox(height: 12), + if (beneficiaryType == BeneficiaryType.OtherAccount) + InkWell( + onTap: () { + if (_fileTextController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) { + GifLoaderDialogUtils.hideDialog(context); + confirmSelectPatientDialog(model.patientInfoList); + }); + } else + AppToast.showErrorToast(message: 'Please Enter The File Number'); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getPatientName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), + SizedBox(height: 12), + InkWell( + onTap: () => confirmSelectHospitalDialog(model.hospitals), child: Container( 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(getPatientName()), - Icon(Icons.arrow_drop_down) + Text( + getHospitalName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), ], ), ), ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.hospitals), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getHospitalName()), - Icon(Icons.arrow_drop_down) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).amount, - keyboardType: TextInputType.number, - onChanged: (value) { - setState(() { - amount = value; - }); - }, - ), - SizedBox( - height: 12, - ), - if (model.user != null) + SizedBox(height: 12), NewTextFields( - hintText: TranslationBase.of(context).depositorEmail, - initialValue: model.user.emailAddress, + hintText: TranslationBase.of(context).amount, + keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), onChanged: (value) { - email = value; + setState(() { + amount = value; + }); }, ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).notes, - controller: _notesTextController, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + SizedBox(height: 12), + if (model.user != null) + NewTextFields( + hintText: TranslationBase.of(context).depositorEmail, + initialValue: model.user.emailAddress, + onChanged: (value) { + email = value; + }, + ), + SizedBox(height: 12), + NewTextFields( + hintText: TranslationBase.of(context).notes, + controller: _notesTextController, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - height: 90, - width: double.infinity, - padding: EdgeInsets.all(18), - child: SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).submit, - disabled: amount.isEmpty || - _fileTextController.text.isEmpty || - _selectedHospital == null, - onTap: () { - var mobileNum; - var patientName; + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).submit, + (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) + ? null + : () { + var mobileNum; + var patientName; - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { - mobileNum = selectedPatientFamily.mobileNumber; - patientName = selectedPatientFamily.patientName; - } + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { + mobileNum = selectedPatientFamily.mobileNumber; + patientName = selectedPatientFamily.patientName; + } - if (beneficiaryType == BeneficiaryType.MyAccount) { - mobileNum = model.user.mobileNumber; - patientName = model.user.firstName; - } + if (beneficiaryType == BeneficiaryType.MyAccount) { + mobileNum = model.user.mobileNumber; + patientName = model.user.firstName; + } - if (beneficiaryType == BeneficiaryType.OtherAccount) { - mobileNum = _selectedPatientInfo.mobileNumber; - patientName = _selectedPatientInfo.fullName; - } + if (beneficiaryType == BeneficiaryType.OtherAccount) { + mobileNum = _selectedPatientInfo.mobileNumber; + patientName = _selectedPatientInfo.fullName; + } - advanceModel.fileNumber = _fileTextController.text; - advanceModel.hospitalsModel = _selectedHospital; - advanceModel.note = _notesTextController.text; - advanceModel.email = email ?? model.user.emailAddress; - advanceModel.amount = amount; - advanceModel.mobileNumber = mobileNum; - advanceModel.patientName = patientName; - GifLoaderDialogUtils.showMyDialog(context); - model - .getPatientInfoByPatientIDAndMobileNumber(advanceModel) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.Error && - model.state != ViewState.ErrorLocal) { - Utils.hideKeyboard(context); - Navigator.push(context, FadePage(page: PaymentMethod())) - .then( - (value) { - Navigator.push( - context, - FadePage( - page: ConfirmPaymentPage( - advanceModel: advanceModel, - selectedPaymentMethod: value, - patientInfoAndMobileNumber: - model.patientInfoAndMobileNumber, - authenticatedUser: authUser, - ), - ), - ); + advanceModel.fileNumber = _fileTextController.text; + advanceModel.hospitalsModel = _selectedHospital; + advanceModel.note = _notesTextController.text; + advanceModel.email = email ?? model.user.emailAddress; + advanceModel.amount = amount; + advanceModel.mobileNumber = mobileNum; + advanceModel.patientName = patientName; + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { + Utils.hideKeyboard(context); + Navigator.push( + context, + FadePage( + page: PaymentMethod( + onSelectedMethod: (String metohd) { + setState(() {}); + }, + isShowInstallments: num.tryParse(amount) >= 1000 ? true : false), + ), + ).then( + (value) { + Navigator.push( + context, + FadePage( + page: ConfirmPaymentPage( + advanceModel: advanceModel, + selectedPaymentMethod: value, + patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, + authenticatedUser: authUser, + ), + ), + ); + }, + ); + } + }); }, - ); - } - }); - }, + color: Color(0xffD02127), + textColor: Colors.white, + disabledColor: Color(0xffEAEAEA), + ), ), - )), - ); - } - - void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { - showDialog( - context: context, - child: SelectBeneficiaryDialog( - beneficiaryType: beneficiaryType, - onValueSelected: (value) { - setState(() { - if (value == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = - model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - beneficiaryType = value; - }); - }, + ], + ), ), ); } + int _selectedHospitalIndex = -1; + void confirmSelectHospitalDialog(List hospitals) { + List list = [ + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; showDialog( context: context, - child: SelectHospitalDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = hospitals[index]; + setState(() {}); }, ), ); } + int _selectedPatientIndex = -1; + void confirmSelectPatientDialog(List patientInfoList) { + List list = [ + for (int i = 0; i < patientInfoList.length; i++) RadioSelectionDialogModel(patientInfoList[i].fullName, i), + ]; showDialog( context: context, - child: SelectPatientInfoDialog( - patientInfoList: patientInfoList, - selectedPatientInfo: _selectedPatientInfo, - onValueSelected: (value) { - setState(() { - advanceModel.depositorName = value.fullName; - _selectedPatientInfo = value; - }); + child: RadioSelectionDialog( + listData: list, + isScrollable: true, + selectedIndex: _selectedPatientIndex, + onValueSelected: (index) { + _selectedPatientIndex = index; + _selectedPatientInfo = patientInfoList[index]; + advanceModel.depositorName = _selectedPatientInfo.fullName; + setState(() {}); }, ), ); } - void confirmSelectFamilyDialog( - List getAllSharedRecordsByStatusList) { - if (getAllSharedRecordsByStatusList.isNotEmpty) + int _selectedFamilyMemberIndex = -1; + + void confirmSelectFamilyDialog(List getAllSharedRecordsByStatusList) { + if (getAllSharedRecordsByStatusList.isNotEmpty) { + List list = [ + for (int i = 0; i < getAllSharedRecordsByStatusList.length; i++) + if (getAllSharedRecordsByStatusList[i].status == 3) RadioSelectionDialogModel(getAllSharedRecordsByStatusList[i].patientName, i), + ]; showDialog( context: context, - child: SelectPatientFamilyDialog( - getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, - selectedPatientFamily: selectedPatientFamily, - onValueSelected: (value) { - setState(() { - selectedPatientFamily = value; - _fileTextController.text = - selectedPatientFamily.responseID.toString(); - advanceModel.depositorName = value.patientName; - }); + child: RadioSelectionDialog( + listData: list, + isScrollable: true, + selectedIndex: _selectedFamilyMemberIndex, + onValueSelected: (index) { + _selectedFamilyMemberIndex = index; + selectedPatientFamily = getAllSharedRecordsByStatusList[index]; + setState(() {}); }, ), ); + } } String getBeneficiaryType() { @@ -410,8 +450,7 @@ class _AdvancePaymentPageState extends State { getAuthUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 0d2fac93..2d79219d 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -8,29 +8,28 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; -import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; -class ConfirmPaymentPage extends StatelessWidget { +class ConfirmPaymentPage extends StatefulWidget { final AdvanceModel advanceModel; final PatientInfoAndMobileNumber patientInfoAndMobileNumber; final String selectedPaymentMethod; - MyInAppBrowser browser; AuthenticatedUser authenticatedUser; - AppSharedPreferences sharedPref = AppSharedPreferences(); - String transID = ""; ConfirmPaymentPage( {this.advanceModel, @@ -38,32 +37,56 @@ class ConfirmPaymentPage extends StatelessWidget { this.selectedPaymentMethod, this.authenticatedUser}); + @override + _ConfirmPaymentPageState createState() => _ConfirmPaymentPageState(); +} + +class _ConfirmPaymentPageState extends State { + MyInAppBrowser browser; + + AppSharedPreferences sharedPref = AppSharedPreferences(); + + String transID = ""; + + void submit(MyBalanceViewModel model, code) { + final activationCode = code; + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); + model + .checkActivationCodeForAdvancePayment(activationCode: activationCode) + .then((value) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + Navigator.pop(context, true); + AppoitmentAllHistoryResultList appo = + new AppoitmentAllHistoryResultList(); + appo.projectID = widget.patientInfoAndMobileNumber.projectID; + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, + double.parse(widget.advanceModel.amount), null); + }); + } + @override Widget build(BuildContext context) { - void showSMSDialog() { - showDialog( - context: context, - barrierDismissible: false, - child: ConfirmSMSDialog( - phoneNumber: patientInfoAndMobileNumber.mobileNumber, - ), - ).then((value) { - print("dialog dismissed"); - print(value); - if (value != null && value) { - AppoitmentAllHistoryResultList appo = - new AppoitmentAllHistoryResultList(); - appo.projectID = patientInfoAndMobileNumber.projectID; - openPayment(selectedPaymentMethod, authenticatedUser, - double.parse(advanceModel.amount), null); - } - }); + void showSMSDialog(MyBalanceViewModel model) { + new SMSOTP( + context, + 1, + widget.patientInfoAndMobileNumber.mobileNumber, + (value) { + submit(model, value); + }, + () => { + Navigator.pop(context), + }, + ).displayDialog(context); } return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).advancePayment, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( @@ -71,11 +94,14 @@ class ConfirmPaymentPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( + Text( TranslationBase.of(context).confirmThePayment, textAlign: TextAlign.center, - fontWeight: FontWeight.w500, - fontSize: 24, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), ), SizedBox( height: 12, @@ -86,13 +112,18 @@ class ConfirmPaymentPage extends StatelessWidget { Container( height: 100.0, padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: Image.asset(getImagePath(selectedPaymentMethod)), + width: MediaQuery.of(context).size.width * 0.30, + child: Image.asset( + getImagePath(widget.selectedPaymentMethod)), ), - Texts( - '${advanceModel.amount} SAR', - fontSize: 26, - bold: true, + Text( + '${widget.advanceModel.amount} ' + + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w900, + letterSpacing: -0.48, + ), ) ], ), @@ -106,7 +137,7 @@ class ConfirmPaymentPage extends StatelessWidget { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).fileNumber, - initialValue: advanceModel.fileNumber, + initialValue: widget.advanceModel.fileNumber, isEnabled: false, ), ), @@ -116,7 +147,8 @@ class ConfirmPaymentPage extends StatelessWidget { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).name, - initialValue: patientInfoAndMobileNumber.firstName, + initialValue: + widget.patientInfoAndMobileNumber.firstName, isEnabled: false, ), ), @@ -128,7 +160,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).mobileNumber, - initialValue: patientInfoAndMobileNumber.mobileNumber, + initialValue: widget.patientInfoAndMobileNumber.mobileNumber, isEnabled: false, ), SizedBox( @@ -148,7 +180,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).notes, - initialValue: advanceModel.note, + initialValue: widget.advanceModel.note, isEnabled: false, ), ], @@ -156,26 +188,26 @@ class ConfirmPaymentPage extends StatelessWidget { ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, - width: double.infinity, - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: Theme.of(context).primaryColor, - label: TranslationBase.of(context).confirm.toUpperCase(), - disabled: model.state == ViewState.Busy, - onTap: () { - GifLoaderDialogUtils.showMyDialog(context); - 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(); - }); - }, + color: Colors.white, + child: Container( + // height: MediaQuery.of(context).size.width * 0.18, + width: double.infinity, + padding: EdgeInsets.all(20), + child: DefaultButton( + TranslationBase.of(context).confirm.toUpperCase(), + () { + GifLoaderDialogUtils.showMyDialog(context); + model + .sendActivationCodeForAdvancePayment( + patientID: int.parse(widget.advanceModel.fileNumber), + projectID: widget.advanceModel.hospitalsModel.iD) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state != ViewState.ErrorLocal && + model.state != ViewState.Error) showSMSDialog(model); + }); + }, + ), ), ), ), @@ -185,19 +217,22 @@ class ConfirmPaymentPage extends StatelessWidget { String getImagePath(String paymentMethod) { switch (paymentMethod) { case "MADA": - return 'assets/images/new-design/mada.png'; + return 'assets/images/new/payment/Mada.png'; break; case "SADAD": return 'assets/images/new-design/sadad.png'; break; case "VISA": - return 'assets/images/new-design/visa.png'; + return 'assets/images/new/payment/visa.png'; break; case "MASTERCARD": - return 'assets/images/new-design/mastercard.png'; + return 'assets/images/new/payment/Mastercard.png'; break; case "Installment": - return 'assets/images/new-design/installment.png'; + return 'assets/images/new/payment/installments.png'; + break; + case "ApplePay": + return 'assets/images/new/payment/Apple_Pay.png'; break; } @@ -212,23 +247,24 @@ class ConfirmPaymentPage extends StatelessWidget { onLoadStartCallback: onBrowserLoadStart); transID = Utils.getAdvancePaymentTransID( - advanceModel.hospitalsModel.iD, int.parse(advanceModel.fileNumber)); + widget.advanceModel.hospitalsModel.iD, + int.parse(widget.advanceModel.fileNumber)); browser.openPaymentBrowser( amount, "Advance Payment", transID, - advanceModel.hospitalsModel.iD.toString(), - advanceModel.email, + widget.advanceModel.hospitalsModel.iD.toString(), + widget.advanceModel.email, paymentMethod, - patientInfoAndMobileNumber.patientType, - advanceModel.patientName, - advanceModel.fileNumber, + widget.patientInfoAndMobileNumber.patientType, + widget.advanceModel.patientName, + widget.advanceModel.fileNumber, authenticatedUser, browser, false, - null, - null); + "3", + ""); } onBrowserLoadStart(String url) { @@ -282,13 +318,13 @@ class ConfirmPaymentPage extends StatelessWidget { String paymentReference = res['Fort_id'].toString(); service.HIS_createAdvancePayment( appo, - advanceModel.hospitalsModel.iD.toString(), + widget.advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], - patientInfoAndMobileNumber.patientType, - advanceModel.patientName, - advanceModel.fileNumber, + widget.patientInfoAndMobileNumber.patientType, + widget.advanceModel.patientName, + widget.advanceModel.fileNumber, AppGlobal.context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); diff --git a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart deleted file mode 100644 index d7ce3fac..00000000 --- a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart +++ /dev/null @@ -1,177 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; -import '../advance_payment_page.dart'; - -class SelectBeneficiaryDialog extends StatefulWidget { - final BeneficiaryType beneficiaryType; - final Function(BeneficiaryType) onValueSelected; - - SelectBeneficiaryDialog( - {Key key, this.beneficiaryType, this.onValueSelected}); - - @override - _SelectBeneficiaryDialogState createState() => - _SelectBeneficiaryDialogState(this.beneficiaryType); -} - -class _SelectBeneficiaryDialogState extends State { - _SelectBeneficiaryDialogState(this.beneficiaryType); - - BeneficiaryType beneficiaryType; - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Container( - child: Column( - children: [ - Divider(), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.MyAccount; - }); - }, - child: ListTile( - title: Text(TranslationBase.of(context).myAccount), - leading: Radio( - value: BeneficiaryType.MyAccount, - groupValue: beneficiaryType, - activeColor: secondaryColor, - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.MyFamilyFiles; - }); - }, - child: ListTile( - title: Text(TranslationBase.of(context).myFamilyFiles), - leading: Radio( - value: BeneficiaryType.MyFamilyFiles, - groupValue: beneficiaryType, - activeColor: Color(0xFF40ACC9), - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.OtherAccount; - }); - }, - child: ListTile( - title: Text(TranslationBase.of(context).otherAccount), - leading: Radio( - value: BeneficiaryType.OtherAccount, - groupValue: beneficiaryType, - activeColor: Color(0xFF40ACC9), - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(beneficiaryType); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - ), - ], - ) - ], - ), - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart index 19e4fea4..d0f991ac 100644 --- a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart @@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +// todo 'sikander' remove this file when usage known class SelectCiteisDialog extends StatefulWidget { final List hospitals; final Function(CitiesModel) onValueSelected; diff --git a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart deleted file mode 100644 index a9a4fea2..00000000 --- a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart +++ /dev/null @@ -1,131 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectHospitalDialog extends StatefulWidget { - final List hospitals; - final Function(HospitalsModel) onValueSelected; - HospitalsModel selectedHospital; - - SelectHospitalDialog( - {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); - - @override - _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); -} - -class _SelectHospitalDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.hospitals.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedHospital = widget.hospitals[index]; - }); - }, - child: ListTile( - title: Text(widget.hospitals[index].name + - ' ${widget.hospitals[index].distanceInKilometers} KM'), - leading: Radio( - value: widget.hospitals[index], - groupValue: widget.selectedHospital, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedHospital = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedHospital); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart deleted file mode 100644 index ab2b48d5..00000000 --- a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart +++ /dev/null @@ -1,130 +0,0 @@ -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectPatientFamilyDialog extends StatefulWidget { - final List getAllSharedRecordsByStatusList; - final Function(GetAllSharedRecordsByStatusList) onValueSelected; - GetAllSharedRecordsByStatusList selectedPatientFamily; - - SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected,this.selectedPatientFamily}); - - @override - _SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState(); -} - -class _SelectPatientFamilyDialogState extends State { - - @override - void initState() { - super.initState(); - widget.selectedPatientFamily = widget.selectedPatientFamily?? widget.getAllSharedRecordsByStatusList[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.getAllSharedRecordsByStatusList.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusList[index]; - }); - }, - child: ListTile( - title: Text(widget.getAllSharedRecordsByStatusList[index].patientName), - leading: Radio( - value: widget.getAllSharedRecordsByStatusList[index], - groupValue: widget.selectedPatientFamily, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedPatientFamily = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedPatientFamily); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart deleted file mode 100644 index 3cce8e61..00000000 --- a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart +++ /dev/null @@ -1,132 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectPatientInfoDialog extends StatefulWidget { - final List patientInfoList ; - final Function(PatientInfo) onValueSelected; - PatientInfo selectedPatientInfo; - - SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo}); - - @override - _SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState(); -} - -class _SelectPatientInfoDialogState extends State { - - @override - void initState() { - super.initState(); - widget.selectedPatientInfo = widget.selectedPatientInfo?? widget.patientInfoList[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.patientInfoList.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedPatientInfo = widget.patientInfoList[index]; - }); - }, - child: ListTile( - title: Text(widget.patientInfoList[index].fullName), - leading: Radio( - value: widget.patientInfoList[index], - groupValue: widget.selectedPatientInfo, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedPatientInfo = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedPatientInfo); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index f097bda5..e4ff9581 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -1,13 +1,16 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_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/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; import 'advance_payment_page.dart'; @@ -17,105 +20,162 @@ class MyBalancePage extends StatelessWidget { @override Widget build(BuildContext context) { imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); return BaseView( onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: TranslationBase.of(context).myBalances, + appBarTitle: TranslationBase.of(context).myWallet, imagesInfo: imagesInfo, description: TranslationBase.of(context).infoMyBalance, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).balanceAmount, - color: Colors.black, - bold: true, - ), - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(8), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - color: Colors.red[700], - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(7), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - '${model.totalAdvanceBalanceAmount ?? 0} ' + - TranslationBase.of(context).sar, - color: Colors.white, - bold: true, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.fromLTRB(14, 12, 10, 12), + decoration: BoxDecoration( + color: Color(0xff2B353E), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), ), - Texts( - TranslationBase.of(context).totalBalance, - color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + "assets/images/new/services/balance_credit.svg", + height: 40, + width: 40, + color: Colors.white, + ), + SizedBox(height: 6), + Text( + TranslationBase.of(context).totalBalance, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, + color: Colors.white, + //height: 16/22 + ), + ), + ], + ), + ), + Container( + padding: EdgeInsets.fromLTRB(14, 10, 12, 10), + decoration: BoxDecoration( + color: Color(0xff3f4850), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + double.parse(model.totalAdvanceBalanceAmount?.toString() ?? "0").toStringAsFixed(2), + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + letterSpacing: -1.44, + height: 24 / 23, + color: Colors.white, + ), + ), + Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.96, + color: Colors.white, + ), + ), + ], + ), + ), + ], ), - ], - ), - ), - SizedBox( - height: 9, - ), - ...List.generate( - model.patientAdvanceBalanceAmountList.length, - (index) => Container( - padding: EdgeInsets.all(8), - height: 65, - margin: EdgeInsets.only(top: 8), - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(7), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} ' + - TranslationBase.of(context).sar, - bold: true, - ), - Texts(model.patientAdvanceBalanceAmountList[index] - .projectDescription), - ], ), - ), + SizedBox(height: 12), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (cxt, index) { + PatientAdvanceBalanceAmount balanceAmount = model.patientAdvanceBalanceAmountList[index]; + double amount = double.parse(balanceAmount.patientAdvanceBalanceAmount?.toString() ?? "0"); + return Container( + padding: EdgeInsets.fromLTRB(14, 18, 14, 18), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + balanceAmount.projectDescription, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, + color: Color(0xff2E303A), + ), + ), + ), + Text( + amount.toStringAsFixed(2) + " " + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, + color: Color(0xff2E303A), + ), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => SizedBox(height: 12), + itemCount: model.patientAdvanceBalanceAmountList.length), + ], ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.13, - ) - ], + ), ), - ), - ), - bottomSheet: Container( - // height: MediaQuery.of(context).size.height * 0.12, - height: 70.0, - color: Colors.white, - width: double.infinity, - padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).createAdvancedPayment, - onTap: () { - Navigator.push(context, FadePage(page: AdvancePaymentPage())); - }, - ), + DefaultButton( + TranslationBase.of(context).createAdvancedPayment, + () { + Navigator.push(context, FadePage(page: AdvancePaymentPage())); + }, + ).insideContainer, + ], ), ), ); diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart index ec3eaf3b..972d6b92 100644 --- a/lib/pages/medical/balance/new_text_Field.dart +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -70,8 +69,8 @@ class NewTextFields extends StatefulWidget { this.prefixIcon, this.bare = false, this.onTap, - this.fontSize = 16.0, - this.fontWeight = FontWeight.w700, + this.fontSize = 14.0, + this.fontWeight = FontWeight.w600, this.autoValidate = false, this.hintColor, this.isEnabled = true,this.counterText=""}) diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index c8fad3ce..28e1c1a9 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -4,23 +4,21 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_mode import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.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 'doctor_profile_page.dart'; - class DoctorHomePage extends StatelessWidget { List imagesInfo = List(); @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/1.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/0.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/1.png')); return BaseView( onModelReady: (model) => model.getMyDoctor(), builder: (context, MyDoctorViewModel model, widget) => AppScaffold( @@ -29,86 +27,70 @@ class DoctorHomePage extends StatelessWidget { appBarTitle: TranslationBase.of(context).myDoctor, description: TranslationBase.of(context).infoMyDoctor, infoList: TranslationBase.of(context).infoMyDoctorPoints, + showNewAppBar: true, + showNewAppBarTitle: true, imagesInfo: imagesInfo, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: FractionallySizedBox( - widthFactor: 1.0, - child: Center( - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: model.filterType, - onChanged: (FilterType value) => - model.setFilterType(value), - ), - ), - ), - ) - ], - ), - ...List.generate( - model.patientDoctorAppointmentList.length, - (index) => AppExpandableNotifier( - title: model - .patientDoctorAppointmentList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model.patientDoctorAppointmentList[index] - .patientDoctorAppointmentList - .map((doctor) { - DoctorList doctorList = DoctorList( - projectID: doctor.projectID, - setupID: doctor.setupID, - clinicID: doctor.clinicID, - projectName: doctor.projectName, - clinicName: doctor.clinicName, - actualDoctorRate: doctor.actualDoctorRate, - doctorID: doctor.doctorID, - doctorRate: doctor.doctorRate, - gender: doctor.gender, - doctorTitle: doctor.doctorTitle, - name: doctor.name, - doctorImageURL: doctor.doctorImageURL, - nationalityFlagURL: doctor.nationalityFlagURL); - return DoctorView( - doctor: doctorList, - isLiveCareAppointment: false, - ); - - }).toList(), - )), - ) - ], + backgroundColor: Color(0xffF8F8F8), + body: Column( + children: [ + Row( + children: [ + MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () { + model.setFilterType(FilterType.Clinic); + }), + MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () { + model.setFilterType(FilterType.Hospital); + }), + ], + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 1.0, + child: ListView.separated( + physics: BouncingScrollPhysics(), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + title: model.patientDoctorAppointmentList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + DoctorList _doctorList = model.patientDoctorAppointmentList[index].patientDoctorAppointmentList[_index]; + DoctorList doctorList = DoctorList( + projectID: _doctorList.projectID, + setupID: _doctorList.setupID, + clinicID: _doctorList.clinicID, + projectName: _doctorList.projectName, + clinicName: _doctorList.clinicName, + actualDoctorRate: _doctorList.actualDoctorRate, + doctorID: _doctorList.doctorID, + doctorRate: _doctorList.doctorRate, + gender: _doctorList.gender, + doctorTitle: _doctorList.doctorTitle, + name: _doctorList.name, + doctorImageURL: _doctorList.doctorImageURL, + nationalityFlagURL: _doctorList.nationalityFlagURL); + return DoctorView( + doctor: doctorList, + isLiveCareAppointment: _doctorList.isLiveCareClinic, + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: model.patientDoctorAppointmentList[index].patientDoctorAppointmentList.length), + ); + }, + itemCount: model.patientDoctorAppointmentList.length), ), ), - ), + ], ), ), ); diff --git a/lib/pages/medical/doctor/doctor_profile_page.dart b/lib/pages/medical/doctor/doctor_profile_page.dart index 7588205c..18e76002 100644 --- a/lib/pages/medical/doctor/doctor_profile_page.dart +++ b/lib/pages/medical/doctor/doctor_profile_page.dart @@ -1,15 +1,9 @@ import 'package:diplomaticquarterapp/core/model/doctor/patient_doctor_appointment.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_doctor_view_model.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:rating_bar/rating_bar.dart'; - -import 'doctor_information_page.dart'; class DoctorProfilePage extends StatefulWidget { final PatientDoctorAppointment patientDoctorAppointment; diff --git a/lib/pages/medical/eye/ClassesPage.dart b/lib/pages/medical/eye/ClassesPage.dart index 21a07d23..bb38d095 100644 --- a/lib/pages/medical/eye/ClassesPage.dart +++ b/lib/pages/medical/eye/ClassesPage.dart @@ -1,12 +1,7 @@ import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.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/dialogs/confirm_send_email_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,119 +11,99 @@ class ClassesPage extends StatelessWidget { final String projectName; final int projectID; - const ClassesPage( - {Key key, - this.glassPerscription, - this.appointmentNo, - this.projectName, - this.projectID}) - : super(key: key); + const ClassesPage({Key key, this.glassPerscription, this.appointmentNo, this.projectName, this.projectID}) : super(key: key); @override Widget build(BuildContext context) { - return BaseView( - builder: (_, model, w) => AppScaffold( - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.only(top: 70, left: 15, right: 15, bottom: 15), - child: Column( - children: [ - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).rightEye, - fontSize: 23, - bold: true, + return SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 20), + child: Column( + children: [ + Container( + decoration: cardRadius(12), + child: Container( + + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).rightEye, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), ), - getRow(TranslationBase.of(context).sphere, - '${glassPerscription.rightEyeSpherical}', '-'), - getRow(TranslationBase.of(context).cylinder, - '${glassPerscription.rightEyeCylinder}', '-'), - getRow(TranslationBase.of(context).axis, - '${glassPerscription.rightEyeAxis}', '-'), - getRow(TranslationBase.of(context).prism, - '${glassPerscription.rightEyePrism}', '-'), - getRow(TranslationBase.of(context).va, - '${glassPerscription.rightEyeVA}', '-'), - ], - ), - ), - SizedBox( - height: 17, + ), + getRow(TranslationBase.of(context).sphere, '${glassPerscription.rightEyeSpherical}', '-'), + getRow(TranslationBase.of(context).cylinder, '${glassPerscription.rightEyeCylinder}', '-'), + getRow(TranslationBase.of(context).axis, '${glassPerscription.rightEyeAxis}', '-'), + getRow(TranslationBase.of(context).prism, '${glassPerscription.rightEyePrism}', '-'), + getRow(TranslationBase.of(context).va, '${glassPerscription.rightEyeVA}', '-',isLast:true), + ], ), - Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).leftEye, - fontSize: 23, - bold: true, - ), + ), + ), + SizedBox( + height: 12, + ), + Container( + decoration: cardRadius(12), + child: Container( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).leftEye, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), - getRow(TranslationBase.of(context).sphere, - '${glassPerscription.leftEyeSpherical}', '-'), - getRow(TranslationBase.of(context).cylinder, - '${glassPerscription.leftEyeCylinder}', '-'), - getRow(TranslationBase.of(context).axis, - '${glassPerscription.leftEyeAxis}', '-'), - getRow(TranslationBase.of(context).prism, - '${glassPerscription.leftEyePrism}', '-'), - getRow(TranslationBase.of(context).va, - '${glassPerscription.leftEyeVA}', '-'), - ], - ), - ), - SizedBox( - height: 17, - ), - Container( - width: double.infinity, - child: SecondaryButton( - label: TranslationBase.of(context).sendEmail, - onTap: () { - showConfirmMessage(context, () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.sendGlassesPrescriptionEmail( - appointmentNo: appointmentNo, - projectName: projectName, - projectID: projectID); - GifLoaderDialogUtils.hideDialog(context); - }, model.user.emailAddress); - }, - textColor: Colors.white, - color: Colors.red[700], - icon: Icon( - Icons.email, - color: Colors.white, ), ), - ) - ], + getRow(TranslationBase.of(context).sphere, '${glassPerscription.leftEyeSpherical}', '-'), + getRow(TranslationBase.of(context).cylinder, '${glassPerscription.leftEyeCylinder}', '-'), + getRow(TranslationBase.of(context).axis, '${glassPerscription.leftEyeAxis}', '-'), + getRow(TranslationBase.of(context).prism, '${glassPerscription.leftEyePrism}', '-'), + getRow(TranslationBase.of(context).va, '${glassPerscription.leftEyeVA}', '-',isLast:true), + ], + ), + ), ), - ), + SizedBox( + height: 17, + ), + // Container( + // width: double.infinity, + // child: SecondaryButton( + // label: TranslationBase.of(context).sendEmail, + // onTap: () { + // showConfirmMessage(context, () async { + // GifLoaderDialogUtils.showMyDialog(context); + // await model.sendGlassesPrescriptionEmail(appointmentNo: appointmentNo, projectName: projectName, projectID: projectID); + // GifLoaderDialogUtils.hideDialog(context); + // }, model.user.emailAddress); + // }, + // textColor: Colors.white, + // color: Colors.red[700], + // icon: Icon( + // Icons.email, + // color: Colors.white, + // ), + // ), + // ) + ], ), ), ); } - void showConfirmMessage( - BuildContext context, GestureTapCallback onTap, String email) { + void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, child: ConfirmSendEmailDialog( @@ -140,31 +115,40 @@ class ClassesPage extends StatelessWidget { ); } - Widget getRow(String title, String val1, String val2) => Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(flex: 4, child: Texts(title)), - Expanded( - flex: 2, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Texts(val1 == 'null' ? '-' : val1), - Texts(val2 != 'null' ? '-' : val2), - ], - ), - ) - ], - ), - Divider() - ], + Widget getRow(String title, String val1, String val2,{bool isLast=false}) => Padding( + padding: const EdgeInsets.only(left: 8,right: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(flex: 4, child: Text(title,style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4))), + Expanded( + flex: 2, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + val1 == 'null' ? '-' : val1, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4), + ), + Text( + val2 != 'null' ? '-' : val2, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4), + ), + ], + ), + ) + ], + ), ), - ); + isLast?Container(height: 4,): Divider() + ], + ), + ); } diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index b70b9c09..007a5527 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -2,10 +2,8 @@ import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.da import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.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/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -18,120 +16,105 @@ class ContactLensPage extends StatelessWidget { final String projectName; final int projectID; - const ContactLensPage( - {Key key, - this.listHISGetContactLensPerscription, - this.appointmentNo, - this.projectName, - this.projectID}) - : super(key: key); + const ContactLensPage({Key key, this.listHISGetContactLensPerscription, this.appointmentNo, this.projectName, this.projectID}) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - builder: (_,model,w)=> - AppScaffold( + builder: (_, model, w) => AppScaffold( body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(top: 70, left: 15, right: 15, bottom: 15), + margin: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 20), child: Column( children: [ Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).rightEye, - fontSize: 23, - bold: true, + decoration: cardRadius(12), + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).rightEye, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), ), - ), - getRow(TranslationBase.of(context).brand, - '${listHISGetContactLensPerscription.brand}'), - getRow('B.C', - '${listHISGetContactLensPerscription.baseCurve}'), - getRow(TranslationBase.of(context).power, - '${listHISGetContactLensPerscription.power}'), - getRow(TranslationBase.of(context).diameter, - '${listHISGetContactLensPerscription.diameter}'), - getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), - getRow('CT', '${listHISGetContactLensPerscription.cT}'), - getRow( - 'Blend', '${listHISGetContactLensPerscription.blend}'), - getRow(TranslationBase.of(context).reminder, - '${listHISGetContactLensPerscription.remarks}'), - ], + getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'), + getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'), + getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'), + getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'), + getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), + getRow('CT', '${listHISGetContactLensPerscription.cT}'), + getRow('Blend', '${listHISGetContactLensPerscription.blend}'), + getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true), + ], + ), ), ), SizedBox( - height: 17, + height: 12, ), Container( - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).leftEye, - fontSize: 23, - bold: true, + decoration: cardRadius(12), + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).leftEye, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), ), - ), - getRow(TranslationBase.of(context).brand, - '${listHISGetContactLensPerscription.brand}'), - getRow('B.C', - '${listHISGetContactLensPerscription.baseCurve}'), - getRow(TranslationBase.of(context).power, - '${listHISGetContactLensPerscription.power}'), - getRow(TranslationBase.of(context).diameter, - '${listHISGetContactLensPerscription.diameter}'), - getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), - getRow('CT', '${listHISGetContactLensPerscription.cT}'), - getRow( - 'Blend', '${listHISGetContactLensPerscription.blend}'), - getRow(TranslationBase.of(context).reminder, - '${listHISGetContactLensPerscription.remarks}'), - ], + getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'), + getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'), + getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'), + getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'), + getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), + getRow('CT', '${listHISGetContactLensPerscription.cT}'), + getRow('Blend', '${listHISGetContactLensPerscription.blend}'), + getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true), + ], + ), ), ), SizedBox( height: 17, ), - if (projectViewModel.havePrivilege(15)) - Container( - width: double.infinity, - child: SecondaryButton( - label: TranslationBase.of(context).sendEmail, - textColor: Colors.white, - color: Colors.red[700], - onTap: (){ - showConfirmMessage(context, () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.sendContactLensPrescriptionEmail( - appointmentNo: appointmentNo, - projectName: projectName, - projectID: projectID); - GifLoaderDialogUtils.hideDialog(context); - }, model.user.emailAddress); - }, - icon: Icon( - Icons.email, - color: Colors.white, - ), - ), - ) + // if (projectViewModel.havePrivilege(15)) + // Container( + // width: double.infinity, + // child: SecondaryButton( + // label: TranslationBase.of(context).sendEmail, + // textColor: Colors.white, + // color: Colors.red[700], + // onTap: (){ + // showConfirmMessage(context, () async { + // GifLoaderDialogUtils.showMyDialog(context); + // await model.sendContactLensPrescriptionEmail( + // appointmentNo: appointmentNo, + // projectName: projectName, + // projectID: projectID); + // GifLoaderDialogUtils.hideDialog(context); + // }, model.user.emailAddress); + // }, + // icon: Icon( + // Icons.email, + // color: Colors.white, + // ), + // ), + // ) ], ), ), @@ -140,35 +123,48 @@ class ContactLensPage extends StatelessWidget { ); } - Widget getRow(String title, String val1) => Padding( - padding: const EdgeInsets.all(8.0), + Widget getRow(String title, String val1, {bool isLast = false}) => Padding( + padding: const EdgeInsets.only(left: 8, right: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded(flex: 4, child: Texts(title)), - Expanded( - flex: 2, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(val1 == 'null' ? '-' : val1), - ], - ), - ) - ], + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + flex: 4, + child: Text( + title, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4), + )), + Expanded( + flex: 2, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + val1 == 'null' ? '-' : val1, + style: TextStyle(fontSize: 11, fontWeight: FontWeight.w600, letterSpacing: -0.4), + ), + ], + ), + ) + ], + ), ), - Divider() + isLast + ? Container( + height: 4, + ) + : Divider() ], ), ); - - void showConfirmMessage( - BuildContext context, GestureTapCallback onTap, String email) { + void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, child: ConfirmSendEmailDialog( diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 3af2279e..3d59af3d 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -2,13 +2,23 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; +import 'package:diplomaticquarterapp/models/header_model.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/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; import 'ClassesPage.dart'; import 'ContactLensPage.dart'; @@ -16,21 +26,23 @@ import 'ContactLensPage.dart'; class EyeHomePage extends StatefulWidget { final AppoimentAllHistoryResultList appointmentAllHistoryResultList; - const EyeHomePage({Key key, this.appointmentAllHistoryResultList}) - : super(key: key); + const EyeHomePage({Key key, this.appointmentAllHistoryResultList}) : super(key: key); @override _EyeHomePageState createState() => _EyeHomePageState(); } -class _EyeHomePageState extends State - with SingleTickerProviderStateMixin { +class _EyeHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; + List doctorDetailsList = List(); @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(() { + setState(() {}); + }); } @override @@ -41,76 +53,98 @@ class _EyeHomePageState extends State @override Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - isShowDecPage: false, - appBarTitle: TranslationBase.of(context).measurements, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(60.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + appBarTitle: widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + DoctorHeader( + headerModel: HeaderModel( + widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + widget.appointmentAllHistoryResultList.doctorID, + widget.appointmentAllHistoryResultList.doctorImageURL, + widget.appointmentAllHistoryResultList.doctorSpeciality, + "", + widget.appointmentAllHistoryResultList.projectName, + DateUtil.convertStringToDate(widget.appointmentAllHistoryResultList.appointmentDate), + widget.appointmentAllHistoryResultList.startTime.substring(0, 5), + null, + widget.appointmentAllHistoryResultList.doctorRate, + widget.appointmentAllHistoryResultList.actualDoctorRate, + widget.appointmentAllHistoryResultList.noOfPatientsRate, + "", + //model.user.emailAddress, ), - Center( - child: Container( - height: 55.0, - margin: EdgeInsets.only(left: 20,right: 20,top: 15), - color: Colors.white, - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.40, - child: Center( - child: Texts(TranslationBase.of(context).classes), + isNeedToShowButton: _tabController.index == 0 ? true : projectViewModel.havePrivilege(15), + showConfirmMessageDialog: true, + onRatingAndReviewTap: getDoctorRatingsDetails, + onTap: () { + showConfirmMessage(context, () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendGlassesPrescriptionEmail( + appointmentNo: widget.appointmentAllHistoryResultList.appointmentNo, + projectName: widget.appointmentAllHistoryResultList.projectName, + projectID: widget.appointmentAllHistoryResultList.projectID); + GifLoaderDialogUtils.hideDialog(context); + }, projectViewModel.user.emailAddress); + }, + ), + Container( + height: 45.0, + width: double.infinity, + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 2.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + // width: double.infinity, + child: Center( + child: Text( + TranslationBase.of(context).classes, + style: TextStyle( + fontWeight: FontWeight.w600, + // fontSize: 12, + letterSpacing: -0.36, ), ), - Container( - width: MediaQuery.of(context).size.width * 0.40, - child: Center( - child: Texts(TranslationBase.of(context).contactLens), + ), + ), + Container( + // width: double.infinity, + child: Center( + child: Text( + TranslationBase.of(context).contactLens, + style: TextStyle( + fontWeight: FontWeight.w600, + // fontSize: 12, + letterSpacing: -0.36, ), ), - ], + ), ), - ), + ], ), ), - ], - ), - ), - body: Column( - children: [ + ), Expanded( child: TabBarView( - physics: BouncingScrollPhysics(), + physics: NeverScrollableScrollPhysics(), controller: _tabController, children: [ ClassesPage( - glassPerscription: widget.appointmentAllHistoryResultList - .listHISGetGlassPerscription[0], + glassPerscription: widget.appointmentAllHistoryResultList.listHISGetGlassPerscription[0], appointmentNo: widget.appointmentAllHistoryResultList.appointmentNo, projectName: widget.appointmentAllHistoryResultList.projectName, projectID: widget.appointmentAllHistoryResultList.projectID, @@ -129,4 +163,233 @@ class _EyeHomePageState extends State ), ); } + + void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: email, + onTapSendEmail: () { + onTap(); + }, + ), + ); + } + + void getDoctorRatingsDetails() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRatingDetails(widget.appointmentAllHistoryResultList.doctorID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + doctorDetailsList.clear(); + res['DoctorRatingDetailsList'].forEach((v) { + doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + }); + showRatingDialog(doctorDetailsList); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + void showRatingDialog(List doctorDetailsList) { + 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: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + // height: 400.0, + width: MediaQuery.of(context).size.width * 0.8, + color: Colors.white, + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + color: Theme.of(context).primaryColor, + margin: EdgeInsets.only(bottom: 5.0), + padding: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.white))), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Text(this.widget.appointmentAllHistoryResultList.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: this.widget.appointmentAllHistoryResultList.actualDoctorRate.toDouble(), + size: 35.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(this.widget.appointmentAllHistoryResultList.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews, + style: TextStyle(fontSize: 14.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[1].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffB7B723), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[2].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEBA727), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[3].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEB7227), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), + child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[4].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffE20C0C), + ), + ), + ), + ], + ), + ), + Container(margin: EdgeInsets.only(top: 40.0), child: Divider()), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Align( + alignment: FractionalOffset.bottomCenter, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 40.0, + child: RaisedButton( + elevation: 0.0, + color: Colors.white, + textColor: Colors.red, + hoverColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + } + + double getRatingWidth(int patientNumber) { + var width = (patientNumber / this.widget.appointmentAllHistoryResultList.noOfPatientsRate) * 100; + return width; + } } diff --git a/lib/pages/medical/eye/EyeMeasurementsPage.dart b/lib/pages/medical/eye/EyeMeasurementsPage.dart index 66ea0da7..310f0a13 100644 --- a/lib/pages/medical/eye/EyeMeasurementsPage.dart +++ b/lib/pages/medical/eye/EyeMeasurementsPage.dart @@ -1,12 +1,12 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.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/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -25,6 +25,9 @@ class EyeMeasurementsPage extends StatelessWidget { builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, description: TranslationBase.of(context).infoEye, imagesInfo: [ ImagesInfo( @@ -33,95 +36,64 @@ class EyeMeasurementsPage extends StatelessWidget { ], appBarTitle: TranslationBase.of(context).eyeMeasurements, body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(8), - child: Column( - children: [ - ...List.generate( - model.appointmentFilter.length, - (index) => AppExpandableNotifier( + child: Column( + children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + List _appointmentAllHistoryResultList = model.appointmentFilter[index].appointmentAllHistoryResultList; + return AppExpandableNotifier( title: model.appointmentFilter[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model.appointmentFilter[index] - .appointmentAllHistoryResultList - .map((appointment) { - return InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: EyeHomePage( - appointmentAllHistoryResultList: appointment, - ), - ), - ); - }, - child: Container( - margin: EdgeInsets.all(8), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.white, - border: Border.all(color: Colors.grey), - ), - child: Row( - children: [ - Expanded( - flex: 1, - child: LargeAvatar( - name: appointment.doctorNameObj, - url: appointment.doctorImageURL, - ), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - appointment.doctorNameObj, - bold: true, - ), - Texts( - appointment.clinicName, - variant: 'caption3', - ), - Texts( - DateUtil.getMonthDayYearDateFormatted( - appointment.bookDate), - variant: 'caption3', - ), - StarRating( - totalAverage: appointment - .actualDoctorRate - .toDouble(), - forceStars: true), - ], - ), + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + AppoimentAllHistoryResultList _appointmentResult = _appointmentAllHistoryResultList[_index]; + + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: EyeHomePage( + appointmentAllHistoryResultList: _appointmentResult, ), ), - Icon( - projectViewModel.isArabic - ? Icons.arrow_forward_ios - : Icons.arrow_back_ios, - color: Colors.grey, - size: 18, - ) - ], - ), - ), - ); - }).toList(), - ), - ), - ), - ], - ), + ), + isInOutPatient: _appointmentResult.isInOutPatient, + name: _appointmentResult.doctorTitle + " " + _appointmentResult.doctorNameObj, + // billNo: "appointmentResult.do", + profileUrl: _appointmentResult.doctorImageURL, + subName: _appointmentResult.clinicName, + isLiveCareAppointment: _appointmentResult.isLiveCareAppointment, + date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate), + isSortByClinic: false, + rating: _appointmentResult.actualDoctorRate + 0.0, + // appointmentTime: _appointmentResult.startTime.substring(0, 5), + // remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) + // ? _appointmentResult.remaniningHoursTocanPay + // : null + + //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: _appointmentAllHistoryResultList.length), + ); + }, + itemCount: model.appointmentFilter.length, + ), + + ], ), ), ), diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index a251a1ce..cf0ec4e2 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dar import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/laboratory_result_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -20,34 +19,34 @@ class LaboratoryResultPage extends StatefulWidget { class _LaboratoryResultPageState extends State { - @override Widget build(BuildContext context) { + return BaseView( onModelReady: (model) => model.getLaboratoryResult( - invoiceNo: widget.patientLabOrders.invoiceNo, - clinicID: widget.patientLabOrders.clinicID, - projectID: widget.patientLabOrders.projectID, - orderNo: widget.patientLabOrders.orderNo), + invoiceNo: widget.patientLabOrders.invoiceNo, clinicID: widget.patientLabOrders.clinicID, projectID: widget.patientLabOrders.projectID, orderNo: widget.patientLabOrders.orderNo), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).labResults, + appBarTitle: widget.patientLabOrders.doctorName, baseViewModel: model, - body: Scaffold( - body: ListView.builder( - itemBuilder: (context, index) => LaboratoryResultWidget( - onTap: ()async { - GifLoaderDialogUtils.showMyDialog(context); - await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders,mes: TranslationBase.of(context).sendSuc); - GifLoaderDialogUtils.hideDialog(context); - }, - billNo: widget.patientLabOrders.invoiceNo, - details: model.patientLabSpecialResult[index].resultDataHTML, - orderNo: widget.patientLabOrders.orderNo, - patientLabOrder: widget.patientLabOrders, - ), - itemCount: model.patientLabSpecialResult.length, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), + body: ListView.builder( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 12), + itemBuilder: (context, index) => LaboratoryResultWidget( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.sendLabReportEmail(patientLabOrder: widget.patientLabOrders, mes: TranslationBase.of(context).sendSuc); + GifLoaderDialogUtils.hideDialog(context); + }, + billNo: widget.patientLabOrders.invoiceNo, + details: model.patientLabSpecialResult[index].resultDataHTML, + orderNo: widget.patientLabOrders.orderNo, + patientLabOrder: widget.patientLabOrders, ), + itemCount: model.patientLabSpecialResult.length, ), ), ); diff --git a/lib/pages/medical/labs/labs_home_page.dart b/lib/pages/medical/labs/labs_home_page.dart index ce78a7dc..26738778 100644 --- a/lib/pages/medical/labs/labs_home_page.dart +++ b/lib/pages/medical/labs/labs_home_page.dart @@ -1,11 +1,12 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -16,96 +17,86 @@ import 'package:provider/provider.dart'; import 'laboratory_result_page.dart'; class LabsHomePage extends StatelessWidget { - List imagesInfo =List(); + List imagesInfo = List(); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png')); + imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png')); return BaseView( onModelReady: (model) => model.getLabs(), builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, description: TranslationBase.of(context).infoLab, - appBarTitle: TranslationBase.of(context).labOrders, + appBarTitle: TranslationBase.of(context).labResults, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), imagesInfo: imagesInfo, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: FractionallySizedBox( - widthFactor: 1.0, - child: Center( - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: model.filterType, - onChanged: (FilterType value) => - model.setFilterType(value), - ), - ), - ), - ) - ], - ), - ...List.generate( - model.patientLabOrdersList.length, - (index) => AppExpandableNotifier( - title: model.patientLabOrdersList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model - .patientLabOrdersList[index].patientLabOrdersList - .map((labOrder) { - return DoctorCard( - onTap: () => Navigator.push( - context, - FadePage( - page: LaboratoryResultPage( - patientLabOrders: labOrder, + body: Column( + children: [ + Row( + children: [ + MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () { + model.setFilterType(FilterType.Clinic); + }), + MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () { + model.setFilterType(FilterType.Hospital); + }), + ], + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 1.0, + child: ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + title: model.patientLabOrdersList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index]; + bool _isSortByClinic = model.filterType == FilterType.Clinic; + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: labOrder, + ), + ), ), - ), - ),isInOutPatient: labOrder.isInOutPatient, - name: labOrder.doctorName, - billNo: ' ${labOrder.invoiceNo}', - profileUrl: labOrder.doctorImageURL, - subName: labOrder.projectName, - isLiveCareAppointment: labOrder.isLiveCareAppointment, - date: projectViewModel.isArabic?DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate):DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), - ); - }).toList(), - ), - ), - ) - ], + isInOutPatient: labOrder.isInOutPatient, + name: TranslationBase.of(context).dr + " " + labOrder.doctorName, + billNo: labOrder.invoiceNo, + profileUrl: labOrder.doctorImageURL, + subName: _isSortByClinic ? (labOrder.projectName ?? labOrder.clinicDescription) : (labOrder.clinicDescription ?? labOrder.projectName), + isLiveCareAppointment: labOrder.isLiveCareAppointment, + date: labOrder.orderDate, + isSortByClinic: _isSortByClinic, + //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length), + ); + }, + itemCount: model.patientLabOrdersList.length), ), ), - ), + ], ), ), ); diff --git a/lib/pages/medical/labs/passport_update_page.dart b/lib/pages/medical/labs/passport_update_page.dart index 1e81b2e5..cca80905 100644 --- a/lib/pages/medical/labs/passport_update_page.dart +++ b/lib/pages/medical/labs/passport_update_page.dart @@ -1,11 +1,15 @@ import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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_new.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; class PassportUpdatePage extends StatefulWidget { @override @@ -15,6 +19,7 @@ class PassportUpdatePage extends StatefulWidget { class _PassportUpdatePageState extends State { TextEditingController passportNumber = new TextEditingController(); bool _isButtonDisabled; + ProjectViewModel projectViewModel; @override void initState() { @@ -24,58 +29,224 @@ class _PassportUpdatePageState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).passportNumber, isShowAppBar: true, isBottomBar: true, + showNewAppBar: true, + showNewAppBarTitle: true,backgroundColor: CustomColors.appBackgroudGrey2Color, body: Container( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.all(45.0), - child: Text(TranslationBase.of(context).enterPassportNumber, textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, color: Colors.black)), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).covidBookAppo, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + letterSpacing: -0.64, + ), + ), + mHeight(6), + Row( + children: [ + Text( + TranslationBase.of(context).patientName + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).identificationNumber + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.patientIdentificationNo, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ), + ), + ), + ), + mHeight(40), + SvgPicture.asset("assets/images/new/passport.svg", width: 40.0, fit: BoxFit.fill), + mHeight(12), + Text( + TranslationBase.of(context).enterPassportNumber, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: Colors.black, + letterSpacing: -0.64, + ), + ), + mHeight(8), + inputWidget(TranslationBase.of(context).passportNumber, "", passportNumber), + ], + ), + ), ), - Container( - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: SvgPicture.asset("assets/images/new-design/passport.svg", width: 250.0, fit: BoxFit.fill), + ), + Container( + margin: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0, bottom: 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: new Color(0xFFc5272d), + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: Colors.red[300], + onPressed: () { + if (_isButtonDisabled == false) + updatePassportNumber(); + else + AppToast.showErrorToast(message: TranslationBase.of(context).validPassportNumber); + }, + child: Text( + TranslationBase.of(context).submit, + style: TextStyle( + fontSize: 16.0, + letterSpacing: -0.64, + ), + ), + ), ), - Container( - margin: EdgeInsets.only(left: 50.0, right: 50.0, top: 25.0), - child: TextFields( - keyboardType: TextInputType.text, - fontWeight: FontWeight.normal, - controller: passportNumber, - onChanged: (value) => {_onPassportTextChanged(value)}, - padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), - hintText: TranslationBase.of(context).passportNumber, - )) - ], - ), + ), + ], + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, ), ), - bottomSheet: Container( - margin: EdgeInsets.only(top: 10.0, left: 30.0, right: 30.0, bottom: 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFFc5272d), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: Colors.red[300], - onPressed: () { - if (_isButtonDisabled == false) - updatePassportNumber(); - else - AppToast.showErrorToast(message: TranslationBase.of(context).validPassportNumber); - }, - child: Text(TranslationBase.of(context).submit, style: TextStyle(fontSize: 18.0)), - ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {_onPassportTextChanged(value)}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); @@ -114,7 +285,7 @@ class _PassportUpdatePageState extends State { GifLoaderDialogUtils.hideDialog(context); print(res['Covid19_Certificate_GetPassportList'][0]['PassportNo']); passportNumber.text = res['Covid19_Certificate_GetPassportList'][0]['PassportNo']; - if(res['Covid19_Certificate_GetPassportList'][0]['PassportNo'] != "") { + if (res['Covid19_Certificate_GetPassportList'][0]['PassportNo'] != "") { _isButtonDisabled = false; } }).catchError((err) { diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart deleted file mode 100644 index 6f46388b..00000000 --- a/lib/pages/medical/medical_profile_page.dart +++ /dev/null @@ -1,173 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class MedicalProfilePage extends StatefulWidget { - @override - _MedicalProfilePageState createState() => _MedicalProfilePageState(); -} - -class _MedicalProfilePageState extends State { - var authProvider = new AuthProvider(); - List medical = List(); - ProjectViewModel projectViewModel; - - @override - Widget build(BuildContext context) { - projectViewModel = Provider.of(context); - var appoCountProvider = Provider.of(context); - List myMedicalList = Utils.myMedicalList( - projectViewModel: projectViewModel, - context: context, - count: appoCountProvider.count, - isLogin: projectViewModel.isLogin); - return BaseView( - onModelReady: (model) => model.getAppointmentHistory(), - builder: (_, model, widget) => AppScaffold( - isShowDecPage: false, - baseViewModel: model, - isHelp: true, - body: Container( - child: SingleChildScrollView( - child: Column( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - width: double.infinity, - height: 210, - child: Stack( - children: [ - Image.asset( - 'assets/images/timeline_bg.png', - fit: BoxFit.cover, - width: double.infinity, - // color: Colors.black.withOpacity(0.0) - ), - if (model.isLogin) - ListView.builder( - itemBuilder: (context, index) => - TimeLineWidget( - isUp: index % 2 == 1, - appoitmentAllHistoryResul: model - .appoitmentAllHistoryResultList[index], - ), - itemCount: model - .appoitmentAllHistoryResultList.length, - scrollDirection: Axis.horizontal, - reverse: projectViewModel.isArabic, - ), - ], - ), - ), - SizedBox( - height: 50, - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 5.0), - child: GridView.builder( - shrinkWrap: true, - primary: false, - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - childAspectRatio: MediaQuery.of(context) - .size - .width / - (MediaQuery.of(context).size.height / 2.20), - ), - itemCount: myMedicalList.length, - itemBuilder: (BuildContext context, int index) { - return myMedicalList[index]; - }, - ), - ) - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ), - if (model.user != null && model.isLogin) - Positioned( - top: 185, - left: 20, - right: 20, - child: Container( - width: double.infinity, - height: 80, - decoration: BoxDecoration( - color: Colors.grey[500], - shape: BoxShape.rectangle, - border: Border.all( - color: Colors.transparent, width: 0.5), - borderRadius: - BorderRadius.all(Radius.circular(9)), - image: DecorationImage( - image: ExactAssetImage( - 'assets/images/bg_graphic.png'), - fit: BoxFit.cover)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 8, - ), - Texts( - model.user.firstName + - " " + - model.user.lastName, - color: Colors.white, - bold: true, - ), - Texts( - '${model.user.patientID}', - color: Colors.white, - ), - ], - ), - ), - ), - Positioned( - top: 2, - left: projectViewModel.isArabic ? 0 : 10, - right: projectViewModel.isArabic ? 10 : 0, - child: Texts( - TranslationBase.of(context).timeLine, - color: Colors.white, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ) - ], - ), - ], - ), - ), - ), - ), - ); - } -} - -class Medical { - final String title; - final String imagePath; - final String subTitle; - final Widget page; - - Medical({this.title, this.imagePath, this.subTitle, this.page}); -} diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart new file mode 100644 index 00000000..d128f460 --- /dev/null +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -0,0 +1,139 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_new_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class MedicalProfilePageNew extends StatefulWidget { + Function onTap; + String a; + MedicalProfilePageNew({this.onTap}); + @override + _MedicalProfilePageState createState() => _MedicalProfilePageState(); +} + +class _MedicalProfilePageState extends State { + var authProvider = new AuthProvider(); + List medical = List(); + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + var appoCountProvider = Provider.of(context); + List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); + print(myMedicalList); + return BaseView( + onModelReady: (model) => model.getAppointmentHistory(), + builder: (_, model, widget1) => AppScaffold( + isShowDecPage: false, + isShowAppBar: false, + baseViewModel: model, + showNewAppBar: true, + isHelp: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).medicalFileTitle, + onTap: widget.onTap, + body: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Container( + // width: double.infinity, + // height: 210, + // decoration: containerBottomRightRadiusWithGradientBorder(0, darkColor: Color(0xFFF2B353E), lightColor: Color(0xFFF2B353E)), + // child: Stack( + // children: [ + // if (model.isLogin) + // ListView.builder( + // itemBuilder: (context, index) => TimeLineWidget( + // isUp: index % 2 == 1, + // appoitmentAllHistoryResul: model.appoitmentAllHistoryResultList[index], + // ), + // itemCount: model.appoitmentAllHistoryResultList.length, + // scrollDirection: Axis.horizontal, + // reverse: projectViewModel.isArabic, + // ), + // ], + // ), + // ), + TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), + SizedBox( + height: 20, + ), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + projectViewModel.isLogin + ? Text( + projectViewModel?.user?.firstName ?? "", + style: TextStyle(color: Colors.black, fontSize: SizeConfig.textMultiplier * 1.8), + ) + : Container(), + Text( + TranslationBase.of(context).medicalFileTitle, + style: TextStyle( + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + SizedBox( + height: 20, + ), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + // gridDelegate: + // SliverGridDelegateWithFixedCrossAxisCount( + // crossAxisCount: 3, + // childAspectRatio: MediaQuery.of(context) + // .size + // .width / + // (MediaQuery.of(context).size.height / 2.20), + // ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; + }, + ), + ), + SizedBox( + height: 12, + ), + ], + ), + ), + ), + ), + ); + } +} + +class Medical { + final String title; + final String imagePath; + final String subTitle; + final Widget page; + + Medical({this.title, this.imagePath, this.subTitle, this.page}); +} diff --git a/lib/pages/medical/my_admissions_page.dart b/lib/pages/medical/my_admissions_page.dart index ff25884e..956395c4 100644 --- a/lib/pages/medical/my_admissions_page.dart +++ b/lib/pages/medical/my_admissions_page.dart @@ -21,18 +21,18 @@ class _MyAdmissionsPageState extends State { children: [ DoctorCard( name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date:DateTime.now(),// 'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', - rat: 3.8, + rating: 3.8, subName: 'Jammal', ), DoctorCard( name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date: DateTime.now(),//'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', - rat: 3.8, + rating: 3.8, subName: 'Jammal', ), ], @@ -46,10 +46,10 @@ class _MyAdmissionsPageState extends State { //TODO when we need it }, name: 'Dr Mohammad Aljammal', - date: 'Feb 14, 2020', + date: DateTime.now(),//'Feb 14, 2020', profileUrl: 'https://scontent.famm4-1.fna.fbcdn.net/v/t31.0-8/30425660_1862582094040824_7851633779570222226_o.jpg?_nc_cat=101&_nc_sid=09cbfe&_nc_eui2=AeF3TI6D2_tFS5QoQsqyaCKd2zBfzh74hOzbMF_OHviE7PQdLHRwmBoIOiKyWmK9MskOshPjkU73a5EdQMA3dqnV&_nc_ohc=1feou2fDCuIAX_Ra9qB&_nc_ht=scontent.famm4-1.fna&oh=709d34d1c284de1d0aa08ed37b0ac09a&oe=5F3C5ACB', - rat: 4.8, + rating: 4.8, subName: 'Jammal', ), ), diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 3d62a661..55a91b9a 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -2,338 +2,305 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/MyInvoices/DentalInvoiceDetailResponse.dart'; import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart'; -import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_services.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class InvoiceDetail extends StatelessWidget { +class InvoiceDetail extends StatefulWidget { final DoctorList doctor; final ListDentalAppointments listDentalAppointments; final DentalInvoiceDetailResponse dentalInvoiceDetailResponse; final BuildContext context; - int totalServiceRate = 0; - int totalDiscount = 0; - int totalVAT = 0; - int subTotal = 0; - int grandTotal = 0; + InvoiceDetail(this.doctor, this.listDentalAppointments, this.dentalInvoiceDetailResponse, this.context); - InvoiceDetail(this.doctor, this.listDentalAppointments, - this.dentalInvoiceDetailResponse, this.context); + @override + _InvoiceDetailState createState() => _InvoiceDetailState(); +} + +class _InvoiceDetailState extends State { + dynamic totalServiceRate = 0; + + dynamic totalDiscount = 0; + + dynamic totalVAT = 0; + + dynamic subTotal = 0; + + dynamic grandTotal = 0; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + generateInvoiceDetails(); return AppScaffold( - appBarTitle: TranslationBase.of(context).myInvoice, - isShowAppBar: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Container( - child: Column( - children: [ - DoctorView( - doctor: doctor, - isLiveCareAppointment: false, - isShowFlag: false), - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - padding: EdgeInsets.only( - top: 10.0, left: 10.0, right: 10.0, bottom: 10.0), - decoration: BoxDecoration( - color: Colors.grey[800], - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), + appBarTitle: widget.doctor.doctorTitle != null ? widget.doctor.doctorTitle.toString() : TranslationBase.of(context).dr + " " + widget.doctor.name.toString(), + isShowAppBar: true, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + child: Container( + child: Column( + children: [ + // DoctorView(doctor: doctor, isLiveCareAppointment: false, isShowFlag: false), + DoctorHeader( + headerModel: HeaderModel( + widget.doctor.name, + widget.doctor.doctorID, + widget.doctor.doctorImageURL, + widget.doctor.speciality, + widget.doctor.clinicName, + widget.doctor.projectName, + DateUtil.convertStringToDate(widget.doctor.date), + null, + widget.doctor.nationalityFlagURL, + widget.doctor.doctorRate, + widget.doctor.actualDoctorRate, + widget.doctor.noOfPatientsRate ?? 0, + projectViewModel.user.emailAddress, + decimalDoctorRate: widget.doctor.decimalDoctorRate.toString()), + onTap: () { + sendInvoiceEmail(); + }, ), - child: Table( - children: [ - TableRow(children: [ - Text("Description", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold)), - Text("Quantity", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold)), - Text("Price", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold)), - Text("Total", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold)), - ]), - ], + Container( + child: Container( + + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Table( + columnWidths: { + 0: FlexColumnWidth(2.0), + 1: FlexColumnWidth(1.5), + 2: FlexColumnWidth(1.5), + 3: FlexColumnWidth(1.5), + }, + children: fullData(context), + ), + ], + ), + ), + ), ), - ), - Container( - margin: EdgeInsets.only(top: 0.0, left: 10.0, right: 10.0), - padding: EdgeInsets.only( - top: 10.0, left: 10.0, right: 10.0, bottom: 15.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(8), - bottomRight: Radius.circular(8), - )), - child: Table(children: fullData(context)), - ), - Container( - margin: EdgeInsets.only(top: 3.0, left: 12.0, right: 12.0), - child: Divider( - color: Colors.grey[400], - thickness: 0.7, + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(TranslationBase.of(context).cardDetail, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + MyRichText( + TranslationBase.of(context).insuranceCompany + ": ", + projectViewModel.isArabic + ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].groupNameN + : widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].companyName, + projectViewModel.isArabic), + MyRichText( + TranslationBase.of(context).insuranceID + ": ", + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID != null ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID : "N/A", + projectViewModel.isArabic), + ], + ), + ), + ), ), - ), - Container( - child: AppExpandableNotifier( - title: "Total Price: " + grandTotal.toString() + " SAR", - isExpand: true, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Table( + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Discount: ", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(totalDiscount.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - ]), - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - "VAT (" + - dentalInvoiceDetailResponse - .listEInvoiceForDental[0] - .listConsultation[0] - .vATPercentage - .toString() + - "%)", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(totalVAT.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - ]), - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Total: ", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(TranslationBase.of(context).totalBalance, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).discount), + ), + Expanded( + child: _getNormalText(this.totalDiscount.toString() + " " + TranslationBase.of(context).sar, isBold: true), + ) + ], ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(grandTotal.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), + ), + mDivider( Color(0xffEFEFEF),), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).totalVAT.toString() + + " (" + + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + + "%): "), + ), + Expanded( + child: _getNormalText(num.tryParse(this.totalVAT.toString()).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), + ) + ], ), - ]), - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Paid: ", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), + ), + mDivider( Color(0xffEFEFEF),), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).total), + ), + Expanded( + child: _getNormalText(this.subTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), + ) + ], ), - Container( - margin: - EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Text(grandTotal.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), + ), + mDivider( Color(0xffEFEFEF),), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, bottom: 5), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).paid), + ), + Expanded( + child: _getNormalText(this.grandTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), + ) + ], ), - ]), + ), ], ), - ]), - ), - ), - Container( - margin: EdgeInsets.only(top: 3.0, left: 12.0, right: 12.0), - child: Divider( - color: Colors.grey[400], - thickness: 0.7, + ), + )), + SizedBox( + height: 100.0, ), - ), - Container( - margin: EdgeInsets.only(top: 0.0, left: 10.0, right: 10.0), - padding: EdgeInsets.only( - top: 10.0, left: 10.0, right: 10.0, bottom: 15.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Table(children: [ - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Insurance: ", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 5.0), - child: Text( - dentalInvoiceDetailResponse - .listEInvoiceForDental[0].companyName, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - ]), - TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Insurance ID: ", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Text( - dentalInvoiceDetailResponse - .listEInvoiceForDental[0].insuranceID, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold)), - ), - ]), - ]), - ), - SizedBox( - height: 100.0, - ), - ], + ], + ), ), - ), - ), - bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () { - sendInvoiceEmail(); - }, - label: TranslationBase.of(context).sendEmail, - backgroundColor: Colors.red[900], - ), - ), - ); + )); + } + + void generateInvoiceDetails() { + totalServiceRate = 0; + totalDiscount = 0; + totalVAT = 0; + subTotal = 0; + grandTotal = 0; + + List listConsultations = new List(); + + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.forEach((item) { + var i = listConsultations.indexWhere((x) => x.procedureID == item.procedureID); + if (i <= -1) { + listConsultations.add(item); + } + }); + + listConsultations.forEach((element) { + print(element.procedureID); + this.totalServiceRate += element.total; + this.totalDiscount += element.discountAmount; + this.totalVAT += element.totalVATAmount; + }); + + this.subTotal = this.totalServiceRate - this.totalDiscount; + this.grandTotal = this.subTotal + this.totalVAT; } sendInvoiceEmail() { - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(widget.context); MyInvoicesService myInvoicesService = new MyInvoicesService(); - myInvoicesService - .sendDentalAppointmentInvoiceEmail( - 12, listDentalAppointments.appointmentNo, context) - .then((res) { - GifLoaderDialogUtils.hideDialog(context); + myInvoicesService.sendDentalAppointmentInvoiceEmail(widget.listDentalAppointments.projectID, widget.listDentalAppointments.appointmentNo, widget.context).then((res) { + GifLoaderDialogUtils.hideDialog(widget.context); if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast( - message: TranslationBase.of(context).emailSentSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(widget.context).emailSentSuccessfully); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(widget.context); print(err); AppToast.showErrorToast(message: err); - Navigator.of(context).pop(); + Navigator.of(widget.context).pop(); }); } List fullData(context) { List tableRow = []; - dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation - .forEach((lab) { + + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).description), + Utils.tableColumnTitle(TranslationBase.of(context).quantity), + Utils.tableColumnTitle(TranslationBase.of(context).price), + Utils.tableColumnTitle(TranslationBase.of(context).total), + ], + ), + ); + for (int i = 0; i < widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length; i++) { tableRow.add( TableRow(children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(lab.procedureName, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, fontWeight: FontWeight.w400)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(lab.quantity.toString(), - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, fontWeight: FontWeight.w400)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(lab.price.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, fontWeight: FontWeight.w400)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(lab.total.toString() + " SAR", - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, fontWeight: FontWeight.w400)), - ), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].procedureName}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].quantity}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].price.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].total.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), ]), ); - }); + } return tableRow; } + + _getNormalText(text, {bool isBold = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold ? 14 : 12, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, + ), + ); + } } diff --git a/lib/pages/medical/my_invoices/my_invoice_page.dart b/lib/pages/medical/my_invoices/my_invoice_page.dart index b49879bc..820bf355 100644 --- a/lib/pages/medical/my_invoices/my_invoice_page.dart +++ b/lib/pages/medical/my_invoices/my_invoice_page.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart' - as DoctorListResponse; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart' as DoctorListResponse; import 'package:diplomaticquarterapp/models/MyInvoices/DentalInvoiceDetailResponse.dart'; import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart'; import 'package:diplomaticquarterapp/pages/medical/my_invoices/invoice_detail_page.dart'; @@ -10,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -30,11 +30,11 @@ class _MyInvoicesState extends State { @override void initState() { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-invoice/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-invoice/ar/0.png')); + imagesInfo + .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-invoice/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-invoice/ar/0.png')); WidgetsBinding.instance.addPostFrameCallback((_) { - if(projectViewModel.isLogin) - getDentalAppointments(); + if (projectViewModel.isLogin) getDentalAppointments(); }); super.initState(); } @@ -46,6 +46,8 @@ class _MyInvoicesState extends State { appBarTitle: TranslationBase.of(context).myInvoice, isShowAppBar: true, isShowDecPage: true, + showNewAppBar: true, + showNewAppBarTitle: true, imagesInfo: imagesInfo, body: Container( child: SingleChildScrollView( @@ -53,140 +55,25 @@ class _MyInvoicesState extends State { child: isDataLoaded ? Column( children: [ - ...List.generate( - getDentalAppointmentsResponse - .listDentalAppointments.length, - (index) => InkWell( - onTap: () { - openInvoiceDetailsPage(getDentalAppointmentsResponse - .listDentalAppointments[index]); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.all(Radius.circular(8.0)), - ), - margin: EdgeInsets.all(10.0), - width: MediaQuery.of(context).size.width, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: Container( - margin: EdgeInsets.fromLTRB( - 20.0, 10.0, 20.0, 10.0), - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.asset( - "assets/images/new-design/ViewDetailsIco.png", - fit: BoxFit.fill, - height: 60.0, - width: 60.0), - ), - ), - ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Appointment No: ", - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - letterSpacing: 0.5)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Appointment Date: ", - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - letterSpacing: 0.5)), - ), - Container( - margin: EdgeInsets.only( - top: 10.0, bottom: 10.0), - child: Text("Clinic: ", - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - letterSpacing: 0.5)), - ), - ], - ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - getDentalAppointmentsResponse - .listDentalAppointments[index] - .appointmentNo - .toString(), - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 0.5)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - getDentalAppointmentsResponse - .listDentalAppointments[ - index] - .appointmentDate)), - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 0.5)), - ), - Container( - margin: EdgeInsets.only( - top: 10.0, bottom: 10.0), - child: Text( - getDentalAppointmentsResponse - .listDentalAppointments[index] - .clinicName, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 0.5)), - ), - ], - ), - projectViewModel.isArabic - ? Container( - margin: EdgeInsets.only(left: 15.0), - child: Image.asset( - "assets/images/new-design/arrow_menu_black-ar.png", - fit: BoxFit.fill, - height: 20.0, - width: 12.0), - ) - : Container( - margin: EdgeInsets.only(right: 15.0), - child: Image.asset( - "assets/images/new-design/arrow_menu_black-en.png", - fit: BoxFit.fill, - height: 20.0, - width: 12.0), - ), - ], - ), - ), - ), + ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, index) { + return DoctorCard( + onTap: () => openInvoiceDetailsPage(getDentalAppointmentsResponse.listDentalAppointments[index]), + isInOutPatient: true, + name: TranslationBase.of(context).dr.toString() + " " + (projectViewModel.isArabic ? getDentalAppointmentsResponse.listDentalAppointments[index].doctorNameN.toString() : getDentalAppointmentsResponse.listDentalAppointments[index].doctorName.toString()), + billNo: getDentalAppointmentsResponse.listDentalAppointments[index].invoiceNo.toString(), + profileUrl: getDentalAppointmentsResponse.listDentalAppointments[index].doctorImageURL, + subName: getDentalAppointmentsResponse.listDentalAppointments[index].projectName, + isLiveCareAppointment: false, + date: DateUtil.convertStringToDate(getDentalAppointmentsResponse.listDentalAppointments[index].appointmentDate), + isSortByClinic: true, + ); + }, + itemCount: getDentalAppointmentsResponse.listDentalAppointments.length, + separatorBuilder: (context, index) => SizedBox(height: 14), ), ], ) @@ -201,31 +88,26 @@ class _MyInvoicesState extends State { DoctorListResponse.DoctorList doctor = new DoctorListResponse.DoctorList(); - doctor.name = listDentalAppointments.doctorName; + doctor.name = projectViewModel.isArabic ? listDentalAppointments.doctorNameN : listDentalAppointments.doctorName; doctor.projectName = listDentalAppointments.projectName; doctor.date = listDentalAppointments.appointmentDate; doctor.actualDoctorRate = 0; doctor.doctorImageURL = listDentalAppointments.doctorImageURL; + doctor.projectID = listDentalAppointments.projectID; doctor.dayName = listDentalAppointments.invoiceNo; - doctor.doctorTitle = "Dr."; - doctor.clinicName = "InvoiceNo: " + listDentalAppointments.invoiceNo.toString(); + doctor.clinicName = listDentalAppointments.invoiceNo.toString(); + doctor.date = listDentalAppointments.appointmentDate; + doctor.noOfPatientsRate = listDentalAppointments.patientNumber; + doctor.actualDoctorRate = listDentalAppointments.doctorRate; + doctor.decimalDoctorRate = listDentalAppointments.decimalDoctorRate; + doctor.doctorID = listDentalAppointments.doctorID; - myInvoicesService.getDentalAppointmentInvoice(12, listDentalAppointments.appointmentNo, context).then((res) { + myInvoicesService.getDentalAppointmentInvoice(listDentalAppointments.projectID, listDentalAppointments.appointmentNo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { - dentalInvoiceDetailResponse = - DentalInvoiceDetailResponse.fromJson(res); - print(dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length); - Navigator.push( - context, - FadePage( - page: InvoiceDetail( - doctor, - listDentalAppointments, - dentalInvoiceDetailResponse, - context - ))); + dentalInvoiceDetailResponse = DentalInvoiceDetailResponse.fromJson(res); + Navigator.push(context, FadePage(page: InvoiceDetail(doctor, listDentalAppointments, dentalInvoiceDetailResponse, context))); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -235,7 +117,6 @@ class _MyInvoicesState extends State { GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err.toString()); - Navigator.of(context).pop(); }); } @@ -247,8 +128,7 @@ class _MyInvoicesState extends State { GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['MessageStatus'] == 1) { - getDentalAppointmentsResponse = - GetDentalAppointmentsResponse.fromJson(res); + getDentalAppointmentsResponse = GetDentalAppointmentsResponse.fromJson(res); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 9c588f73..5ef8c69c 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -6,10 +6,12 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; + import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -25,16 +27,7 @@ class AddWeightPage extends StatefulWidget { final String measureTimeSelectedType; final int weightUnit; - AddWeightPage( - {Key key, - this.model, - this.isUpdate = false, - this.dayWeightDate, - this.lineItemNo, - this.weightValue, - this.measureTimeSelectedType, - this.weightUnit}) - : super(key: key); + AddWeightPage({Key key, this.model, this.isUpdate = false, this.dayWeightDate, this.lineItemNo, this.weightValue, this.measureTimeSelectedType, this.weightUnit}) : super(key: key); @override _AddWeightPageState createState() => _AddWeightPageState(); @@ -44,14 +37,17 @@ class _AddWeightPageState extends State { TextEditingController _weightValueController = TextEditingController(); DateTime dayWeightDate = DateTime.now(); DateTime timeWeightDate = DateTime.now(); - int weightUnit = 1; + int weightUnit = 0; final List measureUnitEnList = [ - 'Kg', 'Pound', + 'Kg', + ]; + final List measureUnitArList = [ + "باوند", + "كيلو جرام", ]; - final List measureUnitArList = ["كيلو جرام", "باوند"]; String measureTimeSelectedType; - bool isButtonDisabled = false; + bool isButtonDisabled = true; @override void initState() { @@ -60,10 +56,7 @@ class _AddWeightPageState extends State { dayWeightDate = widget.dayWeightDate; timeWeightDate = widget.dayWeightDate; measureTimeSelectedType = widget.measureTimeSelectedType; - if (measureUnitEnList.contains(widget.measureTimeSelectedType)) - weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); - else if (measureUnitArList.contains(widget.measureTimeSelectedType)) - weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); + weightUnit = widget.weightUnit; _weightValueController.text = widget.weightValue; validateForm(); } @@ -75,208 +68,206 @@ class _AddWeightPageState extends State { return AppScaffold( isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + showNewAppBar: true, + showNewAppBarTitle: true, + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + children: [ + NewTextFields( + hintText: TranslationBase.of(context).weightAdd, + controller: _weightValueController, + keyboardType: TextInputType.number, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox(height: 12), + InkWell( + onTap: () { + List list = [ + RadioSelectionDialogModel(projectViewModel.isArabic ? measureUnitArList[0] : measureUnitEnList[0], 0), + RadioSelectionDialogModel(projectViewModel.isArabic ? measureUnitArList[1] : measureUnitEnList[1], 1), + ]; - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .deleteWeightResult(lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).weightAdd, - controller: _weightValueController, - keyboardType: TextInputType.number, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureUnitArList - : measureUnitEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? - TranslationBase.of(context).other), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: weightUnit, + onValueSelected: (index) { + weightUnit = index; + measureTimeSelectedType = list[index].title; + setState(() {}); + validateForm(); + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - setState(() { - dayWeightDate = date; - }); - }, - currentTime: dayWeightDate, - locale: projectViewModel.localeType, - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + setState(() { + dayWeightDate = date; + }); + }, + currentTime: dayWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker( - context, - showTitleActions: true, - onConfirm: (date) { - setState(() { - timeWeightDate = date; - }); - }, - currentTime: timeWeightDate, - locale: projectViewModel.localeType, - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showTimePicker( + context, + showTitleActions: true, + onConfirm: (date) { + setState(() { + timeWeightDate = date; + }); + }, + currentTime: timeWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - ], + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).removeMeasure, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + widget.model.deleteWeightResult(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + ), + ); + return; + }) + ], + ), + ) + : Container() + ], + ), ), - ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: widget.model.state == ViewState.BusyLocal, - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () { - if (_weightValueController.text.isNotEmpty) { - if (widget.isUpdate) { - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .updateWeightResult( - weightDate: - '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', - weightMeasured: - _weightValueController.text.toString(), - weightUnit: weightUnit, - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.Error) - AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - }); - } else - widget.model - .addWeightResult( - weightDate: - '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', - weightMeasured: _weightValueController.text.toString(), - weightUnit: weightUnit, - ) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.Error) - AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - }); - } - }), - ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).save.toUpperCase(), + isButtonDisabled + ? null + : () async { + if (_weightValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + if (widget.isUpdate) { + widget.model + .updateWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', + weightMeasured: _weightValueController.text.toString(), + weightUnit: weightUnit, + lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } else + widget.model + .addWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', + weightMeasured: _weightValueController.text.toString(), + weightUnit: weightUnit, + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } + }, + disabledColor: Colors.grey, + ), + ) + ], ), ); } @@ -289,33 +280,14 @@ class _AddWeightPageState extends State { return " ${timeWeightDate.hour}:${timeWeightDate.minute}"; } - void confirmSelectMeasureTimeDialog(List list) { - showDialog( - context: context, - child: RadioStringDialog( - radioList: list, - title: TranslationBase.of(context).measureUnit, - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - weightUnit = list.indexOf(value); - validateForm(); - }); - }, - ), - ); - } - void validateForm() { - if (_weightValueController.text.length > 0 && - measureTimeSelectedType != null) { + if (_weightValueController.text.length > 0 && measureTimeSelectedType != null) { setState(() { - isButtonDisabled = true; + isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } } diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 41592110..6857b6cd 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -1,7 +1,8 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.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'; @@ -10,10 +11,12 @@ 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'; + import 'AddWeightPage.dart'; import 'WeightMonthlyPage.dart'; -import 'WeightYeaPage.dart'; import 'WeightWeeklyPage.dart'; +import 'WeightYeaPage.dart'; class WeightHomePage extends StatefulWidget { @override @@ -37,12 +40,16 @@ class _WeightHomePageState extends State with SingleTickerProvid @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeight(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).weight, + backgroundColor: CustomColors.appBackgroudGrey2Color, appBarIcons: [ IconButton( icon: Icon(Icons.email), @@ -74,56 +81,64 @@ class _WeightHomePageState extends State with SingleTickerProvid ), ], baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget( - tabController: _tabController, - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - WeightWeeklyPage( - model: model, - ), - WeightMonthlyPage( - model: model, - ), - WeightYearPage( - model: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddWeightPage( - model: model, - ))); - }, - child: Container( - width: 55, - height: 55, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context).primaryColor, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + WeightWeeklyPage( + model: model, + ), + WeightMonthlyPage( + model: model, + ), + WeightYearPage( + model: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: FloatingActionButton( + child: Icon( + Icons.add, + color: Colors.white, ), + backgroundColor: CustomColors.accentColor, + onPressed: () { + Navigator.push( + context, + FadePage( + page: AddWeightPage( + model: model, + ), + ), + ); + }, ), ), ); diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 5b391a62..ffe5e5a6 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -1,175 +1,112 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class WeightMonthlyPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightMonthlyPage({ + WeightMonthlyPage({ Key key, this.model, }) : super(key: key); + List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - isShowDecPage: false, - body: ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: MonthLineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weighMonthTimeSeriesData.isEmpty?[TimeSeriesSales3(0, 0.0)]:model.weighMonthTimeSeriesData, - indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); + return ListView( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weighMonthTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + // 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weighMonthTimeSeriesData.isEmpty? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) - ], - ), + ) + ], + ), + ), + mHeight(80), + ], ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.monthWeightMeasurementResult.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightMeasured}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -177,4 +114,10 @@ class WeightMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.monthWeightMeasurementResult, (obj) => DateUtil.getMonth(obj.weightDate.month) + ' ' + obj.weightDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 5895eee1..b97e118b 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -1,16 +1,16 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.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/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import 'AddWeightPage.dart'; @@ -18,131 +18,73 @@ import 'AddWeightPage.dart'; class WeightWeeklyPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightWeeklyPage({Key key, this.model}) : super(key: key); + WeightWeeklyPage({Key key, this.model}) : super(key: key); + + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - - return AppScaffold( - isShowDecPage: false, - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightWeekTimeSeriesData.isEmpty - ? [TimeSeriesSales2(DateTime.now(), 0.0)] - : model.weightWeekTimeSeriesData, - indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, - ), - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + if (projectViewModel == null) projectViewModel = Provider.of(context); + return ListView( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + horizontalInterval: 2, + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightWeekTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context, model), + ), + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightWeekTimeSeriesData.isEmpty? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ):Table( - border: TableBorder.symmetric( - inside: - BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) - ], - ), + ) + ], + ), + ), + mHeight(80), + ], ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -151,72 +93,48 @@ class WeightWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightMeasured}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddWeightPage( - isUpdate: true, - dayWeightDate: diabtec.weightDate, - measureTimeSelectedType: 'Kg', - weightValue: diabtec.weightMeasured.toString(), - lineItemNo: diabtec.lineItemNo, - weightUnit: int.parse(diabtec.unit), - model: model, + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddWeightPage( + isUpdate: true, + dayWeightDate: diabtec.weightDate, + measureTimeSelectedType: diabtec.unit == "1" ? 'Kg' : 'Pound', + weightValue: diabtec.weightMeasured.toString(), + lineItemNo: diabtec.lineItemNo, + weightUnit: int.parse(diabtec.unit), + model: model, + ), + ), + ).then((value) { + if (model.weekWeightMeasurementResult.isEmpty) { + model.weightWeekTimeSeriesData.clear(); + } + }); + }, + child: Container( + child: Icon( + Icons.edit, + color: Color(0xff575757), ), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), ); diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index ed50458e..b22da46f 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -1,175 +1,111 @@ -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart'; +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class WeightYearPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightYearPage({ + WeightYearPage({ Key key, this.model, }) : super(key: key); - + List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - isShowDecPage: false, - body: - ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 2.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightYearTimeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesData, - indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightYearTimeSeriesData.isEmpty? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) - ], - ), + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); + return ListView( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + horizontalInterval: 2.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData, + indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", + )), + + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start,children: [ Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightYearTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + ], + ), + )], + ), + ), + mHeight(80), + ], ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.yearWeightMeasurementResult.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.weightMeasured}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', + isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -177,4 +113,10 @@ class WeightYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.yearWeightMeasurementResult.reversed, (obj) => DateUtil.getMonth(obj.weightDate.month) + ' ' + obj.weightDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index 0c7fea59..a4c0b943 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -6,10 +6,10 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,19 +21,13 @@ class AddBloodPressurePage extends StatefulWidget { final String measureTimeSelectedType; final bool isUpdate; final int lineItemNo; + final int measuredArm; final String bloodSystolicValue; final String bloodDiastolicValue; final BloodPressureViewMode model; const AddBloodPressurePage( - {Key key, - this.bloodSugarDate, - this.measureTimeSelectedType, - this.isUpdate = false, - this.lineItemNo, - this.model, - this.bloodSystolicValue, - this.bloodDiastolicValue}) + {Key key, this.bloodSugarDate, this.measureTimeSelectedType, this.isUpdate = false, this.lineItemNo, this.measuredArm, this.model, this.bloodSystolicValue, this.bloodDiastolicValue}) : super(key: key); @override @@ -42,20 +36,13 @@ class AddBloodPressurePage extends StatefulWidget { class _AddBloodPressurePageState extends State { TextEditingController _bloodSystolicValueController = TextEditingController(); - TextEditingController _bloodDiastolicValueController = - TextEditingController(); + TextEditingController _bloodDiastolicValueController = TextEditingController(); DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); - int measuredArm = 1; - bool isButtonDisabled = false; - final List measureTimeEnList = [ - 'Left Arm ', - 'Right Arm', - ]; - final List measureTimeArList = [ - 'الذراع الأيسر', - 'الذراع الأيمن', - ]; + int measuredArm = 0; + bool isButtonDisabled = true; + final List measureTimeEnList = ['Left Arm', 'Right Arm']; + final List measureTimeArList = ['الذراع الأيسر', 'الذراع الأيمن']; String measureTimeSelectedType = 'Left Arm'; @override @@ -65,10 +52,9 @@ class _AddBloodPressurePageState extends State { bloodSugarDate = widget.bloodSugarDate; bloodSugarDate = widget.bloodSugarDate; measureTimeSelectedType = widget.measureTimeSelectedType; - if (measureTimeEnList.contains(widget.measureTimeSelectedType)) - measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType); - else if (measureTimeArList.contains(widget.measureTimeSelectedType)) - measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType); + measuredArm = widget.measuredArm; + if (measuredArm > 1) measuredArm = measuredArm - 1; + _bloodSystolicValueController.text = widget.bloodSystolicValue; _bloodDiastolicValueController.text = widget.bloodDiastolicValue; validateForm(); @@ -81,205 +67,186 @@ class _AddBloodPressurePageState extends State { return AppScaffold( isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + showNewAppBar: true, + showNewAppBarTitle: true, + body: Column( + children: [ + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + NewTextFields( + hintText: TranslationBase.of(context).systolicAdd, + controller: _bloodSystolicValueController, + keyboardType: TextInputType.number, + maxLength: 3, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox(height: 12), + NewTextFields( + hintText: TranslationBase.of(context).diastolicAdd, + controller: _bloodDiastolicValueController, + keyboardType: TextInputType.number, + maxLength: 3, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox(height: 12), + InkWell( + onTap: () { + List list = [ + RadioSelectionDialogModel(projectViewModel.isArabic ? measureTimeArList[0] : measureTimeEnList[0], 0), + RadioSelectionDialogModel(projectViewModel.isArabic ? measureTimeArList[1] : measureTimeEnList[1], 1), + ]; - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .deactivateDiabeticStatus( - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).systolicAdd, - controller: _bloodSystolicValueController, - keyboardType: TextInputType.number, - maxLength: 3, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - NewTextFields( - hintText: TranslationBase.of(context).diastolicAdd, - controller: _bloodDiastolicValueController, - keyboardType: TextInputType.number, - maxLength: 3, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeArList - : measureTimeEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: measuredArm, + onValueSelected: (index) { + measuredArm = index; + measureTimeSelectedType = list[index].title; + setState(() {}); + validateForm(); + }, + ), + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(projectViewModel.isArabic ? measureTimeArList[measuredArm] : measureTimeEnList[measuredArm]), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { - setState( - () { - bloodSugarDate = date; - }, - ); + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { + setState( + () { + bloodSugarDate = date; + }, + ); + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - setState( - () { - timeSugarDate = date; - }, - ); + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + setState( + () { + timeSugarDate = date; + }, + ); + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - ], + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).removeMeasure, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }) + ], + )) + : Container() + ], + ), ), - ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.10, - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - height: 50, - child: SecondaryButton( - loading: widget.model.state == ViewState.BusyLocal, - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () async { - if (_bloodSystolicValueController.text.isNotEmpty && - _bloodDiastolicValueController.text.isNotEmpty) { + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).save, + isButtonDisabled + ? null + : () async { + if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - widget.model .addORUpdateDiabtecResult( - isUpdate: widget.isUpdate, - bloodPressureDate: - '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - diastolicPressure: - _bloodDiastolicValueController.text.toString(), - systolicePressure: - _bloodSystolicValueController.text.toString(), - measuredArm: measuredArm, - ) + isUpdate: widget.isUpdate, + bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + diastolicPressure: _bloodDiastolicValueController.text.toString(), + systolicePressure: _bloodSystolicValueController.text.toString(), + measuredArm: (measuredArm), + lineItemNo: widget.lineItemNo) .then((value) { GifLoaderDialogUtils.hideDialog(context); if (widget.model.state == ViewState.BusyLocal) - AppToast.showErrorToast( - message: widget.model.error); + AppToast.showErrorToast(message: widget.model.error); else Navigator.pop(context); ; @@ -288,11 +255,11 @@ class _AddBloodPressurePageState extends State { AppToast.showErrorToast(message: widget.model.error); }); } - }), - ), - ], - ), - ), + }, + disabledColor: Colors.grey, + ), + ) + ], ), ); } @@ -305,36 +272,15 @@ class _AddBloodPressurePageState extends State { return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; } - void confirmSelectMeasureTimeDialog(List list) { - showDialog( - context: context, - child: RadioStringDialog( - radioList: list, - title: 'Select the Arm', - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - measuredArm = list.indexOf(value); - validateForm(); - }); - }, - ), - ); - } - void validateForm() { - print("_bloodSystolicValueController " + - _bloodSystolicValueController.text.length.toString()); - if (measureTimeSelectedType != 'Left Arm' && - _bloodSystolicValueController.text.length > 0 && - _bloodDiastolicValueController.text.length > 0) { + print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString()); + if (_bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) { setState(() { - isButtonDisabled = true; + isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } // if(measureTimeSelectedType == 'Left Arm'){ diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index 723871cb..7501e910 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -1,15 +1,18 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.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/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.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'; + import 'AddBloodPressurePage.dart'; import 'BloodPressureMonthly.dart'; import 'BloodPressureYeaPage.dart'; @@ -20,8 +23,7 @@ class BloodPressureHomePage extends StatefulWidget { _BloodPressureHomePageState createState() => _BloodPressureHomePageState(); } -class _BloodPressureHomePageState extends State - with SingleTickerProviderStateMixin { +class _BloodPressureHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -38,77 +40,116 @@ class _BloodPressureHomePageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getBloodPressure(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).bloodPressure, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, - appBarIcons: [IconButton( - icon: Icon(Icons.email), - color: Colors.white, - onPressed: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async{ - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if(model.state == ViewState.ErrorLocal){ - AppToast.showErrorToast(message: model.error); - }else{ - AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); - } - }).catchError((e){ - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ); - }, - ),], - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget(tabController: _tabController,), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - BloodPressureWeeklyPage( - model: model, - ), - BloodPressureMonthlyPage( - model: model, - ), - BloodPressureYearPage( - model: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: AddBloodPressurePage(model: model,))); - }, - child: Container( - width: 55, - height: 55, - decoration: BoxDecoration( - shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + BloodPressureWeeklyPage( + model: model, + ), + BloodPressureMonthlyPage( + model: model, + ), + BloodPressureYearPage( + model: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: Stack(children: [ + Positioned( + bottom: 60, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + ))).then((value) { + model.getBloodPressure(); + }); + }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + )), + )) + ]), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + // label: TranslationBase.of(context).sendEmail, + // backgroundColor: Colors.red[900], ), ), ), diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 6d4f02d8..8dd26f41 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -1,183 +1,106 @@ +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class BloodPressureMonthlyPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); - + BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); + List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: MonthCurvedChartBloodPressure( - horizontalInterval: 20.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataTop, - timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: + MonthCurvedChartBloodPressure( + horizontalInterval: 20.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataTop, + timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataLow, + indexes: model.weighMonthTimeSeriesDataLow.length ~/ 5.5, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + ), + SizedBox( + height: 12, + ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Texts(TranslationBase.of(context).details), + // ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weighMonthTimeSeriesDataTop.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weighMonthTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context,projectViewModel,model), - ), - ], - ), - ) - ], - ), + ) + ], ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, BloodPressureViewMode model) { + List fullData(BuildContext context, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - 'Date', - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - 'Time', - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - 'Arm', - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - 'SBP/DBP', - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).arm), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.monthDiabtecPatientResult.reversed.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate):DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', - fontSize: 15, - textAlign: TextAlign.center, - ), - ), - height: 40, - ), - Container( - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - fontSize: 15, - ), - ), - height: 40), - Container( - color: Colors.white, - child: Center( - child: Texts( - diabtec.measuredArmDesc, - fontSize: 15, - ), - ), - height: 40), - Container( - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', - color: Colors.red, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -185,4 +108,10 @@ class BloodPressureMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.bloodPressureService.monthDiabtecPatientResult, (obj) => DateUtil.getMonth(obj.bloodPressureDate.month) + ' ' + obj.bloodPressureDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 68172354..893fc468 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -1,8 +1,11 @@ +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -13,196 +16,87 @@ import 'package:provider/provider.dart'; class BloodPressureYearPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureYearPage({Key key, this.model}) : super(key: key); + BloodPressureYearPage({Key key, this.model}) : super(key: key); + List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - body:ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: CurvedChartBloodPressure( - horizontalInterval: 3.0,// model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataTop, - timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: LineChartCurvedBloodPressure( + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataTop, + timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightYearTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightYearTimeSeriesDataTop.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), ), - ], - ), - ) - ], - ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], + ), + ) + ], ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodPressureViewMode bloodSugarViewMode) { + List fullData(BuildContext context, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).arm), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.yearDiabtecPatientResult.reversed.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.measuredArmDesc}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', - textAlign: TextAlign.center, - fontSize: 12, - color: Colors.red, - ), - ), - ), - ), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -210,4 +104,10 @@ class BloodPressureYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.bloodPressureService.yearDiabtecPatientResult.reversed, (obj) => DateUtil.getMonth(obj.bloodPressureDate.month) + ' ' + obj.bloodPressureDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index 1929d836..7686d03f 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -1,11 +1,11 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.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/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,147 +16,70 @@ import 'AddBloodPressurePage.dart'; class BloodPressureWeeklyPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureWeeklyPage({Key key, this.model}) : super(key: key); + BloodPressureWeeklyPage({Key key, this.model}) : super(key: key); + + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: CurvedChartBloodPressure( - horizontalInterval:3.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataTop, - timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, + if (projectViewModel == null) projectViewModel = Provider.of(context); + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 12.0), + padding: EdgeInsets.only(bottom: 12.0), + color: Colors.white, + child: LineChartCurvedBloodPressure( + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataTop, + timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + ), + SizedBox( + height: 12, + ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Texts(TranslationBase.of(context).details), + // ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.bloodPressureService.weekDiabtecPatientResult.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, model), + ), + SizedBox(height: 80) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightWeekTimeSeriesDataTop.isEmpty? Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) - ], - ), + ) + ], ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodPressureViewMode bloodSugarViewMode) { + List fullData(BuildContext context, BloodPressureViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -165,87 +88,54 @@ class BloodPressureWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.measuredArmDesc}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', - textAlign: TextAlign.center, - fontSize: 12, - color: Colors.red, - ), - ), - ), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodPressurePage( - model: model, - isUpdate: true, - lineItemNo: diabtec.lineItemNo, - bloodSugarDate: diabtec.bloodPressureDate, - bloodDiastolicValue: diabtec.diastolicPressure.toString(), - bloodSystolicValue: diabtec.systolicePressure.toString(), - measureTimeSelectedType: diabtec.measuredArmDesc, + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.bloodPressureDate.hour.toString() + ':' + diabtec.bloodPressureDate.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.measuredArmDesc}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + isUpdate: true, + lineItemNo: diabtec.lineItemNo, + bloodSugarDate: diabtec.bloodPressureDate, + bloodDiastolicValue: diabtec.diastolicPressure.toString(), + bloodSystolicValue: diabtec.systolicePressure.toString(), + measureTimeSelectedType: diabtec.measuredArmDesc, + measuredArm: diabtec.measuredArm, + ), + ), + ).then((value) { + model.getBloodPressure(); + if (model.weekDiabtecPatientResult.isEmpty) { + model.weightWeekTimeSeriesDataTop.clear(); + model.weightWeekTimeSeriesDataLow.clear(); + } + }); + }, + child: Container( + // height: 70, + // padding: EdgeInsets.all(10), + child: Icon( + Icons.edit, + color: Color(0xff575757), ), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 075e107e..8e47e4e8 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -6,10 +6,10 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,17 +23,11 @@ class AddBloodSugarPage extends StatefulWidget { final String measuredTime; final String bloodSugarValue; final int lineItemNo; + final String measuredSelectedType; final BloodSugarViewMode bloodSugarViewMode; AddBloodSugarPage( - {Key key, - this.bloodSugarDate, - this.measureUnitSelectedType, - this.isUpdate = false, - this.measuredTime, - this.bloodSugarValue, - this.lineItemNo, - this.bloodSugarViewMode}) + {Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode, this.measuredSelectedType}) : super(key: key); @override @@ -46,7 +40,9 @@ class _AddBloodSugarPageState extends State { DateTime timeSugarDate = DateTime.now(); String measureUnitSelectedType = 'mg/dlt'; int measuredTime = 1; - bool isButtonDisabled = false; + bool isButtonDisabled = true; + + int _selectedMeasureUnitIndex = 0; final List measureUnitList = ['mg/dlt', 'mol/L']; final List measureTimeEnList = [ 'Before Breakfast', @@ -63,7 +59,7 @@ class _AddBloodSugarPageState extends State { final List measureTimeArList = [ "قبل الإفطار", "بعد الإفطار", - "بعد الغداء", + "قبل الغداء", "بعد الغداء", "قبل العشاء", "بعد العشاء", @@ -72,6 +68,7 @@ class _AddBloodSugarPageState extends State { "صائم", "آخر", ]; + int _selectedMeasureTimeIndex; String measureTimeSelectedType; @override @@ -83,9 +80,9 @@ class _AddBloodSugarPageState extends State { measureUnitSelectedType = widget.measureUnitSelectedType; if (measureTimeEnList.contains(widget.measuredTime)) measuredTime = measureTimeEnList.indexOf(widget.measuredTime); - else if (measureTimeArList.contains(widget.measuredTime)) - measuredTime = measureTimeArList.indexOf(widget.measuredTime); + else if (measureTimeArList.contains(widget.measuredTime)) measuredTime = measureTimeArList.indexOf(widget.measuredTime); _bloodSugarValueController.text = widget.bloodSugarValue; + measureTimeSelectedType = widget.measuredSelectedType; validateForm(); } } @@ -95,243 +92,195 @@ class _AddBloodSugarPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - GifLoaderDialogUtils.showMyDialog(context); - widget.bloodSugarViewMode - .deactivateDiabeticStatus( - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == - ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).sugarAdd, - controller: _bloodSugarValueController, - keyboardType: TextInputType.number, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureUnitDialog(); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureUnitSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + children: [ + NewTextFields( + hintText: TranslationBase.of(context).sugarAdd, + controller: _bloodSugarValueController, + keyboardType: TextInputType.number, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { + SizedBox(height: 12), + InkWell( + onTap: () { + confirmSelectMeasureUnitDialog(); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureUnitSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), + ), + ), + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { setState(() { bloodSugarDate = date; }); - }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), + ), ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { setState(() { timeSugarDate = date; }); - }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), + ), ), - ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeArList - : measureTimeEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? - TranslationBase.of(context).other), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + SizedBox(height: 12), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), + ), ), - ), + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).removeMeasure, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + widget.bloodSugarViewMode.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + }); + }, + ), + ); + }, + ) + ], + ), + ) + : Container() + ], ), - ], + ), ), - ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.10, - child: Column( - children: [ - FractionallySizedBox( - widthFactor: 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () async { + DefaultButton( + TranslationBase.of(context).save, + isButtonDisabled + ? null + : () async { if (_bloodSugarValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); if (widget.isUpdate) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.bloodSugarViewMode - .updateDiabtecResult( + await widget.bloodSugarViewMode.updateDiabtecResult( month: bloodSugarDate, hour: timeSugarDate, diabtecUnit: measureUnitSelectedType, measuredTime: measuredTime, lineItemNo: widget.lineItemNo, - bloodSugerResult: - _bloodSugarValueController.text.toString()); - - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == - ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); + bloodSugerResult: _bloodSugarValueController.text.toString()); + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); } else { - GifLoaderDialogUtils.showMyDialog(context); - await widget.bloodSugarViewMode - .addDiabtecResult( + await widget.bloodSugarViewMode.addDiabtecResult( diabtecUnit: measureUnitSelectedType, measuredTime: measuredTime, - bloodSugerResult: - _bloodSugarValueController.text.toString(), - bloodSugerDateChart: - '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + bloodSugerResult: _bloodSugarValueController.text.toString(), + bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', ); - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.Error) - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); } - } - }), - ), - ], - ), + }, + disabledColor: Colors.grey, + ).insideContainer, + ], ), ); } @@ -345,33 +294,41 @@ class _AddBloodSugarPageState extends State { } void confirmSelectMeasureUnitDialog() { + List list = [ + RadioSelectionDialogModel("mg/dlt", 0), + RadioSelectionDialogModel("mol/L", 1), + ]; + showDialog( context: context, - child: RadioStringDialog( - radioList: measureUnitList, - title: TranslationBase.of(context).measureUnit, - selectedValue: measureUnitSelectedType, - onValueSelected: (value) { - setState(() { - measureUnitSelectedType = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedMeasureUnitIndex, + onValueSelected: (index) { + _selectedMeasureUnitIndex = index; + measureUnitSelectedType = list[index].title; + setState(() {}); }, ), ); } - void confirmSelectMeasureTimeDialog(List list) { + void confirmSelectMeasureTimeDialog(List dataList) { + List list = [ + for (int i = 0; i < dataList.length; i++) RadioSelectionDialogModel(dataList[i], i), + ]; + showDialog( context: context, - child: RadioStringDialog( - radioList: list, - title: TranslationBase.of(context).measureTime, - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - measuredTime = list.indexOf(value); - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedMeasureTimeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedMeasureTimeIndex = index; + measureTimeSelectedType = list[index].title; + measuredTime = index; + setState(() {}); }, ), ); @@ -380,11 +337,11 @@ class _AddBloodSugarPageState extends State { void validateForm() { if (_bloodSugarValueController.text.length > 0) { setState(() { - isButtonDisabled = true; + isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } } diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index f94053e3..4517e746 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -1,19 +1,16 @@ +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class BloodMonthlyPage extends StatelessWidget { @@ -21,16 +18,16 @@ class BloodMonthlyPage extends StatelessWidget { final List timeSeriesData; final BloodSugarViewMode bloodSugarViewMode; + BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); - const BloodMonthlyPage( - {Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) - : super(key: key); + List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); return AppScaffold( - // baseViewModel: bloodSugarViewMode, body: ListView( children: [ Container( @@ -39,9 +36,7 @@ class BloodMonthlyPage extends StatelessWidget { color: Colors.white, child: MonthLineChartCurved( title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty - ? [TimeSeriesSales3(0, 0.0)] - : timeSeriesData, + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : timeSeriesData, indexes: timeSeriesData.length ~/ 5.5, )), SizedBox( @@ -52,176 +47,59 @@ class BloodMonthlyPage extends StatelessWidget { child: Texts(TranslationBase.of(context).details), ), Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ timeSeriesData.isEmpty ? Container( child: Center( - child: Texts( - TranslationBase.of(context).noDataAvailable), + child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - : Table( - border: TableBorder.symmetric( - inside: - BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel), - ), - ], - ), - ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + ])) ], ), ); } - List fullData( - BuildContext context, ProjectViewModel projectViewModel) { + List fullData(BuildContext context, e) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - diabtecPatientResult.forEach( + e.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.dateChart.hour}:${diabtec.dateChart.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.measuredDesc}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.resultValue}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -229,4 +107,10 @@ class BloodMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(diabtecPatientResult, (obj) => DateUtil.getMonth(obj.dateChart.month) + ' ' + obj.dateChart.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 0b6bf607..52ef5f1a 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -1,17 +1,15 @@ +import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class BloodYearPage extends StatelessWidget { @@ -19,191 +17,93 @@ class BloodYearPage extends StatelessWidget { final List timeSeriesData; final BloodSugarViewMode bloodSugarViewMode; - const BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); + BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); + List yearlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - // baseViewModel: bloodSugarViewMode, - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - width: double.maxFinite, - color: Colors.white, - child: LineChartCurved( - title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, - indexes: timeSeriesData.length ~/ 5.5 ?? 0, - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - timeSeriesData.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - :Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel), + if (projectViewModel == null) projectViewModel = Provider.of(context); + + groupData(); + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + width: double.maxFinite, + color: Colors.white, + child: ShowChart( + title: TranslationBase.of(context).weight, + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 2, + ), + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + timeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), ), - ], - ), - ) - ], - ), + ) + : Column(children: [ + for (var monthly in yearlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], + ), + ) + ], ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel) { + List fullData(BuildContext context, yearlyGroup) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - diabtecPatientResult.forEach( + yearlyGroup.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.dateChart.hour}:${diabtec.dateChart.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.measuredDesc}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.resultValue}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -211,4 +111,10 @@ class BloodYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + yearlyGroup.clear(); + var groupedArray = groupBy(diabtecPatientResult.reversed, (obj) => DateUtil.getMonth(obj.dateChart.month) + ' ' + obj.dateChart.year.toString()); + groupedArray.entries.forEach((e) => yearlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index 29989e53..eeef1de5 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -1,20 +1,17 @@ -import 'dart:ui'; - import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.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/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.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:charts_flutter/flutter.dart' as charts; -import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; import 'AddBloodSugarPage.dart'; import 'BloodMonthly.dart'; @@ -26,8 +23,7 @@ class BloodSugarHomePage extends StatefulWidget { _BloodSugarHomePageState createState() => _BloodSugarHomePageState(); } -class _BloodSugarHomePageState extends State - with SingleTickerProviderStateMixin { +class _BloodSugarHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -44,83 +40,123 @@ class _BloodSugarHomePageState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getBloodSugar(), builder: (_, model, w) => AppScaffold( - appBarIcons: [IconButton( - icon: Icon(Icons.email), - color: Colors.white, - onPressed: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async{ - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if(model.state == ViewState.ErrorLocal){ - AppToast.showErrorToast(message: model.error); - }else{ - AppToast.showSuccessToast(message:TranslationBase.of(context).emailSentSuccessfully, ); - } - }).catchError((e){ - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, - ), - ); - }, - ),], - isShowAppBar: true, + showNewAppBar: true, + isShowDecPage: true, + showNewAppBarTitle: true, + baseViewModel: model, appBarTitle: TranslationBase.of(context).bloodSugar, // baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget(tabController: _tabController,), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - BloodSugarWeeklyPage( - timeSeriesData: model.bloodWeekTimeSeriesData, - diabtecPatientResult: model.weekDiabtecPatientResult, - bloodSugarViewMode: model, - ), - BloodMonthlyPage( - timeSeriesData: model.monthTimeSeriesData, - diabtecPatientResult: model.monthDiabtecPatientResult, bloodSugarViewMode: model, - ), - BloodYearPage( - timeSeriesData: model.yearTimeSeriesData, - diabtecPatientResult: model.yearDiabtecPatientResult, - bloodSugarViewMode: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: InkWell( - onTap: () { - Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,))); - }, - child: Container( - width: 55, - height: 55, - decoration: BoxDecoration( - shape: BoxShape.circle, color:Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + BloodSugarWeeklyPage( + timeSeriesData: model.bloodWeekTimeSeriesData, + diabtecPatientResult: model.weekDiabtecPatientResult, + bloodSugarViewMode: model, + ), + BloodMonthlyPage( + timeSeriesData: model.monthTimeSeriesData, + diabtecPatientResult: model.monthDiabtecPatientResult, + bloodSugarViewMode: model, + ), + BloodYearPage( + timeSeriesData: model.yearTimeSeriesData, + diabtecPatientResult: model.yearDiabtecPatientResult, + bloodSugarViewMode: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: Stack( + children: [ + Positioned( + bottom: 60, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + bloodSugarViewMode: model, + ))); + }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + )), ), ), + ], + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + ), ), ), ), diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart index 8bc6788c..965cc9ff 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart @@ -1,176 +1,92 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; -import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.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/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:charts_flutter/flutter.dart' as charts; import 'package:provider/provider.dart'; + import 'AddBloodSugarPage.dart'; class BloodSugarWeeklyPage extends StatelessWidget { final List diabtecPatientResult; final BloodSugarViewMode bloodSugarViewMode; final List timeSeriesData; + ProjectViewModel projectViewModel; - BloodSugarWeeklyPage( - {Key key, - this.diabtecPatientResult, - this.bloodSugarViewMode, - this.timeSeriesData}) - : super(key: key); + BloodSugarWeeklyPage({Key key, this.diabtecPatientResult, this.bloodSugarViewMode, this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + if (projectViewModel == null) projectViewModel = Provider.of(context); return AppScaffold( - // baseViewModel: bloodSugarViewMode, - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: LineChartCurved( - title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, - indexes: timeSeriesData.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - timeSeriesData.isEmpty - ? Container( + body: ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: ShowChart( + title: TranslationBase.of(context).weight, + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 2, + ), + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + timeSeriesData.isEmpty + ? Container( child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), + child: Texts(TranslationBase.of(AppGlobal.context).noDataAvailable), ), ) - :Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, bloodSugarViewMode), + : Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, bloodSugarViewMode), ), - ], - ), + SizedBox( + height: 80, ) ], ), + ) + ], + ), ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodSugarViewMode bloodSugarViewMode) { + List fullData(BuildContext context, BloodSugarViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - topRight: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(10.0) - : Radius.circular(0.0), - topRight: projectViewModel.isArabic - ? Radius.circular(0.0) - : Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -179,90 +95,52 @@ class BloodSugarWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart):DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.dateChart.hour}:${diabtec.dateChart.minute}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.measuredDesc}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.resultValue}', - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - ), - ), - Container( - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodSugarPage( - isUpdate: true, - bloodSugarDate: diabtec.dateChart, - measuredTime: diabtec.measuredDesc, - bloodSugarValue: diabtec.resultValue.toString(), - lineItemNo: diabtec.lineItemNo, - measureUnitSelectedType: diabtec.unit, - bloodSugarViewMode: bloodSugarViewMode, + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + isUpdate: true, + bloodSugarDate: diabtec.dateChart, + measuredTime: diabtec.measuredDesc, + bloodSugarValue: diabtec.resultValue.toString(), + lineItemNo: diabtec.lineItemNo, + measureUnitSelectedType: diabtec.unit, + bloodSugarViewMode: bloodSugarViewMode, + measuredSelectedType: diabtec.measuredDesc, + ), ), + ).then((value) { + if (bloodSugarViewMode.weekDiabtecPatientResult.isEmpty) { + timeSeriesData.clear(); + } + }); + }, + child: Container( + // height: 70, + // padding: EdgeInsets.all(10), + child: Icon( + Icons.edit, + color: Color(0xff575757), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), ); diff --git a/lib/pages/medical/my_trackers/my_trackers.dart b/lib/pages/medical/my_trackers/my_trackers.dart index b9450fd5..7f0ac95f 100644 --- a/lib/pages/medical/my_trackers/my_trackers.dart +++ b/lib/pages/medical/my_trackers/my_trackers.dart @@ -1,124 +1,76 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/Weight/WeightHomePage.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.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 'Weight/WeightHomePage.dart'; import 'blood_pressure/BloodPressureHomePage.dart'; -import 'blood_suger/blood_sugar_home_page.dart'; class MyTrackers extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).myTracker, - isShowAppBar: true, + showNewAppBar: true, isShowDecPage: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), description: TranslationBase.of(context).infoTrackers, imagesInfo: [ ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/ar/0.png') ], body: SingleChildScrollView( child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(21), + shrinkWrap: true, children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: BloodSugarHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/blood-suger.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).bloodSugar), - ], - ), - ), - ), - ), - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: BloodPressureHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/blood-pressure.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).bloodPressure), - ], - ), - ), - ), - ), - ], + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: BloodSugarHomePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).bloodSugar, + imagePath: 'assets/tracker/blood-suger.png', + subTitle: null, + isPngImage: true, + width: 45.0, + height: 45.0, + ), ), - Row( - //mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: WeightHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/weight.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).weight), - ], - ), - ), - ), - ), - Expanded( - child: Container(), - ), - ], + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: BloodPressureHomePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).bloodPressure, + imagePath: 'assets/tracker/blood-pressure.png', + subTitle: null, + isPngImage: true, + width: 45.0, + height: 45.0, + ), + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: WeightHomePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).weight, + imagePath: 'assets/tracker/weight.png', + subTitle: null, + isPngImage: true, + width: 45.0, + height: 45.0, + ), ), - ], - ), - ), + ])), ), ); } diff --git a/lib/pages/medical/my_trackers/widget/LineChartCurved.dart b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart index 2597f17c..47a5d490 100644 --- a/lib/pages/medical/my_trackers/widget/LineChartCurved.dart +++ b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart @@ -36,7 +36,7 @@ class LineChartCurved extends StatelessWidget { ), Text( title, - style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), + style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600), textAlign: TextAlign.center, ), SizedBox( @@ -44,7 +44,7 @@ class LineChartCurved extends StatelessWidget { ), Expanded( child: Padding( - padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15, bottom: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -80,6 +80,83 @@ class LineChartCurved extends StatelessWidget { } } } + + // LineChartData sampleData1(context) { + // return LineChartData( + // lineTouchData: LineTouchData( + // touchTooltipData: LineTouchTooltipData( + // tooltipBgColor: Colors.white, + // ), + // touchCallback: (LineTouchResponse touchResponse) {}, + // handleBuiltInTouches: true, + // ), + // gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), + // titlesData: FlTitlesData( + // bottomTitles: SideTitles( + // showTitles: true, + // getTextStyles: (value) => const TextStyle( + // color: Colors.black, + // fontSize: 10, + // ), + // // rotateAngle: 90, + // //rotateAngle:-65, + // margin: 22, + // getTitles: (value) { + // if (timeSeries.length < 15) { + // if (timeSeries.length > value.toInt()) { + // return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + // } else + // return ''; + // } else { + // if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + // if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + // if (xAxixs.contains(value.toInt())) { + // return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + // } + // } + // return ''; + // }, + // ), + // leftTitles: SideTitles( + // showTitles: true, + // // interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + // interval: 3, + // getTextStyles: (value) => const TextStyle( + // color: Colors.black, + // fontWeight: FontWeight.bold, + // fontSize: 10, + // ), + // + // margin: 12, + // ), + // ), + // borderData: FlBorderData( + // show: true, + // border: const Border( + // bottom: BorderSide( + // color: Colors.black, + // width: 0.5, + // ), + // left: BorderSide( + // color: Colors.black, + // ), + // right: BorderSide( + // color: Colors.black, + // ), + // top: BorderSide( + // color: Colors.transparent, + // ), + // ), + // ), + // minX: 0, + // maxX: (timeSeries.length - 1).toDouble(), + // maxY: getMaxY() + 0.3, + // minY: 0, + // //getMinY(), + // lineBarsData: getData(context), + // ); + // } + LineChartData sampleData1(context) { return LineChartData( lineTouchData: LineTouchData( @@ -89,8 +166,7 @@ class LineChartCurved extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - horizontalInterval: horizontalInterval, show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -98,8 +174,7 @@ class LineChartCurved extends StatelessWidget { color: Colors.black, fontSize: 10, ), - // rotateAngle: 90, - //rotateAngle:-65, + rotateAngle: -65, margin: 22, getTitles: (value) { if (timeSeries.length < 15) { @@ -108,10 +183,8 @@ class LineChartCurved extends StatelessWidget { } else return ''; } else { - if (value.toInt() == 0) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (value.toInt() == timeSeries.length - 1) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; if (xAxixs.contains(value.toInt())) { return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; } @@ -121,13 +194,21 @@ class LineChartCurved extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, getTextStyles: (value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, ), - + interval: 3.0, + // interval: getMaxY() - getMinY() <= 500 + // ? getMaxY() - getMinY() <= 50 + // ? 10 + // : 10 + // : getMaxY() - getMinY() <= 1000 + // ? 100 + // : getMaxY() - getMinY() >= 10000 + // ? 5000 + // : 200, margin: 12, ), ), @@ -149,14 +230,14 @@ class LineChartCurved extends StatelessWidget { ), ), ), - minX: 0, - maxX: (timeSeries.length - 1).toDouble(), - maxY: getMaxY() + 0.3, - minY: 0,//getMinY(), + minX: 0, + maxX: (timeSeries.length - 1).toDouble(), + maxY: getMaxY() + 0.3, + minY: 0, + //getMinY(), lineBarsData: getData(context), ); } - double getMaxY() { double max = 0; timeSeries.forEach((element) { @@ -180,9 +261,6 @@ class LineChartCurved extends StatelessWidget { List getData(context) { List spots = List(); - if (timeSeries.length == 0) { - spots.add(FlSpot(0, 0)); - } for (int index = 0; index < timeSeries.length; index++) { spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); } @@ -191,9 +269,8 @@ class LineChartCurved extends StatelessWidget { spots: spots, isCurved: true, colors: [secondaryColor], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, - curveSmoothness: 0.12, dotData: FlDotData( show: false, ), diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart index ee7e00af..bf3d9cb9 100644 --- a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -11,8 +12,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { final int indexes; final double horizontalInterval; - MonthCurvedChartBloodPressure( - {this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); + MonthCurvedChartBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); List xAxixs = List(); List yAxixs = List(); @@ -37,8 +37,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), Text( title, - style: TextStyle( - color: Colors.black, fontSize: 15, letterSpacing: 2), + style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), textAlign: TextAlign.center, ), SizedBox( @@ -46,8 +45,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -66,9 +64,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Theme.of(context).primaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor), ), SizedBox( width: 5, @@ -84,8 +80,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, color: Colors.grey), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: secondaryColor), ), SizedBox( width: 5, @@ -121,8 +116,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -132,12 +126,17 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), margin: 22, getTitles: (value) { - return ''; + return timeSeries1[value.toInt()].time; + // return ''; }, ), leftTitles: SideTitles( showTitles: true, - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + interval: getMaxY() - getMinY() <= 500 + ? 10 + : getMaxY() - getMinY() <= 1000 + ? 30 + : 40, getTextStyles: (value) => const TextStyle( color: Colors.black, @@ -226,7 +225,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { spots: spots, isCurved: true, colors: [Colors.red], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, @@ -239,7 +238,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { spots: spots2, isCurved: true, colors: [Theme.of(context).primaryColor], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, diff --git a/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart index 5ef71f5b..c1ef7f5a 100644 --- a/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart +++ b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart @@ -36,7 +36,7 @@ class MonthLineChartCurved extends StatelessWidget { ), Text( title, - style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), + style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600), textAlign: TextAlign.center, ), SizedBox( @@ -91,7 +91,12 @@ class MonthLineChartCurved extends StatelessWidget { handleBuiltInTouches: true, ), gridData: FlGridData( - horizontalInterval: horizontalInterval, show: true, drawVerticalLine: true, drawHorizontalLine: true), + horizontalInterval: 12, + show: true, + drawVerticalLine: true, + drawHorizontalLine: true, + verticalInterval: 12, + ), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -111,7 +116,11 @@ class MonthLineChartCurved extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 10, ), - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + interval: getMaxY() - getMinY() <= 500 + ? 50 + : getMaxY() - getMinY() <= 1000 + ? 100 + : 200, // getTitles: (value) { // if (value.toInt() == 0) @@ -184,7 +193,7 @@ class MonthLineChartCurved extends StatelessWidget { spots: spots, isCurved: true, colors: [secondaryColor], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, curveSmoothness: 0.0, dotData: FlDotData( diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index dcedc714..f9f8f7e2 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,9 +1,7 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -22,9 +20,8 @@ class _PatientSickLeavePageState extends State { @override void initState() { - imagesInfo.add(ImagesInfo( - imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/en/0.png', - imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/ar/0.png')); + imagesInfo.add( + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/sick-leaves/ar/0.png')); super.initState(); } @@ -38,24 +35,28 @@ class _PatientSickLeavePageState extends State { appBarTitle: TranslationBase.of(context).sickLeaves, description: TranslationBase.of(context).infoSickLeaves, infoList: TranslationBase.of(context).infoSickLeavePoints, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), imagesInfo: imagesInfo, baseViewModel: model, - body: Container( - margin: EdgeInsets.all(12), - child: ListView.builder( - itemCount: model.sickLeaveList.length, - itemBuilder: (context, index) => DoctorCard( - isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment, - name: model.sickLeaveList[index].doctorName, - date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].appointmentDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].appointmentDate), - profileUrl: model.sickLeaveList[index].doctorImageURL, - rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), - subName: model.sickLeaveList[index].projectName, - isInOutPatient: model.sickLeaveList[index].isInOutPatient, - onEmailTap: () { - showConfirmMessage(model, index); - }, - ), + body: ListView.separated( + physics: BouncingScrollPhysics(), + itemCount: model.sickLeaveList.length, + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) => DoctorCard( + isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment, + name: model.sickLeaveList[index].doctorName, + date: model.sickLeaveList[index].appointmentDate, + profileUrl: model.sickLeaveList[index].doctorImageURL, + rating: model.sickLeaveList[index].actualDoctorRate.toDouble(), + subName: model.sickLeaveList[index].clinicName, + isSortByClinic: false, + isInOutPatient: model.sickLeaveList[index].isInOutPatient, + onEmailTap: () { + showConfirmMessage(model, index); + }, ), ), ), diff --git a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart index 8f04d3a0..6574780d 100644 --- a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart +++ b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart @@ -7,9 +7,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.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/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; @@ -28,20 +31,13 @@ class PrescriptionDeliveryAddressPage extends StatefulWidget { final List prescriptionReportList; final List prescriptionReportEnhList; - const PrescriptionDeliveryAddressPage( - {Key key, - this.prescriptions, - this.prescriptionReportList, - this.prescriptionReportEnhList}) - : super(key: key); + const PrescriptionDeliveryAddressPage({Key key, this.prescriptions, this.prescriptionReportList, this.prescriptionReportEnhList}) : super(key: key); @override - _PrescriptionDeliveryAddressPageState createState() => - _PrescriptionDeliveryAddressPageState(); + _PrescriptionDeliveryAddressPageState createState() => _PrescriptionDeliveryAddressPageState(); } -class _PrescriptionDeliveryAddressPageState - extends State { +class _PrescriptionDeliveryAddressPageState extends State { AddressInfo _selectedAddress; Completer _controller = Completer(); @@ -79,218 +75,248 @@ class _PrescriptionDeliveryAddressPageState return BaseView( onModelReady: (model) => model.getCustomerInfo(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).shippingAddresss, - baseViewModel: model, - body: Container( - height: MediaQuery.of(context).size.height * 0.65, - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectLocationDialog(model.addressesList); - }, - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - getAddressName(), - ), - margin: EdgeInsets.only(left: 10, right: 10), + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).shippingAddresss, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12), + decoration: cardRadius(12), + child: Container( + child: InkWell( + onTap: () => confirmSelectLocationDialog(model.addressesList), + child: Container( + padding: EdgeInsets.all(8), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + getAddressName(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.45, + ), + ), + ), + Icon(Icons.arrow_drop_down) + ], ), ), ), - Icon( - Icons.arrow_drop_down, - size: 22, - color: Colors.grey, - ) - ], + height: 50, + width: double.infinity, + ), ), - ), - ), - SizedBox( - height: 10, - ), - _selectedAddress == null - ? Container( - child: Image.asset( - projectViewModel.isArabic - ? 'assets/images/pharmacy/shipping_image_ar.png' - : 'assets/images/pharmacy/shipping_image.png', - height: 300, - ), - ) - : Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey)), - height: 200, - child: GoogleMap( - mapType: MapType.normal, - markers: markers, - initialCameraPosition: _kGooglePlex, - onMapCreated: - (GoogleMapController controller) { - _controller.complete(controller); - }, + InkWell( + onTap: () async { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, + )), + ).then((value) { + if (value != null && value is AddNewAddressRequestModel) { + setState(() { + _selectedAddress = AddressInfo( + id: value.customer.id.toString(), + email: value.customer.email, + firstName: value.customer.addresses[0].firstName, + lastName: value.customer.addresses[0].lastName, + address1: value.customer.addresses[0].address1, + address2: value.customer.addresses[0].address2, + city: value.customer.addresses[0].city, + country: value.customer.addresses[0].country, + phoneNumber: value.customer.addresses[0].phoneNumber, + latLong: value.customer.addresses[0].latLong, + company: value.customer.addresses[0].company, + countryId: value.customer.addresses[0].countryId, + createdOnUtc: value.customer.addresses[0].createdOnUtc, + customerAttributes: value.customer.addresses[0].customerAttributes, + faxNumber: value.customer.addresses[0].faxNumber, + province: value.customer.addresses[0].province, + stateProvinceId: value.customer.addresses[0].stateProvinceId, + zipPostalCode: value.customer.addresses[0].zipPostalCode, + ); + List latLongArr = _selectedAddress.latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + markers = Set(); + markers.add( + Marker( + markerId: MarkerId( + _selectedAddress.latLong.hashCode.toString(), + ), + position: LatLng(latitude, longitude), ), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); + }); + } + }); + }, + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), + child: Row( + children: [ + Icon(Icons.add_circle_outline_sharp), + mWidth(12), + Text( + TranslationBase.of(context).addNewAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, ), ), - SizedBox( - height: 10, - ), - Texts( - TranslationBase.of(context).shippingAddresss), - SizedBox( - height: 10, - ), - Texts( - '${model.user.firstName} ${model.user.lastName}'), - SizedBox( - height: 10, - ), - Texts(_selectedAddress.address1), - SizedBox( - height: 10, - ), - Texts(_selectedAddress.address2), - SizedBox( - height: 10, - ), - Texts(_selectedAddress.city + - " " + - _selectedAddress.country), ], ), + ), + ), + if (_selectedAddress != null) + Container( + decoration: cardRadius(12), + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).selectAddress + ":", + fontSize: 12, + color: CustomColors.grey, + fontWeight: FontWeight.w600, + ), + mHeight(12), + Container( + height: 175, + 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=" + + _kGooglePlex.target.latitude.toString() + + "," + + _kGooglePlex.target.longitude.toString() + + "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + + _kGooglePlex.target.latitude.toString() + + "," + + _kGooglePlex.target.longitude.toString() + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).shippingAddresss + ":", + fontSize: 12, + color: CustomColors.grey, + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 2, + ), + Texts( + '${model.user.firstName} ${model.user.lastName}', + fontSize: 12, + fontWeight: FontWeight.w600, + ), + Texts( + _selectedAddress.address1, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + Texts( + _selectedAddress.address2, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + Texts( + _selectedAddress.city + " " + _selectedAddress.country, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + ], + ), + ), ) - ], + ], + ), + ), ), - ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.25, - color: Colors.grey[100], - child: Column( - children: [ - Divider(), - Container( - width: MediaQuery.of(context).size.width * 0.8, + Container( + decoration: cardRadius(0), + margin: EdgeInsets.zero, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(left: 16, right: 16, top: 16), child: Button( - label: - TranslationBase.of(context).addNewAddress.toUpperCase(), + label: TranslationBase.of(context).continues.toUpperCase(), + disabled: _selectedAddress == null, + backgroundColor: _selectedAddress == null ? CustomColors.grey2 : CustomColors.accentColor, onTap: () { Navigator.push( context, FadePage( - page: LocationPage( - latitude: latitude, - longitude: longitude, - )), - ).then((value) { - if (value != null && - value is AddNewAddressRequestModel) { - setState(() { - _selectedAddress = AddressInfo( - id: value.customer.id.toString(), - email: value.customer.email, - firstName: value.customer.addresses[0].firstName, - lastName: value.customer.addresses[0].lastName, - address1: value.customer.addresses[0].address1, - address2: value.customer.addresses[0].address2, - city: value.customer.addresses[0].city, - country: value.customer.addresses[0].country, - phoneNumber: value.customer.addresses[0].phoneNumber, - latLong: value.customer.addresses[0].latLong, - company: value.customer.addresses[0].company, - countryId: value.customer.addresses[0].countryId, - createdOnUtc: value.customer.addresses[0].createdOnUtc, - customerAttributes: value.customer.addresses[0].customerAttributes, - faxNumber: value.customer.addresses[0].faxNumber, - province: value.customer.addresses[0].province, - stateProvinceId: value.customer.addresses[0].stateProvinceId, - zipPostalCode: value.customer.addresses[0].zipPostalCode, - - ); - List latLongArr = _selectedAddress.latLong.split(','); - - latitude = double.parse(latLongArr[0]); - longitude = double.parse(latLongArr[1]); - markers = Set(); - markers.add( - Marker( - markerId: MarkerId( - _selectedAddress.latLong.hashCode.toString(), - ), - position: LatLng(latitude, longitude), - ), - ); - _kGooglePlex = CameraPosition( - target: LatLng(latitude, longitude), - zoom: 14.4746, - ); - }); - } - }); + page: PrescriptionOrderOverview( + latitude: latitude, + longitude: longitude, + prescriptionReportEnhList: widget.prescriptionReportEnhList, + prescriptionReportList: widget.prescriptionReportList, + prescriptions: widget.prescriptions, + selectedAddress: _selectedAddress, + ), + ), + ); }, ), ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: - TranslationBase.of(context).continues.toUpperCase(), - disabled: _selectedAddress == null, - backgroundColor: _selectedAddress == null - ? Colors.green[300] - : Colors.green[700], - onTap: () { - Navigator.push( - context, - FadePage( - page: PrescriptionOrderOverview( - latitude: latitude, - longitude: longitude, - prescriptionReportEnhList: - widget.prescriptionReportEnhList, - prescriptionReportList: - widget.prescriptionReportList, - prescriptions: widget.prescriptions, - selectedAddress: _selectedAddress, - ), - ), - ); - }, - )) - ], - ), - )), + ), + ], + ), + ), + ), ); } diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index bad43a02..719b2196 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -5,12 +5,14 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,11 +23,8 @@ class PrescriptionOrderOverview extends StatelessWidget { final AddressInfo selectedAddress; final double latitude; final double longitude; - PrescriptionOrderOverview( - {Key key, - this.prescriptions, - this.prescriptionReportList, - this.prescriptionReportEnhList, this.selectedAddress, this.latitude, this.longitude}); + + PrescriptionOrderOverview({Key key, this.prescriptions, this.prescriptionReportList, this.prescriptionReportEnhList, this.selectedAddress, this.latitude, this.longitude}); @override Widget build(BuildContext context) { @@ -34,148 +33,188 @@ class PrescriptionOrderOverview extends StatelessWidget { isShowAppBar: true, appBarTitle: TranslationBase.of(context).orderOverview, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Container( - height: MediaQuery.of(context).size.height * 0.8, + height: double.infinity, child: Column( children: [ - if (!prescriptions.isInOutPatient) - ...List.generate( - prescriptionReportList.length, - (index) => Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: - Border.all(color: Colors.grey[200], width: 0.5), + Expanded( + child: Column( + children: [ + if (!prescriptions.isInOutPatient) + Container( + margin: EdgeInsets.all(12), + decoration: cardRadius(12), + clipBehavior: Clip.antiAlias, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + ...List.generate( + prescriptionReportList.length, + (index) => Container( + margin: EdgeInsets.all(0.0), + decoration: cardRadius(0), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReportList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Text( + prescriptionReportList[index].itemDescription.isNotEmpty + ? prescriptionReportList[index].itemDescription + : prescriptionReportList[index].itemDescriptionN, + style: TextStyle(fontFamily: prescriptionReportList[index].itemDescription.isNotEmpty ? 'Poppins' : 'Cairo'))), + )), + ], + ), + )) + ], ), - child: Row( - children: [ - ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReportList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + ), + ) + else + Container( + margin: EdgeInsets.all(12), + decoration: cardRadius(12), + clipBehavior: Clip.antiAlias, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + prescriptionReportEnhList.length, + (index) => Container( + margin: EdgeInsets.all(0.0), + // decoration: cardRadius(0), + child: Row( + children: [ + InkWell( + onTap: () { + showZoomImageDialog(context, prescriptionReportEnhList[index].imageSRCUrl); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(3), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], + ), + ), + SizedBox(width: 14), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (prescriptionReportList[index].itemDescription.isNotEmpty + ? prescriptionReportList[index].itemDescription + : prescriptionReportList[index].itemDescriptionN ?? ''), + style: TextStyle( + fontFamily: prescriptionReportList[index].itemDescription.isNotEmpty ? 'Poppins' : 'Cairo', + letterSpacing: -0.64, + color: Color(0xff2E303A), + fontSize: 16.0, + fontWeight: FontWeight.w600)), + ], + ), + ), + ), + ], + ), ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReportList[index] - .itemDescription - .isNotEmpty - ? prescriptionReportList[index] - .itemDescription - : prescriptionReportList[index] - .itemDescriptionN)), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], ) ], ), - )) - else - ...List.generate( - prescriptionReportEnhList.length, - (index) => Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(prescriptionReportEnhList[index] - .itemDescription), - ], - ), - ), ), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], - ), - ), - ) - ], - ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.15, - color: Colors.grey[100], - child: Column( - children: [ - SizedBox(height: 12,), + ), + ], + ), + ), Container( - width: MediaQuery.of(context).size.width * 0.8, - child: SecondaryButton( - label: TranslationBase.of(context).submit.toUpperCase(), - color: Colors.green[800], - onTap: () async { - showDialog( - context: context, - child: ConfirmWithMessageDialog( - message: TranslationBase.of(context).confirmPrescription, - okTitle: TranslationBase.of(context).ok, - onTap: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.insertDeliveryOrder(lineItemNo: 0, - longitude: longitude, - latitude: latitude,appointmentNo: prescriptions.appointmentNo, - dischargeID: prescriptions.dischargeNo,createdBy: model.user.patientID) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) - showErrorDialog(context,model.error); - else - { - Navigator.pop(context); + // decoration: cardRadius(0), + margin: EdgeInsets.zero, + child: Container( + width: double.infinity, + margin: EdgeInsets.all(12), + child: DefaultButton( + TranslationBase.of(context).submit.toUpperCase(), + () async { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).confirmPrescription, + okTitle: TranslationBase.of(context).ok, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .insertDeliveryOrder( + lineItemNo: 1, + longitude: longitude, + latitude: latitude, + appointmentNo: prescriptions.appointmentNo, + dischargeID: prescriptions.dischargeNo, + createdBy: model.user.patientID) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) + showErrorDialog(context, model.error); + else { Navigator.pop(context); Navigator.pop(context); + Navigator.pop(context, true); } - - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - }); - }, - ), - ); - - }, - )) + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + }); + }, + ), + ); + }, + )), + ) ], ), ), @@ -183,7 +222,7 @@ class PrescriptionOrderOverview extends StatelessWidget { ); } - void showErrorDialog(BuildContext context,String error) { + void showErrorDialog(BuildContext context, String error) { showDialog( context: context, child: ConfirmWithMessageDialog( @@ -192,12 +231,9 @@ class PrescriptionOrderOverview extends StatelessWidget { onTap: () { Navigator.pop(context); Navigator.pop(context); - Navigator.pop(context); - + Navigator.pop(context, true); }, ), ); - } - } diff --git a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart index 2f87ffae..b12cc386 100644 --- a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart @@ -1,14 +1,13 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import 'package:url_launcher/url_launcher.dart'; class PharmacyForPrescriptionsPage extends StatelessWidget { final itemID; @@ -22,117 +21,71 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: itemID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).availability, baseViewModel: model, body: Column( children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + Padding( + padding: const EdgeInsets.fromLTRB(21, 21, 21, 0), + child: Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty - ? prescriptionReport.itemDescription - : prescriptionReport.itemDescriptionN ?? ''), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, ), ), - ) - ], + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''), + ), + ), + ) + ], + ), ), ), model.pharmacyPrescriptionsList.isNotEmpty == true - ? ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (context, index) => Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.pharmacyPrescriptionsList[index].projectImageURL, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.pharmacyPrescriptionsList[index].locationDescription), - SizedBox( - height: 5, - ), - Texts(model.pharmacyPrescriptionsList[index].cityName), - ], - ), - ), - ), - InkWell( - onTap: () { - MapsLauncher.launchCoordinates( - double.parse(model.pharmacyPrescriptionsList[index].latitude), - double.parse(model.pharmacyPrescriptionsList[index].longitude)); - }, - child: Icon( - Icons.pin_drop, - size: 18, - color: Colors.red[900], - ), - ), - SizedBox( - width: 15, - ), - InkWell( - onTap: Feedback.wrapForTap(() { - launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}"); - }, context), - child: Container( - child: Icon( - Icons.call, - size: 18, - color: Colors.red[900], - ), - ), - ) - ], - ), + ? Expanded( + child: ListView.builder( + scrollDirection: Axis.vertical, + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + GetHMGLocationsModel location = GetHMGLocationsModel(); + location.locationName = model.pharmacyPrescriptionsList[index].locationDescription; + location.cityName = model.pharmacyPrescriptionsList[index].cityName; + location.phoneNumber = model.pharmacyPrescriptionsList[index].phoneNumber; + location.latitude = model.pharmacyPrescriptionsList[index].latitude; + location.longitude = model.pharmacyPrescriptionsList[index].longitude; + location.distanceInKilometers = model.pharmacyPrescriptionsList[index].distanceInKilometers; + return HospitalLocation(location, showCity: true); + }, + itemCount: model.pharmacyPrescriptionsList.length, ), - itemCount: model.pharmacyPrescriptionsList.length, ) : Padding( padding: const EdgeInsets.only(top: 65.0), diff --git a/lib/pages/medical/prescriptions/prescription_details_inp.dart b/lib/pages/medical/prescriptions/prescription_details_inp.dart index 55476a11..8c181f88 100644 --- a/lib/pages/medical/prescriptions/prescription_details_inp.dart +++ b/lib/pages/medical/prescriptions/prescription_details_inp.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 02be8fdb..5a47ec3b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,11 +1,20 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/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/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -13,270 +22,230 @@ import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; + final Prescriptions prescriptions; - PrescriptionDetailsPage({Key key, this.prescriptionReport}); + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty - ? prescriptionReport.itemDescription - : prescriptionReport.itemDescriptionN ?? ''), - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - prescriptionReport: prescriptionReport, - ), - ), - ), - child: Center( - child: Column( - children: [ - Container( - width: 50, - decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle), - child: Column( - children: [ - Icon( - Icons.pin_drop, - color: Colors.red[800], - size: 55, - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Texts(TranslationBase.of(context).availability) - ], - ), - )), - ), - _addReminderButton(context) - ], - ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DoctorHeader( + headerModel: HeaderModel( + prescriptions.doctorName, + prescriptions.doctorID, + prescriptions.doctorImageURL, + prescriptions.speciality, + "", + prescriptions.name, + DateUtil.convertStringToDate(prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + prescriptions.nationalityFlagURL, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, + "", ), - Container( - color: Colors.white, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - child: Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)), - children: [ - TableRow( - children: [ - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).route, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).frequency, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 4), - child: Center( - child: Texts( - "${TranslationBase.of(context).dailyDoses}", - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).duration, - fontSize: 14, - ))), + isNeedToShowButton: false, + ), + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + Container( + padding: EdgeInsets.all(14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), ], ), - TableRow( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.routeN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.frequencyN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.days}'))) + Row( + children: [ + // Container( + // decoration: BoxDecoration( + // border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + // borderRadius: BorderRadius.all(Radius.circular(30.0)), + // ), + // child: ClipRRect( + // borderRadius: BorderRadius.all(Radius.circular(30)), + // child: Image.network( + // prescriptionReport.imageSRCUrl, + // fit: BoxFit.cover, + // width: 48, + // height: 48, + // ), + // ), + // ), + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 49, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], + ), + onTap: () { + showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + }, + ), + SizedBox(width: 12), + Expanded( + child: Text( + (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ) + ], + ), + SizedBox(height: 12), + Table(border: TableBorder(horizontalInside: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid)), children: [ + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).route, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).frequency, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).dailyDoses, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).duration, showDivider: false) + ], + ), + TableRow( + children: [ + Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + ], + ), + ]), + Text( + TranslationBase.of(context).remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), + ), + Text( + prescriptionReport.remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), ], ), - ], - ), + ), + ], ), - Container( - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - width: double.infinity, - color: Colors.white, - padding: EdgeInsets.all(5), - child: Center( - child: Column( - children: [ - Texts(TranslationBase.of(context).notes), - SizedBox( - height: 5, - ), - Divider( - height: 0.5, - color: Colors.grey[300], - ), - SizedBox( - height: 5, - ), - Texts(prescriptionReport.remarks ?? ''), - ], + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).availability, + () { + Navigator.push( + context, + FadePage( + page: PharmacyForPrescriptionsPage( + itemID: prescriptionReport.itemID, + prescriptionReport: prescriptionReport, + ), + ), + ); + }, + iconData: Icons.location_on, + color: Color(0xff359846), + ), ), - ), - ) - ], - ), - ), - ); - } + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).addReminder, + () { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - Widget _addReminderButton(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - - return GestureDetector( - onTap: () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); + showReminderDialog( + context, + endDate, + "", + prescriptionReport.itemID.toString(), + "", + "", + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + ); + return; - print(prescriptionReport); - 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: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: - "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, + 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: PrescriptionReminderDialog( + eventId: prescriptionReport.itemID.toString(), + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + startDate: startDate, + endDate: endDate, + location: prescriptionReport.remarks, + days: 1, + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + }, + iconData: Icons.notifications_active, + color: Color(0xffD02127), + //textColor: Color(0xff2B353E), ), ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); - }, - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - // height: 100.0, - margin: EdgeInsets.all(7.0), - padding: EdgeInsets.only(bottom: 4.0), - decoration: BoxDecoration( - boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), - child: Text("add", - overflow: TextOverflow.clip, - style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)), - ), - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Text("reminder", - overflow: TextOverflow.clip, - style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), - ), - Container( - alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0) - : EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0), - child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0), - ), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index e47b8ea7..0e627a95 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -1,20 +1,25 @@ -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'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; import 'PrescriptionIDeliveryAddressPage.dart'; @@ -22,215 +27,379 @@ class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; PrescriptionItemsPage({Key key, this.prescriptions}); - //TODO + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => - model.getPrescriptionReport(prescriptions: prescriptions), + onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescriptions, + appBarTitle: prescriptions.doctorName, baseViewModel: model, - body: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - if (!prescriptions.isInOutPatient) - ...List.generate( - model.prescriptionReportListINP.length, - (index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPageINP( - prescriptionReport: - model.prescriptionReportListINP[index], - ), - ), - ), - child: Container( - width: double.infinity, - margin: - EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all( - color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportListINP[index] - .imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + showNewAppBar: true, + showNewAppBarTitle: true, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + DoctorHeader( + headerModel: HeaderModel( + prescriptions.doctorName, + prescriptions.doctorID, + prescriptions.doctorImageURL, + prescriptions.speciality, + "", + prescriptions.name, + DateUtil.convertStringToDate(prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + prescriptions.nationalityFlagURL, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, + model.user.emailAddress, + ), + isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, + showConfirmMessageDialog: false, + onTap: () { + showConfirmMessage(context, model); + }, + ), + if (!prescriptions.isInOutPatient) + model.prescriptionReportListINP.length > 0 + ? ListView.separated( + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPageINP( + prescriptionReport: model.prescriptionReportListINP[index], + ), + ), + ); + }, + child: Container( + width: double.infinity, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), + decoration: cardRadius(12), + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.prescriptionReportListINP[index].itemDescription.isNotEmpty + ? model.prescriptionReportListINP[index].itemDescription + : model.prescriptionReportListINP[index].itemDescriptionN ?? '', + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(10), + Row( + children: [ + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportListINP[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], + ), + onTap: () { + showZoomImageDialog( + context, + model.prescriptionReportListINP[index].imageSRCUrl, + ); + }, + ), + mWidth(12), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + TranslationBase.of(context).route + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].route, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).dailyDoses + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].doseDailyQuantity.toString(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + mHeight(12), + Text( + model.prescriptionReportListINP[index].remarks, + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ) + ], + ), + ], + ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + ], + ), + ), + ), ), - ), - SizedBox( - width: 10, - ), - Expanded( + ); + }, + separatorBuilder: (context, index) { + return mHeight(8); + }, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.prescriptionReportListINP.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), + ) + else + model.prescriptionReportEnhList.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + PrescriptionReport prescriptionReport = PrescriptionReport( + imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model.prescriptionReportEnhList[index].itemDescription, + itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, + routeN: model.prescriptionReportEnhList[index].route, + frequency: model.prescriptionReportEnhList[index].frequency, + frequencyN: model.prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: model.prescriptionReportEnhList[index].itemID, + remarks: model.prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + prescriptions: prescriptions, + ), + ), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(model - .prescriptionReportListINP[index] - .itemDescription - .isNotEmpty - ? model - .prescriptionReportListINP[index] - .itemDescription - : model - .prescriptionReportListINP[ - index] - .itemDescriptionN ?? - '')), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], - ), - ), - )) - else - ...List.generate( - model.prescriptionReportEnhList.length, - (index) => InkWell( - onTap: () { - PrescriptionReport prescriptionReport = - PrescriptionReport( - imageSRCUrl: model - .prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model - .prescriptionReportEnhList[index] - .itemDescription, - itemDescriptionN: model - .prescriptionReportEnhList[index] - .itemDescription, - routeN: - model.prescriptionReportEnhList[index].route, - frequency: model - .prescriptionReportEnhList[index].frequency, - frequencyN: model - .prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model - .prescriptionReportEnhList[index] - .doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: - model.prescriptionReportEnhList[index].itemID, - remarks: model - .prescriptionReportEnhList[index].remarks); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: prescriptionReport, - ), - ), - ); - }, - child: Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model - .prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (model.prescriptionReportEnhList[index].itemDescription.isNotEmpty + ? model.prescriptionReportEnhList[index].itemDescription + : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, + style: TextStyle( + fontSize: 16, + color: Color(0xff2E303A), + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], + ), + onTap: () { + showZoomImageDialog( + context, + model.prescriptionReportEnhList[index].imageSRCUrl, + ); + }, + ), + mWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), + projectViewModel.isArabic), + mHeight(9), + Text( + model.prescriptionReportEnhList[index].remarks, + style: TextStyle( + color: Color(0xff575757), + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ) + ], + ), + ], + ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + ], + ), + ), + ), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: model.prescriptionReportEnhList.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription.isNotEmpty - ? model.prescriptionReportEnhList[index] - .itemDescription - : model.prescriptionReportEnhList[index] - .itemDescriptionN ?? - ''), - ], + ], + ), + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).resendOrder, + ((!projectViewModel.havePrivilege(62)) || projectViewModel.user.outSA == 1 || model.isMedDeliveryAllowed == false) + ? null + : () => { + Navigator.push( + context, + FadePage( + page: PrescriptionDeliveryAddressPage( + prescriptions: prescriptions, + prescriptionReportList: model.prescriptionReportList, + prescriptionReportEnhList: model.prescriptionReportEnhList, ), ), - ), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], ) - ], - ), - ), - ), - ) - ], - ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.25, - color: Colors.grey[100], - child: Column( - children: [ - Divider(), - if (projectViewModel.havePrivilege(13)) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: TranslationBase.of(context).sendCopy, - onTap: () { - showConfirmMessage(context, model); - }, - loading: model.state == ViewState.BusyLocal, - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: TranslationBase.of(context).resendOrder, - backgroundColor: Colors.green[800], - onTap: () { - Navigator.push( - context, - FadePage( - page: PrescriptionDeliveryAddressPage( - prescriptions: prescriptions, - prescriptionReportList: - model.prescriptionReportList, - prescriptionReportEnhList: - model.prescriptionReportEnhList, - ), - ), - ); - }, - )) - ], - ), + }, + color: Color(0xff359846), + disabledColor: Color(0xff575757), + ), + ), + ], ), ), ); diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index 30bfa13e..e9b1dfb6 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -1,160 +1,196 @@ -import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/BottomButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class PrescriptionsHistoryDetailsPage extends StatelessWidget { - final PrescriptionsOrder prescriptionsOrder; + final GetCMCAllOrdersResponseModel prescriptionsOrder; PrescriptionsHistoryDetailsPage({Key key, this.prescriptionsOrder}); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPrescriptionReportEnh( - prescriptionsOrder: prescriptionsOrder), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).orderDetails, - baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(15.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - Container( - width: double.infinity, - decoration: BoxDecoration( - color: prescriptionsOrder.status == 3 ?Colors.green : prescriptionsOrder.status ==2 ? Colors.grey: Colors.red, - borderRadius: BorderRadius.circular(5)), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).orderStatus +' : ${prescriptionsOrder.descriptionN}',color: Colors.white,), - )), - SizedBox( - height: 15, - ), - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 0.5), - outside: BorderSide(width: 0.5)), - children: [ - TableRow(children: [ - Container( - height: 50, - color: Colors.white, - child: Center( - child: Texts(TranslationBase.of(context).orderNo), - ), - ), - Container( - height: 50, - color: Colors.white, - child: Center( - child: Texts(TranslationBase.of(context).date), - ), - ), - ]), - TableRow(children: [ - Container( - height: 70, - color: Colors.white, - child: Center( - child: Texts('${prescriptionsOrder.iD}'), - ), - ), - Container( - height: 70, - color: Colors.white, - child: Center( - child: Texts('${prescriptionsOrder.createdOn.year}-${prescriptionsOrder.createdOn.day}-${prescriptionsOrder.createdOn.day} ${prescriptionsOrder.createdOn.hour}:${prescriptionsOrder.createdOn.minute}'), + onModelReady: (model) => model.getPrescriptionReportDetailsRC(), + builder: (_, model, widget) { + int status = prescriptionsOrder.statusId; + String _statusDisp = prescriptionsOrder.statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).orderDetails, + baseViewModel: model, + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: true, + body: Column( + children: [ + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + Container( + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - ]) - ], - ), - SizedBox( - height: 15, - ), - ...List.generate( - model.prescriptionReportEnhList.length, - (index) => Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription), + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsOrder.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) ], ), - ), + SizedBox(height: 16), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) => Row( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + model.prescriptionsOrderListRC[index].image, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + SizedBox(width: 14), + Expanded( + child: Text( + (model.prescriptionsOrderListRC[index].itemDescription.isNotEmpty + ? model.prescriptionsOrderListRC[index].itemDescription + : model.prescriptionsOrderListRC[index].itemDescription ?? '') + .toLowerCase() + .capitalizeFirstofEach, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ) + ], + ), + separatorBuilder: (context, index) => SizedBox(height: 12), + itemCount: model.prescriptionsOrderListRC.length) + ], ), - ], + ), ), - ), + ], ), - SizedBox(height: 120,) - ], - ), - ), - ), - bottomSheet: Container( - //padding: EdgeInsets.all(8.0), - // margin: EdgeInsets.all(8.0), - child: BottomButton( - label: TranslationBase.of(context).cancelOrder, - disabled: prescriptionsOrder.status != 1, - textColor: Colors.white, - onTap: (){ - - showCDialog(model,context); - //showAlertDialog(context); - }, + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).cancelOrder, + // prescriptionsOrder.statusId != 1 + // ? null + // : + () { + showCDialog(model, context); + }, + disabledColor: Color(0xff575757), + ), + ), + ], ), - ), - ), + ); + }, ); } - showCDialog(PrescriptionsViewModel model,context){ + showCDialog(PrescriptionsViewModel model, context) { ConfirmDialog( context: context, confirmMessage: "Are you sure ?", okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel, - okFunction: () { + okFunction: () async { Navigator.of(context).pop(); - model.updatePressOrder(presOrderID: prescriptionsOrder.iD).then((value) { - Navigator.of(context).pop(); - }); + await model.updatePressOrder(presOrderID: prescriptionsOrder.iD); + Navigator.of(context).pop(true); }, cancelFunction: () => {}).showAlertDialog(context); // dialog.showAlertDialog(context); } - } diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 84691773..1de0ae1d 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -1,9 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -11,76 +13,143 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class PrescriptionsHistoryPage extends StatelessWidget { + final VoidCallback showOrderLog; final PrescriptionsViewModel prescriptionsViewModel; - PrescriptionsHistoryPage({Key key, this.prescriptionsViewModel}); + PrescriptionsHistoryPage({Key key, this.prescriptionsViewModel, this.showOrderLog}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( - baseViewModel: prescriptionsViewModel, - body: ListView.builder( - physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: - prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ), - child: Container( - padding: EdgeInsets.all(15.0), - margin: EdgeInsets.all(8.0), - decoration: - BoxDecoration(shape: BoxShape.rectangle, color: Colors.white), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - DateUtil.getDayMonthYearHourMinuteDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - fontWeight: FontWeight.w300, - ), - SizedBox( - height: 5, - ), - Texts( - '${TranslationBase.of(context).orderNo} ${prescriptionsViewModel.prescriptionsHistory[index].iD}'), - SizedBox( - height: 5, - ), - Texts( - '${prescriptionsViewModel.prescriptionsHistory[index].descriptionN}'), - SizedBox( - height: 5, - ), - Texts( - '${TranslationBase.of(context).orderNo}', - fontWeight: FontWeight.w300, - ), - SizedBox( - height: 5, - ), - ], - ), - ), - Icon( - Icons.arrow_forward_ios, - size: 25, - ) - ], - ), - ), - ), - itemCount: prescriptionsViewModel.prescriptionsHistory.length, - ), - ); + return BaseView( + onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true), + builder: (_, model, widget) => AppScaffold( + baseViewModel: prescriptionsViewModel, + body: model.state != ViewState.Busy + ? prescriptionsViewModel.prescriptionsHistory.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].statusId; + String _statusDisp = prescriptionsViewModel.prescriptionsHistory[index].statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return InkWell( + onTap: () async { + final result = await Navigator.push( + context, + FadePage( + page: PrescriptionsHistoryDetailsPage( + prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + ), + ), + ); + if (result != null) { + showOrderLog(); + } + }, + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + ), + ), + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTimeLang(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created), false), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), + ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + mWidth(6), + ], + ), + )); + }, + itemCount: prescriptionsViewModel.prescriptionsHistory.length, + ) + : getNoDataWidget(context) + : Container(), + )); } } diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 380d6284..d5efa38b 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -1,34 +1,37 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -import '../../../Constants.dart'; +import 'package:provider/provider.dart'; class HomePrescriptionsPage extends StatefulWidget { @override _HomePrescriptionsPageState createState() => _HomePrescriptionsPageState(); } -class _HomePrescriptionsPageState extends State - with SingleTickerProviderStateMixin { +class _HomePrescriptionsPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); + ProjectViewModel projectViewModel; + @override void initState() { super.initState(); - _tabController = TabController(length: 2, vsync: this); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/1.png')); + _tabController = TabController(length: 3, vsync: this); + imagesInfo.add(ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-prescriptions/ar/1.png')); } @override @@ -39,6 +42,7 @@ class _HomePrescriptionsPageState extends State @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( @@ -47,87 +51,69 @@ class _HomePrescriptionsPageState extends State description: TranslationBase.of(context).infoPrescriptions, infoList: TranslationBase.of(context).infoPrescriptionsPoints, imagesInfo: imagesInfo, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.92, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).prescriptions), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.30, - child: Center( - child: Texts(TranslationBase.of(context).history), - ), - ), - ], - ), - ), - ), - ), + showNewAppBar: true, + backgroundColor: Color(0xffF8F8F8), + showNewAppBarTitle: true, + body: Column( + children: [ + TabBar( + // isScrollable: true, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Text(TranslationBase.of(context).byClinic, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).byHospital, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).orderLog, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), ], ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - PrescriptionsPage( - prescriptionsViewModel: model, - ), - PrescriptionsHistoryPage( - prescriptionsViewModel: model, - ) - ], - ), - ) - ], - ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + PrescriptionsPage( + FilterType.Clinic, + prescriptionsViewModel: model, + showOrderLog: () async { + _tabController.animateTo(2); + // await model.getPrescriptionsOrders(showLoading: true); + setState(() {}); + }, + ), + PrescriptionsPage( + FilterType.Hospital, + prescriptionsViewModel: model, + showOrderLog: () async { + _tabController.animateTo(2); + // await model.getPrescriptionsOrders(showLoading: true); + setState(() {}); + }, + ), + PrescriptionsHistoryPage( + prescriptionsViewModel: model, + showOrderLog: () async { + await model.getPrescriptionsOrders(showLoading: true); + setState(() {}); + }, + ) + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/medical/prescriptions/prescriptions_page.dart b/lib/pages/medical/prescriptions/prescriptions_page.dart index abf68328..863a2209 100644 --- a/lib/pages/medical/prescriptions/prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_page.dart @@ -1,10 +1,12 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -13,93 +15,68 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class PrescriptionsPage extends StatelessWidget { + final VoidCallback showOrderLog; + final FilterType filterType; final PrescriptionsViewModel prescriptionsViewModel; - const PrescriptionsPage({Key key, this.prescriptionsViewModel}) - : super(key: key); + const PrescriptionsPage(this.filterType, {Key key, this.prescriptionsViewModel, this.showOrderLog}) : super(key: key); @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - baseViewModel: prescriptionsViewModel, - body: FractionallySizedBox( - widthFactor: 1.0, - child: ListView( + baseViewModel: prescriptionsViewModel, + body: ListView.separated( physics: BouncingScrollPhysics(), - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => - prescriptionsViewModel.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: prescriptionsViewModel.filterType, - onChanged: (FilterType value) { - prescriptionsViewModel.setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => prescriptionsViewModel - .setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: prescriptionsViewModel.filterType, - onChanged: (FilterType value) { - prescriptionsViewModel.setFilterType(value); + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + List prescriptionsList = prescriptionsViewModel.prescriptionsOrderListByValue(filterType)[index].prescriptionsList; + return AppExpandableNotifier( + title: prescriptionsViewModel.prescriptionsOrderListByValue(filterType)[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + Prescriptions prescriptions = prescriptionsList[_index]; + + bool _isSortByClinic = filterType == FilterType.Clinic; + return DoctorCard( + onTap: () async { + final _shouldRecallApi = await Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage( + prescriptions: prescriptions, + ), + ), + ); + if (_shouldRecallApi != null) { + showOrderLog(); + } }, - ), - ), - ), - ) - ], - ), - ...List.generate( - prescriptionsViewModel.prescriptionsOrderList.length, - (index) => AppExpandableNotifier( - title: prescriptionsViewModel - .prescriptionsOrderList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: prescriptionsViewModel - .prescriptionsOrderList[index].prescriptionsList - .map((prescriptions) { - return InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionItemsPage(prescriptions: prescriptions,), - ), - ), - child: DoctorCard( - name: prescriptions.doctorName, - profileUrl: prescriptions.doctorImageURL, - rat: prescriptions.actualDoctorRate.toDouble(), - subName: prescriptions.name, - isInOutPatient: prescriptions.isInOutPatient, - isLiveCareAppointment: prescriptions.isLiveCareAppointment, - date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - ), - ); - }).toList(), - )), - ) - ], - ), - ), - ); + name: prescriptions.doctorName, + profileUrl: prescriptions.doctorImageURL, + rating: prescriptions.actualDoctorRate.toDouble(), + subName: _isSortByClinic ? prescriptions.name : prescriptions.clinicDescription, + isSortByClinic: _isSortByClinic, + isInOutPatient: prescriptions.isInOutPatient, + isLiveCareAppointment: prescriptions.isLiveCareAppointment, + date: DateUtil.convertStringToDate(prescriptions + .appointmentDate) //projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: prescriptionsList.length), + ); + }, + itemCount: prescriptionsViewModel.prescriptionsOrderListByValue(filterType).length, + )); } } diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index f6d12938..f2a9490e 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -1,13 +1,14 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,91 +24,96 @@ class RadiologyDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getRadImageURL( - projectId: finalRadiology.projectID, - lineItem: finalRadiology.invoiceLineItemNo, - invoiceNo: finalRadiology.invoiceNo), + onModelReady: (model) => model.getRadImageURL(projectId: finalRadiology.projectID, lineItem: finalRadiology.invoiceLineItemNo, invoiceNo: finalRadiology.invoiceNo), builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).report, - isShowAppBar: true, - baseViewModel: model, - body: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts( - '${finalRadiology.reportData}', - textAlign: TextAlign.center, + appBarTitle: TranslationBase.of(context).report, + isShowAppBar: true, + baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), + body: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + DoctorHeader( + headerModel: new HeaderModel( + finalRadiology.doctorName, + finalRadiology.doctorID, + finalRadiology.doctorImageURL, + finalRadiology.speciality, + finalRadiology.invoiceNo.toString(), + finalRadiology.projectName, + finalRadiology.orderDate, + null, + finalRadiology.nationalityFlagURL, + finalRadiology.doctorRate, + finalRadiology.actualDoctorRate, + finalRadiology.noOfPatientsRate, + model.user.emailAddress, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts( - '${finalRadiology.reportData}', - textAlign: TextAlign.start, - fontSize: 17, - ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.2, - ) - ], - ), - ), - bottomSheet: (projectViewModel.havePrivilege(9) || - projectViewModel.havePrivilege(8)) - ? Container( + onTap: () { + showConfirmMessage(finalRadiology: finalRadiology, model: model); + }, + buttonTitle: TranslationBase.of(context).sendCopyRad, + isNeedToShowButton: projectViewModel.havePrivilege(8), + ), + Container( + margin: EdgeInsets.all(24), + decoration: cardRadius(12), + child: Container( width: double.infinity, - height: finalRadiology.dIAPACSURL != "" - ? MediaQuery.of(context).size.height * 0.25 - : MediaQuery.of(context).size.height * 0.14, - color: Colors.grey[100], - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Divider(), - if (finalRadiology.dIAPACSURL != "" && - projectViewModel.havePrivilege(9)) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { - launch(model.radImageURL); - }, - label: TranslationBase.of(context).openRad, - backgroundColor: Colors.grey[800], + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "General Result", + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), ), - if (projectViewModel.havePrivilege(8)) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { - showConfirmMessage( - finalRadiology: finalRadiology, model: model); - }, - label: TranslationBase.of(context).sendCopyRad, - loading: model.state == ViewState.BusyLocal, - backgroundColor: Theme.of(context).primaryColor, - ), - ) - ], + mHeight(10), + Text( + '${finalRadiology.reportData}', + style: TextStyle(fontSize: 12, letterSpacing: -0.48), + ), + mHeight(16), + (projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8)) + ? (finalRadiology.dIAPACSURL != "" && projectViewModel.havePrivilege(9)) + ? Container( + child: DefaultButton( + TranslationBase.of(context).openRad, + () => {launch(model.radImageURL)}, + textColor: Colors.white, + ), + ) + : Container() + : Container(), + ], + ), ), - ) - : Container()), + ), + ), + ], + ), + ), + ), ); } - void showConfirmMessage( - {FinalRadiology finalRadiology, RadiologyViewModel model}) { + void showConfirmMessage({FinalRadiology finalRadiology, RadiologyViewModel model}) { showDialog( context: AppGlobal.context, child: ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { - model.sendRadReportEmail( - mes: TranslationBase.of(AppGlobal.context).sendSuc, - finalRadiology: finalRadiology); + model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology); }, ), ); diff --git a/lib/pages/medical/radiology/radiology_home_page.dart b/lib/pages/medical/radiology/radiology_home_page.dart index 2123172a..4e22dcf6 100644 --- a/lib/pages/medical/radiology/radiology_home_page.dart +++ b/lib/pages/medical/radiology/radiology_home_page.dart @@ -1,12 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/radiology_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -16,95 +17,120 @@ import 'package:provider/provider.dart'; class RadiologyHomePage extends StatelessWidget { List imagesInfo = List(); + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/1.png')); + imagesInfo.add( + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/0.png')); + imagesInfo.add( + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-radiology/ar/1.png')); return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).radiology, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), description: TranslationBase.of(context).infoRadiology, imagesInfo: imagesInfo, - body: FractionallySizedBox( - widthFactor: 1.0, - child: ListView( - physics: BouncingScrollPhysics(), - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => - model.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => model - .setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); - }, - ), - ), - ), - ) - ], + body: Column( + children: [ + Row( + children: [ + MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () { + model.setFilterType(FilterType.Clinic); + }), + MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () { + model.setFilterType(FilterType.Hospital); + }), + ], + ), + + Expanded( + child: FractionallySizedBox( + widthFactor: 1.0, + child: ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 12), + separatorBuilder: (context, index) { + return Container( + height: 12, + margin: EdgeInsets.only(left: 21, right: 21), + // color: Color(0xffD9D9D9), + ); + }, + itemBuilder: (context, index) { + return AppExpandableNotifier( + title: model.finalRadiologyList[index].filterName, + bodyWidget: ListView.separated( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + itemBuilder: (context, _index) { + FinalRadiology radiology = model.finalRadiologyList[index].finalRadiologyList[_index]; + bool _isSortByClinic = model.filterType == FilterType.Clinic; + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: RadiologyDetailsPage( + finalRadiology: radiology, + ), + ), + ), + isInOutPatient: radiology.isInOutPatient, + name: TranslationBase.of(context).dr + " " + radiology.doctorName, + billNo: radiology.invoiceNo.toString(), + profileUrl: radiology.doctorImageURL, + subName: _isSortByClinic ? radiology.projectName : radiology.clinicDescription, + isLiveCareAppointment: radiology.isLiveCareAppointment, + date: radiology.orderDate, + isSortByClinic: _isSortByClinic, + //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemCount: model.finalRadiologyList[index].finalRadiologyList.length), + ); + }, + itemCount: model.finalRadiologyList.length), ), - ...List.generate( - model.finalRadiologyList.length, - (index) => AppExpandableNotifier( - title: model - .finalRadiologyList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model - .finalRadiologyList[index].finalRadiologyList - .map((radiology) { - return InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: RadiologyDetailsPage(finalRadiology: radiology,), - ), - ), - child: DoctorCard( - isInOutPatient: radiology.isInOutPatient, - isLiveCareAppointment: radiology.isLiveCareAppointment, - name: radiology.doctorName, - profileUrl: radiology.doctorImageURL, - billNo: '${radiology.invoiceNo}', - subName: '${radiology.projectName}', - date: projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(radiology.orderDate):DateUtil.getMonthDayYearDateFormatted(radiology.orderDate), - ), - ); - }).toList(), - )), - ) - ], - ), + ), + // ...List.generate( + // model.finalRadiologyList.length, + // (index) => AppExpandableNotifier( + // title: model + // .finalRadiologyList[index].filterName, + // bodyWidget: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: model + // .finalRadiologyList[index].finalRadiologyList + // .map((radiology) { + // return InkWell( + // onTap: () => Navigator.push( + // context, + // FadePage( + // page: RadiologyDetailsPage(finalRadiology: radiology,), + // ), + // ), + // child: DoctorCard( + // isInOutPatient: radiology.isInOutPatient, + // isLiveCareAppointment: radiology.isLiveCareAppointment, + // name: radiology.doctorName, + // profileUrl: radiology.doctorImageURL, + // billNo: '${radiology.invoiceNo}', + // subName: '${radiology.projectName}', + // date: radiology.orderDate//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(radiology.orderDate):DateUtil.getMonthDayYearDateFormatted(radiology.orderDate), + // ), + // ); + // }).toList(), + // )), + // ) + ], ), ), ); diff --git a/lib/pages/medical/reports/monthly_reports.dart b/lib/pages/medical/reports/monthly_reports.dart index f6635063..2a2647f7 100644 --- a/lib/pages/medical/reports/monthly_reports.dart +++ b/lib/pages/medical/reports/monthly_reports.dart @@ -1,18 +1,18 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/user_agreement_page.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/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/input/custom_switch.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.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/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class MonthlyReportsPage extends StatefulWidget { @override @@ -30,20 +30,15 @@ class _MonthlyReportsPageState extends State { @override void initState() { imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/ar/0.png')); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/en/1.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/ar/1.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/monthly-reports/ar/1.png')); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView(builder: (_, model, w) { if (isSummary == null) { isSummary = model.receiveHealthSummaryReport; @@ -57,155 +52,197 @@ class _MonthlyReportsPageState extends State { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).monthlyReports, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), imagesInfo: imagesInfo, description: TranslationBase.of(context).infoMonthReport, body: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(12), - child: Form( - key: formKey, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(9), - height: 55, - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(8)), shape: BoxShape.rectangle, border: Border.all(color: Colors.grey)), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).patientHealthSummaryReport, - bold: true, - ), - CustomSwitch( - value: isSummary, - activeColor: Colors.red, - inactiveColor: Colors.grey, - onChanged: () async { - setState(() { - isSummary = !isSummary; - }); - if (!isSummary) { - GifLoaderDialogUtils.showMyDialog(context); - await model.updatePatientHealthSummaryReport(message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary); - model.receiveHealthSummaryReport = isSummary; - isAgree = isSummary; - model.user.emailAddress = ""; - GifLoaderDialogUtils.hideDialog(context); - } - }, - ) - ], - ), - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: TextFields( - fillColor: Colors.red, - hintText: 'email@email.com', - fontSize: 20, - initialValue: email, - fontWeight: FontWeight.w600, - onChanged: (text) { - email = text; - }, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context).enterEmail; - else - return null; - }, - ), - ), - Divider( - height: 10.4, - thickness: 1.0, - ), - SizedBox( - height: 15, - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Texts(TranslationBase.of(context).toViewTheTermsAndConditions), + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Form( + key: formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(right: 12, left: 12, top: 14, bottom: 14), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: UserAgreementContent(), - ), - ); - }, - child: Texts( - TranslationBase.of(context).clickHere, - color: Colors.blue, - ), - ) ], - ), - ), - SizedBox( - height: 5, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Checkbox( - value: isAgree, - onChanged: (value) { + Expanded( + child: Text( + TranslationBase.of(context).patientHealthSummaryReport, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 25 / 16), + ), + ), + CustomSwitch( + value: isSummary, + activeColor: Color(0xffD02127), + inactiveColor: Color(0xff28323A).withOpacity(0.3), + onChanged: () async { setState(() { - isAgree = !isAgree; + isSummary = !isSummary; }); + if (!isSummary) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport(message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary); + model.receiveHealthSummaryReport = isSummary; + isAgree = isSummary; + model.user.emailAddress = ""; + GifLoaderDialogUtils.hideDialog(context); + } }, - activeColor: Colors.red, + ) + ], + ), + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).email, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextFormField( + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + // controller: _controller, + onChanged: (value) => {email = value}, + initialValue: email, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context).enterEmail; + else + return null; + }, + decoration: InputDecoration( + isDense: true, + hintText: "email@email.com", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), ), - Texts(TranslationBase.of(context).iAgreeToTheTermsAndConditions), ], ), - Container( - margin: EdgeInsets.all(8), - width: double.infinity, - child: SecondaryButton( - textColor: Colors.white, - label: TranslationBase.of(context).save, - disabled: (!isAgree || !isSummary), - onTap: () async { - final form = formKey.currentState; - if (form.validate()) { - GifLoaderDialogUtils.showMyDialog(context); - await model.updatePatientHealthSummaryReport( - message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary, isUpdateEmail: true, email: email.isNotEmpty ? email : model.user.emailAddress); - model.receiveHealthSummaryReport = isSummary; - model.user.emailAddress = email.isNotEmpty ? email : model.user.emailAddress; - GifLoaderDialogUtils.hideDialog(context); - } + ), + SizedBox( + height: 12, + ), + RichText( + text: TextSpan( + text: TranslationBase.of(context).toViewTheTermsAndConditions + " ", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + children: [ + TextSpan( + text: TranslationBase.of(context).clickHere, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.blue, letterSpacing: -0.64, height: 23 / 16), + recognizer: new TapGestureRecognizer() + ..onTap = () => Navigator.push( + context, + FadePage( + page: UserAgreementContent(), + ), + ), + ) + ]), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); }, + activeColor: Color(0xffD02127), ), - ), - Padding( - padding: const EdgeInsets.all(5.0), - child: Texts( - TranslationBase.of(context).instructionAgree, - fontWeight: FontWeight.normal, + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff2B353E), letterSpacing: -0.56, height: 21 / 14), ), - ), - SizedBox( - height: 12, - ), - Center(child: Image.asset('assets/images/report.jpg')) - ], - ), + ], + ), + DefaultButton( + TranslationBase.of(context).save, + () async { + final form = formKey.currentState; + if (form.validate()) { + GifLoaderDialogUtils.showMyDialog(context); + await model.updatePatientHealthSummaryReport( + message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary, isUpdateEmail: true, email: email.isNotEmpty ? email : model.user.emailAddress); + model.receiveHealthSummaryReport = isSummary; + model.user.emailAddress = email.isNotEmpty ? email : model.user.emailAddress; + GifLoaderDialogUtils.hideDialog(context); + } + }, + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).instructionAgree, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + SizedBox(height: 12), + Center(child: Image.asset('assets/images/report.jpg')) + ], ), ), ), diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index f9efb1a1..6e6d991a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -3,12 +3,12 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -20,8 +20,7 @@ class HomeReportPage extends StatefulWidget { _HomeReportPageState createState() => _HomeReportPageState(); } -class _HomeReportPageState extends State - with SingleTickerProviderStateMixin { +class _HomeReportPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; List imagesInfo = List(); @@ -41,20 +40,11 @@ class _HomeReportPageState extends State Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png')); imagesInfo.add(ImagesInfo( - imageEn: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', - imageAr: - 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( onModelReady: (model) => model.getReports(), //model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( @@ -63,129 +53,76 @@ class _HomeReportPageState extends State title: TranslationBase.of(context).medReport, description: TranslationBase.of(context).infoMonthReport, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), imagesInfo: imagesInfo, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), + body: Column( + children: [ + TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Text( + TranslationBase.of(context).requested, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Colors.white), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Theme.of(context).primaryColor, - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.20, - child: Center( - child: Texts(TranslationBase.of(context).requested,fontSize: 11,), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.20, - child: Center( - child: Texts(TranslationBase.of(context).ready,fontSize: 11,), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.20, - child: Center( - child: - Texts(TranslationBase.of(context).completed,fontSize: 11,), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.20, - child: Center( - child: - Texts(TranslationBase.of(context).cancelled,fontSize: 11,), - ), - ), - ], - ), - ), - ), + Text( + TranslationBase.of(context).ready, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + Text( + TranslationBase.of(context).completed, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + Text( + TranslationBase.of(context).cancelled, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), ], ), - ), - body: Column( - children: [ - if(model.user!=null) + if (model.user != null) Expanded( child: TabBarView( physics: BouncingScrollPhysics(), controller: _tabController, children: [ - ReportListWidget( - reportList: model.reportsOrderRequestList, - emailAddress: model.user.emailAddress - ), - ReportListWidget( - reportList: model.reportsOrderReadyList, - emailAddress: model.user.emailAddress - ), - ReportListWidget( - reportList: model.reportsOrderCompletedList, - emailAddress: model.user.emailAddress - ), - ReportListWidget( - reportList: model.reportsOrderCanceledList, - emailAddress: model.user.emailAddress - ), + ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), ], ), ), - SizedBox( - height: 110, - ) - ], - ), - bottomSheet: projectViewModel.havePrivilege(21) ?Container( - width: double.infinity, - height: 90, - margin: EdgeInsets.all(8.0), - child: Button( - label: TranslationBase.of(context).requestMedicalReport, - backgroundColor: Colors.grey[800], - onTap: () => Navigator.push( - context, - FadePage( - page: MedicalReports(), + if (projectViewModel.havePrivilege(21)) + Padding( + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, + () => Navigator.push( + context, + FadePage( + page: MedicalReports(), + ), + ), ), - ), - ), - ):null, + ) + ], ), ), ); diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index ece69c0f..8d72216a 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -1,16 +1,20 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; class ReportListWidget extends StatelessWidget { final List reportList; @@ -18,86 +22,100 @@ class ReportListWidget extends StatelessWidget { ReportListWidget({@required this.reportList, this.emailAddress}); + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { - return Container( - child: ListView.builder( - itemBuilder: (context, index) => Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - width: double.infinity, - margin: EdgeInsets.only(left: 8, right: 8, top: 3), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.white, width: 2), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all( - Radius.circular(8.0), - )), - child: Row( - children: [ - Expanded( - flex: 1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: LargeAvatar( - name: reportList[index].doctorName, - url: reportList[index].doctorImageURL, + projectViewModel = Provider.of(context); + return reportList.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) { + Reports report = reportList[index]; + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - ), - ), - Expanded( - flex: 4, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Texts(reportList[index].projectName), - Container( - //height: MediaQuery.of(context).size.height * 0.07, - width: MediaQuery.of(context).size.width * 0.35, - child: Texts(reportList[index].clinicDescription), - ), - Texts(TranslationBase.of(context).invoiceNo + ': ${reportList[index].invoiceNo}'), - SizedBox(height: 12), - ], + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (report.doctorName != null) + Text( + report.doctorName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), - reportList[index].status == 2 - ? Expanded( - child: Container( - margin: EdgeInsets.only(left: 15.0, right: 15.0), - child: InkWell( - onTap: () { - showConfirmMessage(reportList[index]); - // sendReportEmail(reportList[index]); - }, - child: Icon( - Icons.email, - color: Theme.of(context).primaryColor, - size: 30.0, + if (report.doctorName != null) SizedBox(height: 6), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: report.doctorName, + url: report.doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (report.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", report.projectName, projectViewModel.isArabic), + if (report.clinicDescription != null) MyRichText(TranslationBase.of(context).hospital + ":", report.clinicDescription, projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RatingBar.readOnly( + initialRating: report.actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), - ), + if (reportList[index].status == 2) + IconButton( + icon: Icon(Icons.email), + color: Color(0xff28323A), + constraints: BoxConstraints(), + padding: EdgeInsets.zero, + onPressed: () { + showConfirmMessage(reportList[index]); + }) + ], ), - ) - : Container(), - ], - ), + ], + ), + ), + ], + ), + ], ), - ) - ], - ), - ), - ), - itemCount: reportList.length, - ), - ); + ), + ); + }, + itemCount: reportList.length, + ) + : getNoDataWidget(context); } void showConfirmMessage(Reports report) { @@ -116,15 +134,8 @@ class ReportListWidget extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(AppGlobal.context); ReportsService _reportsService = locator(); _reportsService - .sendEmailForMedicalReport( - report.projectName, - report.clinicDescription, - report.doctorName, - DateUtil.convertDateToString(report.requestDate), - report.invoiceNo.toString(), - report.projectID, - DateUtil.convertDateToString(report.requestDate), - report.setupId) + .sendEmailForMedicalReport(report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), report.invoiceNo.toString(), report.projectID, + DateUtil.convertDateToString(report.requestDate), report.setupId) .then((value) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully); diff --git a/lib/pages/medical/reports/reports_page.dart b/lib/pages/medical/reports/reports_page.dart index 11d5fc82..85d35d84 100644 --- a/lib/pages/medical/reports/reports_page.dart +++ b/lib/pages/medical/reports/reports_page.dart @@ -4,27 +4,30 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; class MedicalReports extends StatelessWidget { @override Widget build(BuildContext context) { - void confirmBox( - AppointmentHistory model, ReportsViewModel reportsViewModel) { + void confirmBox(AppointmentHistory model, ReportsViewModel reportsViewModel) { showDialog( context: context, - child: ConfirmDialog( - appointmentHistory: model, - onOkSelected: (model) => reportsViewModel.insertRequestForMedicalReport(model,TranslationBase.of(context).successSendReport), + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).confirmMsgReport, + onTap: () => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport), ), ); + return; } + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatentAppointmentHistory(), @@ -32,173 +35,103 @@ class MedicalReports extends StatelessWidget { baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).medReport, - body: ListView.builder( - itemCount: model.appointHistoryList.length, - itemBuilder: (context, index) => Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - width: double.infinity, - margin: EdgeInsets.only(left: 8, right: 8, top: 3), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.white, width: 2), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all( - Radius.circular(8.0), - )), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 5, right: 5), - child: LargeAvatar( - width: 50, - height: 50, - name: model.appointHistoryList[index].doctorNameObj, - url: model.appointHistoryList[index].doctorImageURL, - ), - ), - Expanded( - flex: 4, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Texts(model.appointHistoryList[index].projectName), - Texts(model.appointHistoryList[index].clinicName), - Texts(projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.appointHistoryList[index].appointmentDate):DateUtil.getMonthDayYearDateFormatted(model.appointHistoryList[index].appointmentDate)), - StarRating( - totalAverage: model - .appointHistoryList[index].actualDoctorRate - .toDouble(), - forceStars: true), - SizedBox( - height: 12, - ), - ], - ), - ), - ), - InkWell( - onTap: () => - confirmBox(model.appointHistoryList[index], model), + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), + body: model.appointHistoryList.isEmpty + ? getNoDataWidget(context) + : ListView.separated( + physics: BouncingScrollPhysics(), + itemCount: model.appointHistoryList.length, + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) { + AppointmentHistory _appointmenHistory = model.appointHistoryList[index]; + return InkWell( + onTap: () => confirmBox(model.appointHistoryList[index], model), child: Container( - width: 120, - height: 50, decoration: BoxDecoration( - color: Colors.black54, - border: - Border.all(color: Colors.transparent, width: 2), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all( - Radius.circular(8.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).requestReport, - fontSize: 12, - color: Colors.white, - ), - ), - ), - ), - SizedBox( - width: 12, - ), - ], - ), - ), - ), - ), - ), - ); - } -} - -class ConfirmDialog extends StatefulWidget { - final Function(AppointmentHistory) onOkSelected; - final AppointmentHistory appointmentHistory; - - ConfirmDialog({this.onOkSelected, this.appointmentHistory}); - - @override - _ConfirmDialogState createState() => _ConfirmDialogState(); -} - -class _ConfirmDialogState extends State { - @override - Widget build(BuildContext context) { - return SimpleDialog( - title: Texts(TranslationBase.of(context).confirm), - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).confirmMsgReport), - SizedBox( - height: 5.0, - ), - Divider( - height: 2.5, - color: Colors.grey[500], - ), - SizedBox( - height: 5, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => Navigator.pop(context), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel, - color: Colors.red, - ), + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onOkSelected(widget.appointmentHistory); - Navigator.pop(context); - }, + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if ((_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj) != null) + Text( + _appointmenHistory.doctorTitle.toString() + " " + (_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(_appointmenHistory.appointmentDate), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + ], + ), + if ((_appointmenHistory.doctorName ?? _appointmenHistory.doctorNameObj) != null) SizedBox(height: 6), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: _appointmenHistory.doctorName, + url: _appointmenHistory.doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (_appointmenHistory.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", _appointmenHistory.projectName, projectViewModel.isArabic), + if (_appointmenHistory.clinicName != null) MyRichText(TranslationBase.of(context).hospital + ":", _appointmenHistory.clinicName, projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RatingBar.readOnly( + initialRating: _appointmenHistory.actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + Icon(Icons.email, color: Color(0xff2B353E)) + ], + ), + ], + ), + ), + ], + ), + ], ), ), ), - ), - ], - ) - ], - ), - ) - ], + ); + }, + ), + ), ); } } diff --git a/lib/pages/medical/reports/user_agreement_page.dart b/lib/pages/medical/reports/user_agreement_page.dart index 9bb886e3..d48ff16d 100644 --- a/lib/pages/medical/reports/user_agreement_page.dart +++ b/lib/pages/medical/reports/user_agreement_page.dart @@ -13,11 +13,13 @@ class UserAgreementContent extends StatelessWidget { builder: (_, model, w) => AppScaffold( isShowAppBar: true, baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), appBarTitle: TranslationBase.of(context).userAgreement, body: SingleChildScrollView( - child: Html( - data: model.userAgreementContent, - ), + physics: BouncingScrollPhysics(), + child: Html(data: model.userAgreementContent), ), ), ); diff --git a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart new file mode 100644 index 00000000..cceb8b1e --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart @@ -0,0 +1,571 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyStepsResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DistanceTracker extends StatefulWidget { + @override + _DistanceTrackerState createState() => _DistanceTrackerState(); +} + +class _DistanceTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + num weeklyStatsAvgValue = 0; + num monthlyStatsAvgValue = 0; + num yearlyStatsAvgValue = 0; + + num avgWeeklyStepsValue = 0; + num avgMonthlyStepsValue = 0; + num avgYearlyStepsValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyStepsList = List(); + List monthlyStepsList = List(); + List yearlyStepsList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyDistanceData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).distance, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + print(value); + if (value == 0) { + getWeeklyDistanceData(); + } else if (value == 1) { + getMonthlyDistanceData(); + } else { + getYearlyDistanceData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded ? getWeeklyDistanceDetails() : Container(), + isMonthlyDataLoaded ? getMonthlyDistanceDetails() : Container(), + isYearlyDataLoaded ? getYearlyDistanceDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyDistanceData() { + avgWeeklyStepsValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyStepsList.clear(); + res['Med_GetWeekStepsTransactionsStsList'].forEach((element) { + weekyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgWeeklyStepsValue += value; + weeklyDataLength++; + } + }); + generateWeekData(); + setState(() { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyDistanceData() { + avgMonthlyStepsValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyStepsList.clear(); + res['Med_GetMonthStepsTransactionsStsList'].forEach((element) { + monthlyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgMonthlyStepsValue += value; + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyDistanceData() { + avgYearlyStepsValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + num value = element['ValueSum']; + avgYearlyStepsValue += value; + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyStepsList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyStepsList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? (element.value.toDouble() / 1000) : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyStepsList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyStepsList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() / 1000 : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? element.valueSum.toDouble() / 1000 : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + weekyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue((step.value / 1000).toString() + " " + TranslationBase.of(context).km_, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + monthlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue((step.value / 1000).toString() + " " + TranslationBase.of(context).km_, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + yearlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_ , isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + +} diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index ea8746e9..80a12cca 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,7 +1,12 @@ -import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/stepsTracker.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/Steps/stepsTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/distance/distanceTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/syncHealthData.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; + // import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; @@ -11,7 +16,6 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { - // List dataTypes = List(); @override @@ -27,192 +31,108 @@ class _HealthDataListState extends State { @override Widget build(BuildContext context) { + List myMedicalList = myOptionsList(context); return AppScaffold( - appBarTitle: "Smartwatches", - isShowAppBar: true, - body: Container( - height: MediaQuery - .of(context) - .size - .height, - margin: EdgeInsets.all(20.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Heart Rate", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/sleep_data.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Sleep Data", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: StepsTracker(), - ), - ); + appBarTitle: TranslationBase.of(context).smartWatches, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + body: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + height: 20, + ), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; }, - child: Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Steps", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Distance", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Energy", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], ), - Divider( - color: Colors.grey[500], - ), - ], - ), - ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery - .of(context) - .size - .height * 0.1, - color: Colors.grey[100], - child: Column( - children: [ - Divider( - color: Colors.transparent, ), - InkWell( - onTap: () { - print("ReadLast"); - // readLast(); - }, - child:Container( - height: (MediaQuery - .of(context) - .size - .height/2)*0.12, - width: MediaQuery - .of(context) - .size - .width * 0.8, - decoration: BoxDecoration( - color: Colors.grey[800], - borderRadius: BorderRadius.circular(6.0), - ), - child: Container( - padding: EdgeInsets.only(top: 10.0), - child: Text( - 'Sync Health Data' , textAlign: TextAlign.center,style: TextStyle( - color: Colors.white , fontSize: 18.0 - ), - ), - ),),), ], ), - )); + ), + ), + bottomSheet: syncHealthDataButton(), + ); } + List myOptionsList(BuildContext context) { + List medical = List(); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: HeartRateTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).heart, + imagePath: 'assets/images/SmartWatches/heartrate_icon.png', + subTitle: null, + isPngImage: true, + ), + )); - // void readLast() async { - // print("ReadLast"); - // final result = await FitKit.readLast(DataType.DISTANCE); - // print(result); - // print(result); - // } - // - // void readAll() async { - // if (await FitKit.requestPermissions(dataTypes)) { - // for (DataType type in dataTypes) { - // final results = await FitKit.read( - // type, - // dateFrom: DateTime.now().subtract(Duration(days: 7)), - // dateTo: DateTime.now(), - // limit: 100, - // ); - // print(results); - // print(results.length); - // } - // readLast(); - // } - // } -} \ No newline at end of file + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: StepsTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).steps, + imagePath: 'assets/images/SmartWatches/steps.png', + subTitle: null, + isPngImage: true, + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: DistanceTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).distance, + imagePath: 'assets/images/SmartWatches/distance.png', + subTitle: null, + isPngImage: true, + ), + )); + + return medical; + } + +// void readLast() async { +// print("ReadLast"); +// final result = await FitKit.readLast(DataType.DISTANCE); +// print(result); +// print(result); +// } +// +// void readAll() async { +// if (await FitKit.requestPermissions(dataTypes)) { +// for (DataType type in dataTypes) { +// final results = await FitKit.read( +// type, +// dateFrom: DateTime.now().subtract(Duration(days: 7)), +// dateTo: DateTime.now(), +// limit: 100, +// ); +// print(results); +// print(results.length); +// } +// readLast(); +// } +// } +} diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart new file mode 100644 index 00000000..077ed4bf --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -0,0 +1,574 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyHeartRateResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyHeartRateResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class HeartRateTracker extends StatefulWidget { + @override + _HeartRateTrackerState createState() => _HeartRateTrackerState(); +} + +class _HeartRateTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + num weeklyStatsAvgValue = 0; + num monthlyStatsAvgValue = 0; + num yearlyStatsAvgValue = 0; + + num avgWeeklyHearRateValue = 0; + num avgMonthlyHearRateValue = 0; + num avgYearlyHearRateValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyHearRateList = List(); + List monthlyHearRateList = List(); + List yearlyHearRateList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyHeartRateData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).heart, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + print(value); + if (value == 0) { + getWeeklyHeartRateData(); + } else if (value == 1) { + getMonthlyHeartRateData(); + } else { + getYearlyHeartRateData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded + ? avgWeeklyHearRateValue != 0 + ? getWeeklyHeartRateDetails() + : getNoDataWidget(context) + : Container(), + isMonthlyDataLoaded ? getMonthlyHeartRateDetails() : Container(), + isYearlyDataLoaded ? getYearlyHeartRateDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyHeartRateData() { + avgWeeklyHearRateValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyHearRateList.clear(); + res['Med_GetAvgWeekTransactionsStsList'].forEach((element) { + weekyHearRateList.add(new WeeklyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgWeeklyHearRateValue += value.toInt(); + weeklyDataLength++; + } + }); + if (weekyHearRateList.isNotEmpty) generateWeekData(); + setState(() { + if (avgWeeklyHearRateValue != 0) { + weeklyStatsAvgValue = avgWeeklyHearRateValue ~/ weeklyDataLength; + } + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyHeartRateData() { + avgMonthlyHearRateValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyHearRateList.clear(); + print(res['Med_GetAvgMonthTransactionsStsList'].length); + res['Med_GetAvgMonthTransactionsStsList'].forEach((element) { + monthlyHearRateList.add(new WeeklyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgMonthlyHearRateValue += value.toInt(); + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyHeartRateData() { + avgYearlyHearRateValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyHearRateList.clear(); + res['Med_GetYearTransactionsStsList'].forEach((element) { + yearlyHearRateList.add(new YearlyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgYearlyHearRateValue += value; + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyHearRateList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyHearRateList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyHearRateList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyHearRateList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyHearRateList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyHearRateList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).heart), + ], + ), + ); + weekyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).heart), + ], + ), + ); + monthlyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + yearlyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } +} diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index 057c6be6..17d9d8a8 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -6,9 +6,12 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:url_launcher/url_launcher.dart'; @@ -23,13 +26,12 @@ class _SmartWatchInstructionsState extends State { bool hasAlreadySynced = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - if(authenticatedUserObject.isLogin) getLastPatientRecord(context); + if (authenticatedUserObject.isLogin) getLastPatientRecord(context); }); super.initState(); } @@ -37,393 +39,233 @@ class _SmartWatchInstructionsState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "Sync Health Data", - isShowAppBar: true, - isShowDecPage: true, - description: TranslationBase.of(context).infoHealthData, - imagesInfo: [ - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') - ], - body: Container( - child: Platform.isIOS - ? _getAppleWatchInstructions() - : _getGoogleWatchInstructions(), - )); + appBarTitle: TranslationBase.of(context).smartWatches, + isShowAppBar: true, + isShowDecPage: true, + showNewAppBar: true, + showNewAppBarTitle: true, + description: TranslationBase.of(context).infoHealthData, + imagesInfo: [ + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') + ], + body: Container( + child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 30.0), + child: DefaultButton( + TranslationBase.of(context).continues, + () { + _openHealthDataList(); + }, + color: Color(0xff359846), + ), + ), + ); } _getAppleWatchInstructions() { return SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: CarouselSlider( - carouselController: buttonCarouselController, - options: CarouselOptions( - enableInfiniteScroll: false, - viewportFraction: 0.95, - height: MediaQuery.of(context).size.height * 0.9), - items: [1, 2].map((i) { - return Builder( - builder: (BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.symmetric(horizontal: 5.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white.withOpacity(1.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-1.jpeg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 1", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], ), - child: i == 1 - ? Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Supported Smartwatches", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-1.jpeg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 1", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-2.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 4", overflow: TextOverflow.clip , - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-5.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 5", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/Apple-Watch-6.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 6", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 30.0, 10.0, 10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that you have followed the instructions properly", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("CONTINUE", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - ], - ) - : Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Watch Instructions:", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 20.0, 10.0, 10.0), - child: Text( - "Before syncing data, please make sure that following instructions are met: ", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 20.0, 10.0, 10.0), - child: Text( - "1. Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "2. Make sure that your Apple Watch is connected with the Watch & Health Apps.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "3. Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 15.0, 110.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("SYNC HEALTH DATA", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - hasAlreadySynced ? Container( - margin: EdgeInsets.fromLTRB( - 15.0, 0.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - _openHealthDataList(); - }, - child: Text("ALREADY SYNCED", - style: TextStyle(fontSize: 18.0)), - ), - ), - ): Container(), - ], + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-2.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-4.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-5.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 5", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/Apple-Watch-6.png", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 6", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), ), - )); + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand4.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 30.0, 10.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); }, - ); - }).toList(), + child: Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], ), - ) + ), ], ), ); @@ -431,399 +273,283 @@ class _SmartWatchInstructionsState extends State { _getGoogleWatchInstructions() { return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: CarouselSlider( - carouselController: buttonCarouselController, - options: CarouselOptions( - // enableInfiniteScroll: true, - viewportFraction: 0.99, - height: MediaQuery.of(context).size.height*1.02 ), - items: [1, 2].map((i) { - return Builder( - builder: (BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.symmetric(horizontal: 5.0), - child: Card( - margin: EdgeInsets.only(top:16.0 , bottom: 8.0), - // fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white.withOpacity(1.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + child: Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/huawei-watch-2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/ticwatche2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mobovi TicWatch E2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/huawei-watch-2-classic.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/ticwatche2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Fossil Sport", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/misfit-vapor-2.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("MisFit Vapor 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/lg-watch-sport.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("LG Watch Sport", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand3.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand4.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + InkWell( + onTap: () { + launch("https://wearos.google.com/#find-your-watch"); + }, + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).moreSupportedWatches, style: TextStyle(fontSize: 14.0, color: Colors.blue, decoration: TextDecoration.underline, letterSpacing: -0.36)), + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); + }, + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], + ), + ), + ); + } + + showInstructionsDialog() { + 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: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 350.0, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(TranslationBase.of(context).smartWatches, style: TextStyle(fontSize: 22.0, color: Colors.black, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + IconButton( + icon: Icon( + Icons.close, + color: Colors.black, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), - child: i == 1 + Platform.isIOS ? Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Supported Smartwatches", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/huawei-watch-2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Huawei Watch 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/ticwatche2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Mobovi TicWatch E2", - overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/huawei-watch-2-classic.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Huawei Watch", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/ticwatche2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Fossil Sport", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/misfit-vapor-2.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "MisFit Vapor 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/lg-watch-sport.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "LG Watch Sport", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - InkWell( - onTap: () { - launch( - "https://wearos.google.com/#find-your-watch"); - }, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Text( - "More Supported Smartwatches...", - style: TextStyle( - fontSize: 17.0, - color: Colors.blue, - decoration: - TextDecoration.underline)), - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that you have followed the instructions properly", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("CONTINUE", - style: TextStyle(fontSize: 18.0)), - ), - ), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 21.0), + child: Text(TranslationBase.of(context).iosInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), ], ) : Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Watch Instructions:", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that following instructions are met: ", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "1. Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "2. Make sure that you have installed your watch related apps from Google PlayStore.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions4, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "3. Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "4. Make sure that your smart watch apps are linked/associated with Google Fit App.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 15.0, 75.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("SYNC HEALTH DATA", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - hasAlreadySynced ? Container( - margin: EdgeInsets.fromLTRB( - 15.0, 0.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - _openHealthDataList(); - }, - child: Text("ALREADY SYNCED", - style: TextStyle(fontSize: 18.0)), - ), - ), - ) : Container(), ], ), - )); - }, - ); - }).toList(), + ], + ), + ), + ], + ), + ), ), - ) - ], - ), - ); + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); } getLastPatientRecord(BuildContext context) { @@ -848,6 +574,10 @@ class _SmartWatchInstructionsState extends State { _openHealthDataList() { Navigator.push( - context, MaterialPageRoute(builder: (context) => HealthDataList())); + context, + FadePage( + page: HealthDataList(), + ), + ); } } diff --git a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart new file mode 100644 index 00000000..5f63c2ad --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart @@ -0,0 +1,566 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyStepsResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsTracker extends StatefulWidget { + @override + _StepsTrackerState createState() => _StepsTrackerState(); +} + +class _StepsTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + int weeklyStatsAvgValue = 0; + int monthlyStatsAvgValue = 0; + int yearlyStatsAvgValue = 0; + + int avgWeeklyStepsValue = 0; + int avgMonthlyStepsValue = 0; + int avgYearlyStepsValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyStepsList = List(); + List monthlyStepsList = List(); + List yearlyStepsList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyStepsData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).steps, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + if (value == 0) { + getWeeklyStepsData(); + } else if (value == 1) { + getMonthlyStepsData(); + } else { + getYearlyStepsData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded ? getWeeklyStepsDetails() : Container(), + isMonthlyDataLoaded ? getMonthlyStepsDetails() : Container(), + isYearlyDataLoaded ? getYearlyStepsDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyStepsData() { + avgWeeklyStepsValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyStepsList.clear(); + res['Med_GetWeekStepsTransactionsStsList'].forEach((element) { + weekyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgWeeklyStepsValue += value.toInt(); + weeklyDataLength++; + } + }); + generateWeekData(); + setState(() { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyStepsData() { + avgMonthlyStepsValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyStepsList.clear(); + res['Med_GetMonthStepsTransactionsStsList'].forEach((element) { + monthlyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgMonthlyStepsValue += value.toInt(); + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyStepsData() { + avgYearlyStepsValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + num value = element['ValueSum']; + avgYearlyStepsValue += value.toInt(); + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyStepsList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyStepsList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyStepsList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyStepsList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? double.tryParse(element.valueSum.toString()) : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + yearlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + weekyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.value.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + monthlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.value.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } +} diff --git a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart deleted file mode 100644 index 3fe1a4ba..00000000 --- a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart +++ /dev/null @@ -1,249 +0,0 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; -import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class StepsTracker extends StatefulWidget { - @override - _StepsTrackerState createState() => _StepsTrackerState(); -} - -class _StepsTrackerState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - - int weeklyStatsAvgValue = 0; - int monthlyStatsAvgValue = 0; - int yearlyStatsAvgValue = 0; - - int avgStepsValue = 0; - int dataLength = 0; - - List yearlyStepsList = List(); - - List yearlyTimeSeriesData = []; - - bool isDataLoaded = false; - - @override - void initState() { - _tabController = new TabController(length: 3, vsync: this); - WidgetsBinding.instance.addPostFrameCallback((_) { - getYearlyStepsData(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: "Steps", - isShowDecPage: false, - body: Container( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TabBar( - tabs: [ - Tab(text: TranslationBase.of(context).weekly), - Tab(text: TranslationBase.of(context).monthly), - Tab(text: TranslationBase.of(context).yearly), - ], - controller: _tabController, - ), - Expanded( - child: new TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - isDataLoaded ? getWeeklyStepsDetails() : Container(), - isDataLoaded ? getMonthlyStepsDetails() : Container(), - isDataLoaded ? getYearlyStepsDetails() : Container() - ], - controller: _tabController, - ), - ), - ], - ), - ), - ); - } - - getYearlyStepsData() { - avgStepsValue = 0; - dataLength = 0; - - DoctorsListService service = new DoctorsListService(); - GifLoaderDialogUtils.showMyDialog(context); - service.getPatientHealthDataStats(6, 3, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - print(res['Med_GetYearStepsTransactionsStsList']); - yearlyStepsList.clear(); - res['Med_GetYearStepsTransactionsStsList'].forEach((element) { - print('in forEach'); - yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); - if (element['ValueSum'] != null) { - double value = element['ValueSum']; - avgStepsValue += value.toInt(); - dataLength++; - } - }); - print("innnnnnnnnnnnnnnnn"); - print(avgStepsValue); - print(dataLength); - setState(() { - yearlyStatsAvgValue = avgStepsValue ~/ dataLength; - isDataLoaded = true; - }); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - // AppToast.showErrorToast(message: err); - print(err); - }); - } - - generateData() { - if (yearlyStepsList.length > 0) { - yearlyTimeSeriesData.clear(); - yearlyStepsList.forEach( - (element) { - yearlyTimeSeriesData.add( - TimeSeriesSales( - new DateTime(element.year, element.month, 1), - element.valueSum != null ? element.valueSum.toInt() : 0, - ), - ); - }, - ); - yearlyTimeSeriesData.forEach((element) { - print(element.sales); - print(element.time); - }); - } - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (TimeSeriesSales sales, _) => sales.time, - measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: yearlyTimeSeriesData, - ) - ]; - } - - getWeeklyStepsDetails() { - return Container( - child: Text("Weekly"), - ); - } - - getMonthlyStepsDetails() { - return Container( - child: Text("Monthly"), - ); - } - - getYearlyStepsDetails() { - return Container( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - child: AppTimeSeriesChart( - seriesList: generateData(), - chartName: "Steps", - startDate: DateTime( - yearlyStepsList[0].year, yearlyStepsList[0].month, 1), - endDate: DateTime( - yearlyStepsList[yearlyStepsList.length - 1].year, - yearlyStepsList[yearlyStepsList.length - 1].month, - 1), - ), - ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), - child: - Text("Average Steps", style: TextStyle(fontSize: 18.0)), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Text(yearlyStatsAvgValue.toString() + " Steps", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Container( - transform: Matrix4.translationValues(0.0, -10.0, 0.0), - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("History", style: TextStyle(fontSize: 14.0)), - Row( - children: [ - Text("view more", style: TextStyle(fontSize: 14.0)), - Container( - margin: EdgeInsets.only(left: 3.0, right: 3.0), - transform: Matrix4.translationValues(0.0, 1.5, 0.0), - width: 30.0, - height: 30.0, - child: Image.asset( - "assets/images/new-design/view_more.png", - fit: BoxFit.contain), - ), - ], - ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), - child: Text("Date", - style: TextStyle( - fontSize: 18.0, fontWeight: FontWeight.bold)), - ), - Container( - padding: EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 0.0), - child: Text("Steps", style: TextStyle(fontSize: 18.0)), - ), - ], - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart new file mode 100644 index 00000000..ac497ba4 --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -0,0 +1,276 @@ +import 'package:collection/collection.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; +import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:fit_kit/fit_kit.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class syncHealthDataButton extends StatefulWidget { + double marginTop; + + double hight; + + double minWidth; + + syncHealthDataButton({this.marginTop, this.hight, this.minWidth}); + + @override + _syncHealthDataButtonState createState() => _syncHealthDataButtonState(); +} + +class _syncHealthDataButtonState extends State { + List dataTypes = List(); + + List Med_InsertTransactionsInputsList = new List(); + List Med_InsertTransactionsInputsList2 = new List(); + + List sleepDataList = new List(); + + List healthDataList = new List(); + + int TransactionsListID = 1; + + int MedCategoryID = 0; + + @override + void initState() { + dataTypes.add(DataType.DISTANCE); + dataTypes.add(DataType.STEP_COUNT); + dataTypes.add(DataType.HEART_RATE); + // dataTypes.add(DataType.SLEEP); + // dataTypes.add(DataType.ENERGY); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton(TranslationBase.of(context).syncHealthData, () { + print("ReadAll"); + readAll(); + }), + ), + ); + } + + void readAll() async { + TransactionsListID = 1; + var MedSubCategoryID = 0; + double value = 0.0; + + GifLoaderDialogUtils.showMyDialog(context); + Med_InsertTransactionsInputsList.clear(); + var date; + var differenceInHours; + String strDifferenceInHours; + var differenceInMinutes; + String strDifferenceInMinutes; + var today = DateTime.now(); + var yearNum = DateFormat('y').format(today).toString(); + + var firstDayOfTheYear = DateTime.parse(yearNum + "-" + "01" + "-" + "01"); + + if (await FitKit.requestPermissions(dataTypes)) { + for (DataType type in dataTypes) { + final results = await FitKit.read( + type, + dateFrom: firstDayOfTheYear, + dateTo: DateTime.now(), + limit: 1000, + ); + + if (type == DataType.DISTANCE) { + MedCategoryID = 7; + } else if (type == DataType.STEP_COUNT) { + MedCategoryID = 6; + } else if (type == DataType.HEART_RATE) { + MedCategoryID = 3; + } + + results.forEach((result) { + // print("in forEach"); + date = result.dateTo; + if (result.value.runtimeType.toString() == "int") { + value = double.parse(result.value.toString()); + } else { + value = result.value; + } + + MedSubCategoryID = 0; + + if (MedCategoryID == 4) { + differenceInHours = null; + var sleepDate = result.dateFrom.toString().substring(0, 10); + + DateTime dateFrom = result.dateFrom; + DateTime dateTo = result.dateTo; + + differenceInMinutes = dateTo.difference(dateFrom).inMinutes; + differenceInMinutes > 59 ? differenceInHours = differenceInMinutes / 60 : differenceInMinutes = differenceInMinutes; + + if (differenceInHours != null && differenceInHours != 0) { + differenceInHours = differenceInHours.toInt(); + differenceInMinutes = differenceInMinutes % 60; + + differenceInHours < 10 ? strDifferenceInHours = "0" + differenceInHours.toString() : strDifferenceInHours = differenceInHours.toString(); + } else { + strDifferenceInHours = "00"; + differenceInHours = 00; + } + differenceInMinutes < 10 ? strDifferenceInMinutes = "0" + differenceInMinutes.toString() : strDifferenceInMinutes = differenceInMinutes.toString(); + + sleepDate = DateTime.parse(sleepDate + " " + strDifferenceInHours + ":" + strDifferenceInMinutes + ":" + "00.00").toString(); + String hours = sleepDate.substring(11, sleepDate.indexOf(":")); + print(hours); + + String minutes = sleepDate.substring(sleepDate.indexOf(":") + 1, sleepDate.indexOf(":") + 3); + print(minutes); + + if (value == 0 || value == 109) { + print("in Bed"); + MedSubCategoryID = 1; + value = double.parse(hours + "." + minutes); + print("value"); + print(value); + } else if (value == 1 || value == 110) { + print("Sleep"); + MedSubCategoryID = 2; + value = double.parse(hours + "." + minutes); + print("value"); + print(value); + } + } + date = DateUtil.convertDateToString(date); + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++, Notes: "")); + }); + } + } + getAllHealthDataLists(); + } + + void getAllHealthDataLists() { + var totalSteps = 0.0; + var totalDistance = 0.0; + // double totalCalories = 0.0 ; + double totalHeartRate = 0.0; + double avgTotalHeartRate = 0.0; + var counter = 0; + List data = []; + TransactionsListID = 1; + + DateTime date; + sleepDataList.clear(); + + Med_InsertTransactionsInputsList.forEach((result) { + data.add(result.toJson()); + }); + + Med_InsertTransactionsInputsList2.clear(); + + var newMap = groupBy(data, (obj) => DateUtil.convertStringToDate(obj['MachineDate']).toString().substring(0, 10)); + + newMap.forEach((key, value) { + totalSteps = 0.0; + totalDistance = 0.0; + totalHeartRate = 0.0; + avgTotalHeartRate = 0.0; + counter = 0; + + date = DateTime.parse(key); + + value.forEach((element) { + if (element['MedCategoryID'] == 6) { + MedCategoryID = 6; + + totalSteps += element['Value']; + } else if (element['MedCategoryID'] == 7) { + MedCategoryID = 7; + // to convert from meter to km + totalDistance += (element['Value'] * 0.001); + } else if (element['MedCategoryID'] == 3) { + print("HeartRate"); + MedCategoryID = 3; + counter++; + totalHeartRate += element['Value']; + } else if (element['MedCategoryID'] == 4) { + print("sleeeeep"); + sleepDataList.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + + Med_InsertTransactionsInputsList2.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + } + // else if(element['MedCategoryID'] == 8){ + // + // totalCalories += element['Value'] ; + // } + }); + + if (counter == 0) { + counter = 1; + } + if (totalHeartRate == 0) { + avgTotalHeartRate = 0; + } else { + avgTotalHeartRate = totalHeartRate / counter; + } + + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + }); + + addInsertTransactionsInputsList(); + + GifLoaderDialogUtils.hideDialog(context); + + // AlertDialogBox dialog = new AlertDialogBox( + // context: context, + // confirmMessage: TranslationBase.of(context).alreadySynced, + // okText: TranslationBase.of(context).ok, + // okFunction: () => { + // AlertDialogBox.closeAlertDialog(context), + // }, + // ); + + // dialog.showAlertDialog(context); + } + + addInsertTransactionsInputsList() { + if (Med_InsertTransactionsInputsList2.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + SmartWatchIntegrationService service = new SmartWatchIntegrationService(); + service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } else { + return; + } + } +} diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart index e62a300a..12cfa026 100644 --- a/lib/pages/medical/vital_sign/LineChartCurved.dart +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; @@ -8,14 +9,17 @@ class LineChartCurved extends StatelessWidget { final String title; final List timeSeries; final int indexes; + final double horizontalInterval; - LineChartCurved({this.title, this.timeSeries, this.indexes}); + LineChartCurved({this.title, this.timeSeries, this.indexes, this.horizontalInterval = 20.0}); List xAxixs = List(); List yAxixs = List(); double minY = 0; double maxY = 0; + double intialY = 0; + double lastY = 0; double minX = 0; double maxX = 0; @@ -25,6 +29,7 @@ class LineChartCurved extends StatelessWidget { Widget build(BuildContext context) { getXaxix(); getYaxix(); + getInitialY(); calculateMaxAndMin(); return AspectRatio( aspectRatio: 1.0, @@ -38,18 +43,20 @@ class LineChartCurved extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const SizedBox( - height: 4, - ), - Text( - title, - style: TextStyle( - color: Colors.black, - fontSize: 15, - letterSpacing: 2), - textAlign: TextAlign.center, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Text( + title, + style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600), + textAlign: TextAlign.center, + ), + ), + ], ), - SizedBox(height: 10,), + mHeight(10), Expanded( child: Padding( padding: const EdgeInsets.only(right: 18.0, left: 16.0), @@ -93,13 +100,11 @@ class LineChartCurved extends StatelessWidget { lineTouchData: LineTouchData( touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, - ), touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -107,7 +112,7 @@ class LineChartCurved extends StatelessWidget { color: Colors.black, fontSize: 10, ), - rotateAngle:-65, + rotateAngle: -65, margin: 22, getTitles: (value) { if (timeSeries.length < 15) { @@ -116,10 +121,8 @@ class LineChartCurved extends StatelessWidget { } else return ''; } else { - if (value.toInt() == 0) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (value.toInt() == timeSeries.length - 1) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; if (xAxixs.contains(value.toInt())) { return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; } @@ -134,8 +137,7 @@ class LineChartCurved extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 10, ), - interval:getMaxY() - getMinY() <=500?getMaxY() - getMinY() <=50?10:50:getMaxY() - getMinY() <=1000?100:getMaxY() - getMinY()>=10000?5000:200, - + interval: 3.0, margin: 12, ), ), @@ -159,48 +161,66 @@ class LineChartCurved extends StatelessWidget { ), minX: minX, maxX: maxX, - maxY: maxY, - minY: 0, + maxY: lastY + 1, + minY: intialY - 0.5, lineBarsData: getData(context), ); } - calculateMaxAndMin(){ + calculateMaxAndMin() { getMaxY(); getMaxX(); getMin(); getMinY(); - increasingY = ((maxY-minY)/timeSeries.length - 1)*15; + increasingY = ((maxY - minY) / timeSeries.length - 1) * 15; maxY += increasingY.abs(); minY -= increasingY.abs(); } double getMaxY() { - maxY = 0; + maxY = 0; timeSeries.forEach((element) { double resultValueDouble = element.sales; - if (resultValueDouble > maxY) maxY = resultValueDouble; + if (resultValueDouble > maxY) { + lastY = resultValueDouble; + maxY = resultValueDouble; + } }); + print("maxY " + lastY.toString()); + return maxY.roundToDouble(); + } + + double getInitialY() { + try { + intialY = timeSeries.first.sales; + timeSeries.forEach((element) { + double resultValueDouble = element.sales; + if (resultValueDouble < intialY) intialY = resultValueDouble; + }); + } catch (e) { + intialY = 0; + } - return maxY.roundToDouble() ; + print("minY " + intialY.toString()); + return intialY.roundToDouble(); } - getMaxX(){ + getMaxX() { maxX = (timeSeries.length - 1).toDouble(); } - double getMin(){ - minX = 0; + double getMin() { + minX = 0; timeSeries.forEach((element) { double resultValueDouble = element.sales; if (resultValueDouble < minX) minX = resultValueDouble; }); - return minX.roundToDouble() ; + return minX.roundToDouble(); } double getMinY() { - minY = 0; + minY = 0; timeSeries.forEach((element) { double resultValueDouble = element.sales; if (resultValueDouble < minY) minY = resultValueDouble; @@ -220,7 +240,7 @@ class LineChartCurved extends StatelessWidget { spots: spots, isCurved: true, colors: [secondaryColor], - barWidth: 3, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, diff --git a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart index e656d60e..b4afebad 100644 --- a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart +++ b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart @@ -1,6 +1,7 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; @@ -10,8 +11,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { final List timeSeries2; final int indexes; - LineChartCurvedBloodPressure( - {this.title, this.timeSeries1, this.indexes, this.timeSeries2}); + LineChartCurvedBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2}); List xAxixs = List(); List yAxixs = List(); @@ -32,21 +32,30 @@ class LineChartCurvedBloodPressure extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const SizedBox( - height: 15, + height: 12, ), - Text( - title, - style: TextStyle( - color: Colors.black, fontSize: 15, letterSpacing: 2), - textAlign: TextAlign.center, + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + ), + child: Text( + title, + style: TextStyle( + color: Colors.black, + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + textAlign: TextAlign.start, + ), ), SizedBox( height: 10, ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -63,32 +72,53 @@ class LineChartCurvedBloodPressure extends StatelessWidget { Row( children: [ Container( - width: 20, - height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Theme.of(context).primaryColor), + width: 16, + height: 16, + decoration: containerRadius(Theme.of(context).primaryColor, 100), + ), + SizedBox( + width: 5, + ), + Text( + TranslationBase.of(context).systolicLng, + style: TextStyle( + color: Colors.black, + fontSize: 12, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), ), - SizedBox(width: 5,), - Texts(TranslationBase.of(context).systolicLng) ], ), - SizedBox(width: 15,), + SizedBox( + width: 15, + ), Row( children: [ Container( - width: 20, - height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.red), + width: 16, + height: 16, + decoration: containerRadius(CustomColors.accentColor, 100), + ), + SizedBox( + width: 5, + ), + Text( + TranslationBase.of(context).diastolicLng, + style: TextStyle( + color: Colors.black, + fontSize: 12, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), ), - SizedBox(width: 5,), - Texts(TranslationBase.of(context).diastolicLng) ], ), ], - ) + ), + const SizedBox( + height: 12, + ), ], ), ], @@ -115,8 +145,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -133,10 +162,8 @@ class LineChartCurvedBloodPressure extends StatelessWidget { } else return ''; } else { - if (value.toInt() == 0) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; - if (value.toInt() == timeSeries1.length - 1) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == 0) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; if (xAxixs.contains(value.toInt())) { return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; } @@ -151,8 +178,11 @@ class LineChartCurvedBloodPressure extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 10, ), - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, - + interval: getMaxY() - getMinY() <= 500 + ? 50 + : getMaxY() - getMinY() <= 1000 + ? 100 + : 200, margin: 12, ), ), @@ -177,7 +207,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { minX: 0, maxX: (timeSeries1.length - 1).toDouble(), maxY: getMaxY() + 15, - minY: getMinY()-15, + minY: getMinY() - 15, lineBarsData: getData(context), ); } @@ -227,7 +257,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { spots: spots, isCurved: true, colors: [Colors.red], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, @@ -240,7 +270,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { spots: spots2, isCurved: true, colors: [Theme.of(context).primaryColor], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, diff --git a/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart index e28b52e1..45bdd40e 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class VitalSignBloodPressureWidget extends StatefulWidget { diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index 9f7b0f6d..b7da4fa2 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -1,16 +1,18 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/vital_sign_view_model.dart'; +import 'package:diplomaticquarterapp/models/vital_sign.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item_details_screen.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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 '../../../d_q_icons_icons.dart'; +import 'package:flutter_svg/svg.dart'; class VitalSignDetailsScreen extends StatelessWidget { static const String url = "assets/images/"; @@ -18,185 +20,250 @@ class VitalSignDetailsScreen extends StatelessWidget { int appointmentNo; int projectID; bool isNotOneAppointment; - VitalSignDetailsScreen({this.appointmentNo, this.projectID,this.isNotOneAppointment=true}); + + VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); + List imagesInfo = List(); + List vitalSigns = []; + initList(BuildContext context, VitalSignViewModel mode) { + vitalSigns.clear(); + vitalSigns.add(new VitalSign(TranslationBase.of(context).height, mode.heightCm, TranslationBase.of(context).cm, "assets/images/new/height.svg")); + vitalSigns.add(new VitalSign(TranslationBase.of(context).weight, mode.weightKg, TranslationBase.of(context).kg, "assets/images/new/weight.svg")); + // vitalSigns.add(new VitalSign(TranslationBase.of(context).body, mode.bodyMax, TranslationBase.of(context).mass, "assets/images/new/")); + vitalSigns.add(new VitalSign(TranslationBase.of(context).temperature, mode.temperatureCelcius, TranslationBase.of(context).tempC, "assets/images/new/temperature.svg")); + vitalSigns.add(new VitalSign(TranslationBase.of(context).heart, mode.hartRat, TranslationBase.of(context).bpm, "assets/images/new/heart_rate.svg")); + vitalSigns.add(new VitalSign(TranslationBase.of(context).respirationRate, mode.respirationBeatPerMinute, TranslationBase.of(context).respirationBPM, "assets/images/new/respiration_rate.svg")); + vitalSigns.add(new VitalSign(TranslationBase.of(context).bloodPressure, mode.bloodPressure, TranslationBase.of(context).sysDias, "assets/images/new/blood_pressure.svg")); + } @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png')); - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png')); + imagesInfo.add(ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png')); return BaseView( - onModelReady: appointmentNo != null && projectID != null - ? (model) => model.getPatientVitalSign( - appointmentNo: appointmentNo, projectID: projectID) - : (model) => model.getPatientVitalSign(), - builder: (_, mode, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).vitalSigns, - baseViewModel: mode, - description: TranslationBase.of(context).infoSigns, - imagesInfo: imagesInfo, - body: mode.vitalSignResModelList.length > 0 - ? Container( - child: ListView( - children: [ - Row( - children: [ - InkWell( - onTap: () =>isNotOneAppointment? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.Height, - pageTitle: TranslationBase.of(context).height, - vitalList: mode.vitalSignResModelList, - ), - ), - ):null, - child: Container( - child: VitalSignItem( - des: TranslationBase.of(context).height, - icon: DQIcons.height, - lastVal: mode.heightCm, - unit: TranslationBase.of(context).cm, - ), - ), - ), - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.Weight, - pageTitle: TranslationBase.of(context).weight, - vitalList: mode.vitalSignResModelList, - ), - ), - ):null, - child: VitalSignItem( - des: TranslationBase.of(context).weight, - icon: DQIcons.weight_scale, - unit: TranslationBase.of(context).kg, - lastVal: mode.weightKg, - ), - ), - ], - ), - Row( - children: [ - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.BodyMeasurements, - pageTitle: TranslationBase.of(context) - .bodyMeasurements, - vitalList: mode.vitalSignResModelList, - ), - ), - ): null, - child: VitalSignItem( - des: TranslationBase.of(context).body, - icon: DQIcons.bmi, - lastVal: mode.bodyMax, - unit: TranslationBase.of(context).mass, - ), - ), - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.Temperature, - pageTitle: - TranslationBase.of(context).temperature, - vitalList: mode.vitalSignResModelList, - ), - ), - ):null, - child: Container( - child: VitalSignItem( - des: TranslationBase.of(context).temperature, - icon: DQIcons.thermometer, - lastVal: mode.temperatureCelcius, - unit: TranslationBase.of(context).tempC, - ), - ), - ), - ], - ), - Row( - children: [ - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.heart, - pageTitle: TranslationBase.of(context).heart, - vitalList: mode.vitalSignResModelList, - ), + onModelReady: appointmentNo != null && projectID != null ? (model) => model.getPatientVitalSign(appointmentNo: appointmentNo, projectID: projectID) : (model) => model.getPatientVitalSign(), + builder: (_, mode, widget) { + initList(context, mode); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).vitalSigns, + baseViewModel: mode, + description: TranslationBase.of(context).infoSigns, + imagesInfo: imagesInfo, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xFFF7F7F7), + body: mode.vitalSignResModelList.length > 0 + ? Container( + width: double.infinity, + child: ListView( + children: [ + Container( + child: Container( + margin: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 6), + decoration: cardRadius(12), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bodyMassIndex + mode.bodyMax, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(20), + Container( + height: MediaQuery.of(context).size.width / 2.8, + child: Row( + children: [ + showMass(context, TranslationBase.of(context).underWeight, "< 18.5", double.parse(mode.bodyMax) <= 18.5 ? Colors.red : Colors.black, 8), + mWidth(12), + showMass(context, TranslationBase.of(context).healthy, "18.5 - 24.9", (double.parse(mode.bodyMax) > 18.5 && double.parse(mode.bodyMax) < 25) ? Colors.red : Colors.black, 6), + mWidth(12), + showMass(context, TranslationBase.of(context).overWeight, "25 - 29.9", (double.parse(mode.bodyMax) >= 25 && double.parse(mode.bodyMax) < 30) ? Colors.red : Colors.black, 4), + mWidth(12), + showMass(context, TranslationBase.of(context).obese, "30 - 34.9", (double.parse(mode.bodyMax) >= 30 && double.parse(mode.bodyMax) < 35) ? Colors.red : Colors.black, 2), + mWidth(12), + showMass(context, TranslationBase.of(context).extremeObese, "> 35", (double.parse(mode.bodyMax) >= 35) ? Colors.red : Colors.black, 0), + ], + ), + ), + ], ), - ):null, - child: VitalSignItem( - des: TranslationBase.of(context).heart, - icon: DQIcons.heart, - lastVal: mode.hartRat, - unit: TranslationBase.of(context).bpm, ), ), - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.Respiration, - pageTitle: - TranslationBase.of(context).respirationRate, - vitalList: mode.vitalSignResModelList, - ), - ), - ):null, - child: VitalSignItem( - des: TranslationBase.of(context).respirationRate, - icon: DQIcons.outline, - lastVal: mode.respirationBeatPerMinute, - unit: TranslationBase.of(context).bpm, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: () => isNotOneAppointment ? Navigator.push( - context, - FadePage( - page: VitalSignItemDetailsScreen( - pageKey: VitalSignDetails.BloodPressure, - pageTitle: TranslationBase.of(context).bloodPressure, - vitalList: mode.vitalSignResModelList, + ), + mHeight(2), + Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 16), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + itemCount: vitalSigns.length, + padding: EdgeInsets.all(4), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + if (index == 0) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.Height, + pageTitle: TranslationBase.of(context).height, + vitalList: mode.vitalSignResModelList, + ), + ), + ); + } + } else if (index == 1) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.Weight, + pageTitle: TranslationBase.of(context).weight, + vitalList: mode.vitalSignResModelList, + ), + ), + ); + } + } else if (index == 2) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.Temperature, + pageTitle: + TranslationBase.of(context).temperature, + vitalList: mode.vitalSignResModelList, + + ), + ), + ); + } + } else if (index == 3) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.heart, + pageTitle: TranslationBase.of(context).heart, + vitalList: mode.vitalSignResModelList, + + ), + ), + ); + } + } else if (index == 4) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.Respiration, + pageTitle: + TranslationBase.of(context).respirationRate, + vitalList: mode.vitalSignResModelList, + + ), + ), + ); + } + } else if (index == 5) { + if (isNotOneAppointment) { + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: VitalSignDetails.BloodPressure, + pageTitle: TranslationBase.of(context).bloodPressure, + vitalList: mode.vitalSignResModelList, + ), + ), + ); + } + } + }, + child: VitalSignItem( + vitalSign: vitalSigns[index], ), - ), - ):null, - child: VitalSignItem( - des: TranslationBase.of(context).bloodPressure, - icon: DQIcons.blood_pressure, - lastVal: mode.bloodPressure, - unit: TranslationBase.of(context).sysDias, - ), + ); + }, ), - ], - ), - ], + ), + ], + ), + ) + : Center( + child: Texts('No Data'), ), - ) - : Center( - child: Texts('No Data'), + ); + }, + ); + } + + Widget showMass(BuildContext context, String title, String weight, Color color, int f) { + return Expanded( + flex: 1, + child: Container( + height: double.infinity, + width: double.infinity, + child: Column( + children: [ + Flexible( + child: Row( + children: [ + mFlex(f), + Flexible( + flex: 10, + child: SvgPicture.asset( + "assets/images/new/mass/health_BMI.svg", + height: double.infinity, + width: double.infinity, + fit: BoxFit.fill, + color: color, + ), + ), + mFlex(f), + ], + ), + ), + mHeight(20), + AutoSizeText( + title, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + color: color, + fontSize: 10, + letterSpacing: -0.6, + ), + ), + AutoSizeText( + weight, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + color: color, + fontSize: 10, + letterSpacing: -0.6, ), + ) + ], + ), ), ); } diff --git a/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart b/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart index 113e29a6..048f30f0 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_wideget.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class VitalSignDetailsWidget extends StatefulWidget { diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index 1cad714e..1549db39 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -1,94 +1,87 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/models/vital_sign.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class VitalSignItem extends StatelessWidget { - const VitalSignItem( - {Key key, - @required this.des, - this.lastVal = 'N/A', - this.unit = '', - this.height, - this.width, - @required this.icon}) - : super(key: key); + const VitalSignItem({ + Key key, + @required this.vitalSign, + this.height, + this.width, + }) : super(key: key); - final String des; - final String lastVal; - final String unit; - final IconData icon; final double height; final double width; + final VitalSign vitalSign; @override Widget build(BuildContext context) { return RoundedContainer( - margin: 0.025 * SizeConfig.realScreenWidth, - height: 0.15 * SizeConfig.realScreenHeight, - width: 0.45 * SizeConfig.realScreenWidth, + margin: 0, + height: double.infinity, + width: double.infinity, child: Container( - padding: EdgeInsets.all(5), + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: 0.10 * SizeConfig.realScreenHeight, - child: Row( - children: [ - Expanded( - flex: 2, - child: Align( - alignment: Alignment.topLeft, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - des, - style: TextStyle( - fontSize: 1.7 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), - fontWeight: FontWeight.bold, - ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AutoSizeText( + vitalSign.lastVal ?? 'N/A', + minFontSize: 10, + maxLines: 1, + style: TextStyle( + fontSize: 15, + color: Color(0xff2B353E), + letterSpacing: -0.45, + fontWeight: FontWeight.bold, ), ), - ), - ), - Expanded( - flex: 1, - child: Container( - child: Icon( - icon, - size: 40, + Text( + vitalSign.unit ?? "", + style: TextStyle( + fontSize: 9, + letterSpacing: -0.27, + color: CustomColors.accentColor, + fontWeight: FontWeight.w600, + ), ), - ), - ) - ], - ), - ), - Expanded( - child: Container( - width: double.infinity, - child: Align( - alignment: Alignment.topRight, - child: Container( - margin: EdgeInsets.only(left: 5, right: 5), - child: RichText( - text: TextSpan( - style: TextStyle(color: Colors.black), - children: [ - TextSpan(text: lastVal), - TextSpan( - text: " " + unit, - style: TextStyle( - color: HexColor('#B8382C'), - ), - ), - ]), - ), + ], ), ), - ), + mWidth(4), + Container( + width: MediaQuery.of(context).size.width / 16, + height: MediaQuery.of(context).size.width / 16, + child: SvgPicture.asset( + vitalSign.icon, + color: Color(0xff2E303A), + ), + ), + ], ), + mFlex(1), + AutoSizeText( + vitalSign.des, + minFontSize: 8, + maxLines: 2, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.33, + height: 1, + fontWeight: FontWeight.w600, + ), + ) ], ), ), diff --git a/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart index 6db865b6..c3c85160 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item_details_screen.dart @@ -30,7 +30,6 @@ class VitalSignItemDetailsScreen extends StatelessWidget { 'title2Ar': 'الكتلة', 'viewKey': 'BodyMassIndex', }, - ]; break; @@ -86,7 +85,6 @@ class VitalSignItemDetailsScreen extends StatelessWidget { 'title3Ar': 'الإنبساط', 'viewKey': 'BloodPressure', }, - ]; break; @@ -161,31 +159,33 @@ class VitalSignItemDetailsScreen extends StatelessWidget { return AppScaffold( appBarTitle: pageTitle, isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + body: ListView( children: VSchart.map((chartInfo) { var vitalListTemp = vitalList.where( (element) => element.toJson()[chartInfo['viewKey']] != null, ); - if(vitalListTemp.length != 0 && chartInfo['viewKey']=='BloodPressure'){ + if (vitalListTemp.length != 0 && chartInfo['viewKey'] == 'BloodPressure') { return VitalSingChartBloodPressure( - vitalList: vitalList, - name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], - title1: chartInfo['title1'], - title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], - title3:projectViewModel.isArabic?chartInfo['title3Ar']: chartInfo['title3'], - viewKey1: 'BloodPressureHigher', - viewKey2: 'BloodPressureLower', - + vitalList: vitalList, + name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'], + title1: chartInfo['title1'], + title2: projectViewModel.isArabic ? chartInfo['title2Ar'] : chartInfo['title2'], + title3: projectViewModel.isArabic ? chartInfo['title3Ar'] : chartInfo['title3'], + viewKey1: 'BloodPressureHigher', + viewKey2: 'BloodPressureLower', ); } return vitalListTemp.length != 0 ? VitalSingChartAndDetials( vitalList: vitalList, - name:projectViewModel.isArabic? chartInfo['nameAr']:chartInfo['name'], + name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'], title1: chartInfo['title1'], - title2:projectViewModel.isArabic?chartInfo['title2Ar']: chartInfo['title2'], + title2: projectViewModel.isArabic ? chartInfo['title2Ar'] : chartInfo['title2'], viewKey: chartInfo['viewKey']) : Container(); }).toList(), diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index b09a579d..3211755c 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -1,15 +1,18 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_wideget.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/charts/app_time_series_chart.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/sync_fu_chart.dart'; import 'package:flutter/material.dart'; - -import 'package:charts_flutter/flutter.dart' as charts; +import 'package:provider/provider.dart'; import 'LineChartCurved.dart'; -class VitalSingChartAndDetials extends StatelessWidget { +class VitalSingChartAndDetials extends StatefulWidget { VitalSingChartAndDetials({ Key key, @required this.vitalList, @@ -24,38 +27,117 @@ class VitalSingChartAndDetials extends StatelessWidget { final String viewKey; final String title1; final String title2; + + @override + _VitalSingChartAndDetialsState createState() => _VitalSingChartAndDetialsState(); +} + +class _VitalSingChartAndDetialsState extends State { List timeSeriesData = []; + bool isExpended = true; + ProjectViewModel projectViewModel; + + @override + void initState() { + // TODO: implement initState + super.initState(); + generateData(); + } @override Widget build(BuildContext context) { - generateData(); - return Column( - children: [ - AppExpandableNotifier( - isExpand: true, - headerWidget: LineChartCurved(title: name,timeSeries:timeSeriesData,indexes: timeSeriesData.length~/5.5,), - bodyWidget: VitalSignDetailsWidget( - vitalList: vitalList, - title1: title1, - title2: title2, - viewKey: viewKey, + projectViewModel = Provider.of(context); + return SingleChildScrollView( + child: Column( + children: [ + Container( + height: 400, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + title: widget.name, + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + // child: SyncFuChart(), + ), ), - ), - ], + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).graphDetails, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + Table( + columnWidths: { + 0: FlexColumnWidth(2), + 1: FlexColumnWidth(1), + // 2: FlexColumnWidth(1), + }, + children: fullData(widget.vitalList, context), + ), + ], + ), + ), + ) + ], + ), ); } + List fullData(List labResultList, context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(widget.title1), + Utils.tableColumnTitle(widget.title2), + // Utils.tableColumnTitle(TranslationBase.of(context).range), + ], + ), + ); + + for (int i = 0; i < labResultList.length; i++) { + var data = labResultList[i].toJson()[widget.viewKey]; + if (data != 0) + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + "${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate.weekday)}, ${labResultList[i].vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate.month) : DateUtil.getMonth(labResultList[i].vitalSignDate.month)}, ${labResultList[i].vitalSignDate.year}", + isLast: i == (labResultList.length - 1)), + Utils.tableColumnValue('${labResultList[i].toJson()[widget.viewKey]}', isLast: i == (labResultList.length - 1)), + ], + ), + ); + } + + return tableRow; + } + generateData() { - if (vitalList.length > 0) { - vitalList.reversed.toList().forEach( - (element) { - if( element.toJson()[viewKey]!=null && element.toJson()[viewKey]?.toInt()!=0) - timeSeriesData.add( - TimeSeriesSales2( - new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), - element.toJson()[viewKey].toDouble(), - ), - ); + if (widget.vitalList.length > 0) { + widget.vitalList.reversed.toList().forEach( + (element) { + if (element.toJson()[widget.viewKey] != null && element.toJson()[widget.viewKey]?.toInt() != 0) + timeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), + element.toJson()[widget.viewKey].toDouble(), + ), + ); }, ); } diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart index 84a2eb51..424b0c90 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart @@ -1,13 +1,13 @@ import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart'; -import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_wideget.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.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/charts/app_time_series_chart.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; -import 'package:charts_flutter/flutter.dart' as charts; - -import 'LineChartCurved.dart'; import 'LineChartCurvedBloodPressure.dart'; class VitalSingChartBloodPressure extends StatelessWidget { @@ -31,33 +31,99 @@ class VitalSingChartBloodPressure extends StatelessWidget { final String title3; List timeSeriesData1 = []; List timeSeriesData2 = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); generateData(); - return Column( - children: [ - AppExpandableNotifier( - isExpand: true, - headerWidget: LineChartCurvedBloodPressure( - title: name, - timeSeries1: timeSeriesData1, - timeSeries2: timeSeriesData2, - indexes: timeSeriesData1.length ~/ 5.5, - ), - bodyWidget: VitalSignBloodPressureWidget( - vitalList: vitalList, - title1: title1, - title2: title2, - title3: title3, - viewKey1: viewKey1, - viewKey2: viewKey2, + return SingleChildScrollView( + child: Column( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: LineChartCurvedBloodPressure( + title: name, + timeSeries1: timeSeriesData1, + timeSeries2: timeSeriesData2, + indexes: timeSeriesData1.length ~/ 5.5, + ), ), - ), - ], + + // VitalSignBloodPressureWidget( + // vitalList: vitalList, + // title1: title1, + // title2: title2, + // title3: title3, + // viewKey1: viewKey1, + // viewKey2: viewKey2, + // ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).graphDetails, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + Table( + columnWidths: { + 0: FlexColumnWidth(2), + 1: FlexColumnWidth(1), + // 2: FlexColumnWidth(1), + }, + children: fullData(vitalList, context), + ), + ], + ), + ), + ) + ], + ), ); } + List fullData(List labResultList, context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(title1), + Utils.tableColumnTitle(title2), + Utils.tableColumnTitle(title3), + // Utils.tableColumnTitle(TranslationBase.of(context).range), + ], + ), + ); + + for (int i = 0; i < labResultList.length; i++) { + var data = labResultList[i].toJson()[viewKey1]; + if (data != 0) + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + "${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate.weekday)}, ${labResultList[i].vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate.month) : DateUtil.getMonth(labResultList[i].vitalSignDate.month)}, ${labResultList[i].vitalSignDate.year}", + isLast: i == (labResultList.length - 1)), + Utils.tableColumnValue('${labResultList[i].toJson()[viewKey1]}', isLast: i == (labResultList.length - 1)), + Utils.tableColumnValue('${labResultList[i].toJson()[viewKey2]}', isLast: i == (labResultList.length - 1)), + ], + ), + ); + } + + return tableRow; + } + generateData() { if (vitalList.length > 0) { vitalList.reversed.toList().forEach( @@ -65,16 +131,14 @@ class VitalSingChartBloodPressure extends StatelessWidget { if (element.toJson()[viewKey1]?.toInt() != 0) timeSeriesData1.add( TimeSeriesSales2( - new DateTime(element.vitalSignDate.year, - element.vitalSignDate.month, element.vitalSignDate.day), + new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), element.toJson()[viewKey1].toDouble(), ), ); if (element.toJson()[viewKey2]?.toInt() != 0) timeSeriesData2.add( TimeSeriesSales2( - new DateTime(element.vitalSignDate.year, - element.vitalSignDate.month, element.vitalSignDate.day), + new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day), element.toJson()[viewKey2].toDouble(), ), ); diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index f3875d1a..a4708830 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -1,13 +1,13 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; @@ -28,13 +28,14 @@ class _OffersCategorisePageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getOffersCategorise(), builder: (BuildContext context, OffersCategoriseViewModel model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Offers', + appBarTitle: TranslationBase.of(context).offers, isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, @@ -99,9 +100,8 @@ class _OffersCategorisePageState extends State { .height * 0.09, child: Center( - child: Texts( - model.categorise[index] - .name, + child: Texts(projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, +// model.categorise[index].name, fontWeight: FontWeight.w600, fontSize: 13.8, @@ -117,8 +117,8 @@ class _OffersCategorisePageState extends State { String ids = model.categorise[index].id; - categoriseName = model - .categorise[index].name; + categoriseName = projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name; + //model.categorise[index].name; }), ], ), @@ -275,7 +275,7 @@ class _OffersCategorisePageState extends State { bottom: 5.0, ), child: Texts( - 'offer' + TranslationBase.of(context).offers .toUpperCase(), color: Colors .red, @@ -338,25 +338,28 @@ class _OffersCategorisePageState extends State { .circular( 6)), ), - child: Texts( - model - .products[ - index] - .rxMessage != - null - ? model - .products[ - index] - .rxMessage - : "", - color: - Colors.white, + child: model.products[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.products[index].rxMessagen + : model.products[index].rxMessage, + color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, - ), + fontWeight: FontWeight.w400, + ): Texts("") +// Texts( +// model.products[index].rxMessage != null ? +// model.products[index].rxMessage +// : "", +// color: +// Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w400, +// ), ), ], ), @@ -403,11 +406,8 @@ class _OffersCategorisePageState extends State { ), ), ), - Texts( - model - .products[ - index] - .name, + Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name, + // model.products[index].name, regular: true, fontSize: 12.58, fontWeight: @@ -429,14 +429,24 @@ class _OffersCategorisePageState extends State { ), Row( children: [ - StarRating( - totalAverage: model.products[index].approvedRatingSum > - 0 - ? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble()) - .toDouble() - : 0, - forceStars: - true), +// StarRating( +// totalAverage: model.products[index].approvedRatingSum > +// 0 +// ? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble()) +// .toDouble() +// : 0, +// forceStars: +// true), + RatingBar.readOnly( + initialRating: model.products[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), Texts( "(${model.products[index].approvedTotalReviews})", regular: true, @@ -501,7 +511,7 @@ class _OffersCategorisePageState extends State { child: Center( child: Texts( - 'offer' + TranslationBase.of(context).offers .toUpperCase(), color: Colors .red, @@ -569,25 +579,28 @@ class _OffersCategorisePageState extends State { .circular( 6)), ), - child: Texts( - model - .products[ - index] - .rxMessage != - null - ? model - .products[ - index] - .rxMessage - : "", - color: - Colors.white, + child: model.products[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.products[index].rxMessagen + : model.products[index].rxMessage, + color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, - ), + fontWeight: FontWeight.w400, + ): Texts("") +// Texts( +// model.products[index].rxMessage != null +// ? model.products[index].rxMessage +// : "", +// color: +// Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w400, +// ), ), ], ), @@ -639,9 +652,8 @@ class _OffersCategorisePageState extends State { SizedBox( height: 4.0, ), - Texts( - model.products[index] - .name, + Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name, + // model.products[index].name, regular: true, fontSize: 14.0, fontWeight: @@ -664,19 +676,29 @@ class _OffersCategorisePageState extends State { ), Row( children: [ - StarRating( - totalAverage: model - .products[ - index] - .approvedRatingSum > - 0 - ? (model.products[index].approvedRatingSum.toDouble() / - model.products[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), +// StarRating( +// totalAverage: model +// .products[ +// index] +// .approvedRatingSum > +// 0 +// ? (model.products[index].approvedRatingSum.toDouble() / +// model.products[index].approvedRatingSum +// .toDouble()) +// .toDouble() +// : 0, +// forceStars: +// true), + RatingBar.readOnly( + initialRating: model.products[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), Texts( "(${model.products[index].approvedTotalReviews})", regular: true, @@ -700,9 +722,31 @@ class _OffersCategorisePageState extends State { ), ) : Center( - child: Texts( - "SORRY , there's no listed offers now :(", - color: Colors.green, - )))); + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).noOffersAvailable, +// 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), +// child: Texts( +// "SORRY , there's no listed offers now :(", +// color: Colors.green, +// ) + ))); } } diff --git a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart index 76688606..97daf27f 100644 --- a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart @@ -1,26 +1,15 @@ import 'package:after_layout/after_layout.dart'; -import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; -import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_material_pickers/flutter_material_pickers.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'CreateCustomerDailogPage.dart'; @@ -51,7 +40,7 @@ class _ClinicPackagesPageState extends State with AfterLayo if(viewModel.service.customer != null) { var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); await viewModel.service.addProductToCart(request, context: context).then((response){ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); + // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { utils.Utils.showErrorToast(error); }); @@ -61,7 +50,7 @@ class _ClinicPackagesPageState extends State with AfterLayo @override void afterFirstLayout(BuildContext context) async{ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); + // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); } @override diff --git a/lib/pages/packages_offers/CreateCustomerDailogPage.dart b/lib/pages/packages_offers/CreateCustomerDailogPage.dart index 73e95d09..70291a88 100644 --- a/lib/pages/packages_offers/CreateCustomerDailogPage.dart +++ b/lib/pages/packages_offers/CreateCustomerDailogPage.dart @@ -1,35 +1,16 @@ import 'package:after_layout/after_layout.dart'; -import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/AnimatedTextFields.dart'; -import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart'; import 'package:diplomaticquarterapp/widgets/LoadingButton.dart'; -import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart'; -import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_material_pickers/flutter_material_pickers.dart'; dynamic languageID; var emailRegex = RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$'); @@ -171,12 +152,12 @@ class _CreateCustomerDialogPageState extends State wit createCustomer() async{ setState(() => _enableInput = false); - loading(true); - var request = PackagesCustomerRequestModel(email: _emailTextController.text, phoneNumber: _phoneTextController.text); - viewModel().service - .createCustomer(request, context: context, showLoading: false) - .then((value) => success()) - .catchError((error) => showError(error)); + // loading(true); + // var request = PackagesCustomerRequestModel(email: _emailTextController.text, phoneNumber: _phoneTextController.text); + // viewModel().service + // .createCustomer(request, context: context, showLoading: false) + // .then((value) => success()) + // .catchError((error) => showError(error)); } diff --git a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart index a0b30dbd..17c88cc8 100644 --- a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart +++ b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart @@ -1,219 +1,254 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:expandable/expandable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:html/parser.dart'; +import 'package:rating_bar/rating_bar.dart'; -import 'ClinicOfferAndPackagesPage.dart'; +class OfferAndPackagesDetail extends StatefulWidget { + final PackagesResponseModel itemModel; + final Function(PackagesResponseModel product) onCartClick; -class OfferAndPackagesDetail extends StatefulWidget{ - final dynamic model; - - const OfferAndPackagesDetail({@required this.model, Key key}) : super(key: key); + const OfferAndPackagesDetail({@required this.itemModel, @required this.onCartClick, Key key}) : super(key: key); @override State createState() => OfferAndPackagesDetailState(); } - -class OfferAndPackagesDetailState extends State{ - +class OfferAndPackagesDetailState extends State { PackagesViewModel viewModel; + bool expandFlag = false; + var controller = new ExpandableController(); + @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model){ + onModelReady: (model) { viewModel = model; }, builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).offerAndPackages, - isShowAppBar: true, - isPharmacy: false, - showPharmacyCart: false, - showHomeAppBarIcon: false, - isOfferPackages: true, - showOfferPackagesCart: true, - isShowDecPage: false, - body: Stack( + appBarTitle: TranslationBase.of(context).offerAndPackages, + isShowAppBar: true, + isPharmacy: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isOfferPackages: true, + showOfferPackagesCart: true, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only(bottom: 60), - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.all(5), - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.all(10), - child: AspectRatio( - aspectRatio: 1/1, - child: utils.applyShadow( - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: utils.Utils.loadNetworkImage(url: "https://wallpaperaccess.com/full/30103.jpg",) - ), - ) - ), - ), - Align( - alignment: Alignment.topLeft, - child: Image.asset( - 'assets/images/discount_${'en'}.png', - height: 70, - width: 70, - ), - ), - - ], - - ), + Container( + color: Colors.white, + padding: const EdgeInsets.all(21.0), + child: ClipRRect( + borderRadius: BorderRadius.circular(15.0), + child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill), + ), + ), + Container( + padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 21.0), + child: Text(widget.itemModel.name, maxLines: 1, style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14))), + Container( + padding: const EdgeInsets.only(left: 21.0, right: 21.0), + child: Text(widget.itemModel.shortDescription, + maxLines: 2, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), + Row( + children: [ + Container( + padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 12.0), + child: RatingBar.readOnly( + initialRating: 4.5, + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), - - Padding( - padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "Child Dental Offer", - fontSize: 25, - fontWeight: FontWeight.normal, - color: Colors.black, - ), - - Stack( - children: [ - Texts( - "200 SAR", - fontWeight: FontWeight.normal, - decoration: TextDecoration.lineThrough, - color: Colors.grey, - fontSize: 12 - ), - Padding( - padding: const EdgeInsets.only(top: 15), - child: Texts( - "894.99 SAR", - fontWeight: FontWeight.bold, - color: Colors.green, - fontSize: 18 + ), + ], + ), + Container( + padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 18.0), + width: double.infinity, + height: 50.0, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: widget.itemModel.storeNames.length, + separatorBuilder: (context, index) { + return mWidth(5.0); + }, + itemBuilder: (BuildContext context, int index) { + return contactButton(widget.itemModel.storeNames[index].toString()); + }, + ), + ), + Container( + padding: const EdgeInsets.only(top: 18.0), + child: ExpandableNotifier( + initialExpanded: true, + child: Container( + color: Colors.white, + child: Column( + children: [ + ScrollOnExpand( + scrollOnExpand: true, + scrollOnCollapse: false, + child: ExpandablePanel( + hasIcon: false, + theme: const ExpandableThemeData( + headerAlignment: ExpandablePanelHeaderAlignment.center, + tapBodyToCollapse: true, + ), + header: Padding( + padding: const EdgeInsets.only(top: 20, bottom: 20, left: 21, right: 21), + child: InkWell( + onTap: () { + setState(() { + expandFlag = !expandFlag; + controller.expanded = expandFlag; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).description, + maxLines: 1, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14), + ), + ], + ), + ), + Icon( + expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Color(0xff2E303A), + ), + ], ), ), - ], - ), - - StarRating( - size: 20, - totalCount: null, - totalAverage: 5, - forceStars: true), - - - SizedBox(height: 20,), - - - Texts( - "Details", - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 20 - ), - - - - AspectRatio( - aspectRatio: 2/1, - child: Container( - color: Colors.grey[300], - child: Padding( - padding: const EdgeInsets.all(10), - child: Texts("Detail of offers written here"), - ) ), + builder: (_, collapsed, expanded) { + return Expandable( + controller: controller, + collapsed: collapsed, + expanded: Container( + padding: const EdgeInsets.only(left: 21.0, right: 21.0, bottom: 21.0), + child: Text(parseHtmlString(widget.itemModel.fullDescription), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), + theme: const ExpandableThemeData(crossFadePoint: 0), + ); + }, ), - - - SizedBox(height: 10,), - ], - ), + ), + ], ), + ), + ), + ), + ], + ), + ), + bottomSheet: Container( + padding: const EdgeInsets.only(top: 16, bottom: 16, left: 21, right: 21), + color: Colors.white, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if(widget.itemModel.hasDiscountsApplied) Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), + Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), ], ), ), - - Padding( - padding: const EdgeInsets.all(10), - child: Align( - alignment: Alignment.bottomRight, - child: Row( - children: [ - - Expanded( - child: RaisedButton.icon( - padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), - side: BorderSide(color: Colors.red, width: 0.5) - ), - color: Colors.red, - icon: Icon( - Icons.add_shopping_cart_outlined, - size: 25, - color: Colors.white, - ), - label: Texts( - "Add to Cart", - fontSize: 17, color: Colors.white, fontWeight: FontWeight.normal, - ), - onPressed: (){},), - ), - - SizedBox(width: 15,), - - Expanded( - child: OutlineButton.icon( - padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0), - borderSide: BorderSide(width: 1.0, color: Colors.red), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0), + SizedBox(width: 8), + Expanded( + child: SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + // onCartClick(); + widget.onCartClick(widget.itemModel); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SvgPicture.asset("assets/images/new/add-to-cart.svg", color: Colors.white), + ), + Container( + child: Text( + TranslationBase.of(context).addToCart, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), ), - color: Colors.white, - icon: Icon( - Icons.favorite_rounded, - size: 25, - color: Colors.red, - ), - label: Texts( - "Add to Favorites", - fontSize: 17, color: Colors.red, fontWeight: FontWeight.normal - ), - onPressed: (){ - - },), - ), - - ], + ), + ], + ), + color: const Color(0xffD02127), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), ), ), - ) - + ), + ], + ), + ), + ), + ); + } + String parseHtmlString(String htmlString) { + var document = parse(htmlString); + String parsedString = parse(document.body.text).documentElement.text; + return parsedString; + } - ], - ) + Widget contactButton(String title) { + return SizedBox( + height: 32, + width: 80.0, + child: FlatButton( + onPressed: () {}, + color: Colors.white, + shape: StadiumBorder(side: BorderSide(color: CustomColors.devider, width: 1)), + child: Text( + title, + style: TextStyle(fontSize: 10, letterSpacing: -0.4, color: CustomColors.textColor), + maxLines: 1, + ), ), ); } } - diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 77d168ac..4b42774b 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -1,40 +1,34 @@ import 'package:after_layout/after_layout.dart'; -import 'package:carousel_slider/carousel_slider.dart'; -import 'package:diplomaticquarterapp/core/enum/PaymentOptions.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; -import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart'; -import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesCartItemCard.dart'; -import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_material_pickers/flutter_material_pickers.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; dynamic languageID; const _columnCount = 1; +bool _agreeTerms = false; +String _selectedPaymentMethod; +Map _selectedPaymentParams; AnimationController _animationController; @@ -45,18 +39,20 @@ class PackagesCartPage extends StatefulWidget { _PackagesCartPageState createState() => _PackagesCartPageState(); } -class _PackagesCartPageState extends State - with AfterLayoutMixin, SingleTickerProviderStateMixin { +class _PackagesCartPageState extends State with AfterLayoutMixin, SingleTickerProviderStateMixin { getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); } + double subtotal, tax, total; + int _selectedHospitalIndex = -1; + HospitalsModel _selectedHospital; + @override void initState() { _agreeTerms = false; _selectedPaymentMethod = null; - _animationController = - AnimationController(vsync: this, duration: Duration(seconds: 500)); + _animationController = AnimationController(vsync: this, duration: Duration(seconds: 500)); super.initState(); } @@ -80,53 +76,45 @@ class _PackagesCartPageState extends State } onPayNowClick() async { - await viewModel.service - .placeOrder( - context: context, - paymentOption: _selectedPaymentMethod.toUpperCase()) - .then((orderId) { + await viewModel.service.placeOrder(context: context, projectID: _selectedHospital.iD, paymentParams: _selectedPaymentParams).then((orderId) { if (orderId.runtimeType == int) { - // result == order_id - var browser = MyInAppBrowser( - context: context, - onExitCallback: (data, isDone) => paymentClosed( - orderId: orderId, withStatus: isDone, data: data)); - browser.openPackagesPaymentBrowser( - customer_id: viewModel.service.customer.id, order_id: orderId); + var browser = MyInAppBrowser(context: context, onExitCallback: (data, isDone) => paymentClosed(orderId: orderId, withStatus: isDone, data: data)); + browser.openPackagesPaymentBrowser(customer_id: viewModel.service.customer.id, order_id: orderId); } else { - utils.Utils.showErrorToast( - 'Failed to place order, please try again later'); + utils.Utils.showErrorToast('Failed to place order, please try again later'); } }).catchError((error) { - utils.Utils.showErrorToast(error); + utils.Utils.showErrorToast(error.toString()); }); } @override void afterFirstLayout(BuildContext context) { fetchData(); + viewModel.service.getHospitals(); } @override Widget build(BuildContext context) { return BaseView( - allowAny: true, - onModelReady: (model) => viewModel = model, - builder: (_, model, wi) { - return AppScaffold( - appBarTitle: TranslationBase.of(context).offerAndPackages, - isShowAppBar: true, - isPharmacy: false, - showPharmacyCart: false, - showHomeAppBarIcon: false, - isOfferPackages: true, - showOfferPackagesCart: false, - isShowDecPage: false, - body: Column( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(5), + allowAny: true, + onModelReady: (model) => viewModel = model, + builder: (_, model, wi) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).offerAndPackages, + isShowAppBar: true, + isPharmacy: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isOfferPackages: true, + showOfferPackagesCart: false, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + body: viewModel.cartItemList.length > 0 + ? Column( + children: [ + Expanded( child: StaggeredGridView.countBuilder( crossAxisCount: (_columnCount * _columnCount), itemCount: viewModel.cartItemList.length, @@ -138,283 +126,304 @@ class _PackagesCartPageState extends State background: _cartItemDeleteContainer(), secondaryBackground: _cartItemDeleteContainer(), confirmDismiss: (direction) async { - bool status = await viewModel.service - .deleteProductFromCart(item.id, - context: context, showLoading: false); + bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false); return status; }, onDismissed: (direction) { - debugPrint('Index: $index'); viewModel.cartItemList.removeAt(index); }, child: PackagesCartItemCard( itemModel: item, + viewModel: viewModel, + getCartItems: fetchData, shouldStepperChangeApply: (apply, total) async { - var request = AddProductToCartRequestModel( - product_id: item.productId, - quantity: apply); - ResponseModel response = await viewModel - .service - .addProductToCart(request, - context: context, showLoading: false) - .catchError((error) { + var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply); + ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) { utils.Utils.showErrorToast(error); }); + if (response.status) { + fetchData(); + } return response.status ?? false; }, )); }, - staggeredTileBuilder: (int index) => - StaggeredTile.fit(_columnCount), + staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount), mainAxisSpacing: 0, crossAxisSpacing: 10, - )), - ), - Container( - height: 0.25, - color: Theme.of(context).primaryColor, - ), - Container( + ), + ), + Container( + height: 0.25, + color: Theme.of(context).primaryColor, + ), + ], + ) + : getNoDataWidget(context), + bottomSheet: viewModel.cartItemList.length > 0 + ? Container( + padding: EdgeInsets.all(21.0), + width: double.infinity, color: Colors.white, child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Texts(TranslationBase.of(context).selectPaymentOption, - fontSize: 10, fontWeight: FontWeight.bold), Container( - height: 0.25, - width: 100, - color: Colors.grey[300], + margin: EdgeInsets.only(bottom: 12.0), + child: InkWell( + onTap: () => confirmSelectHospitalDialog(model.hospitals), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 50, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(color: CustomColors.devider), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getHospitalName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), ), - _paymentOptions(context, (paymentMethod) { - setState(() => _selectedPaymentMethod = paymentMethod); - }), Container( - height: 0.25, - color: Colors.grey[300], + margin: EdgeInsets.fromLTRB(0.0, 0.0, 20.0, 0.0), + child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)), ), Container( - height: 40, - child: _termsAndCondition(context, - onSelected: onTermsClick, - onInfoClick: onTermsInfoClick)), + width: MediaQuery.of(context).size.width * 0.75, + margin: EdgeInsets.fromLTRB(0.0, 8.0, 20.0, 5.0), + child: getPaymentMethods(), + ), Container( - height: 0.25, - color: Colors.grey[300], + margin: EdgeInsets.only(top: 14.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + value: _agreeTerms, + onChanged: (v) { + setState(() => _agreeTerms = v); + }), + ), + Expanded( + child: Text( + TranslationBase.of(context).iAcceptTermsConditions, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48), + ), + ), + ], + ), + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 12, bottom: 3), + child: Row( + children: [ + Expanded( + child: _getNormalText(TranslationBase.of(context).patientShareToDo), + ), + Expanded( + child: _getNormalText(TranslationBase.of(context).sar + " " + (subtotal ?? 0.0).toStringAsFixed(2), 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(TranslationBase.of(context).sar + ' ' + (tax ?? 0.0).toStringAsFixed(2), 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(TranslationBase.of(context).sar + ' ' + (total ?? 0.0).toStringAsFixed(2), isBold: true, isTotal: true), + ) + ], + ), + ), + ], + ), + ), + Container( + padding: EdgeInsets.only(top: 21, bottom: 21), + child: DefaultButton( + TranslationBase.of(context).payNow, + (_agreeTerms && _selectedHospital != null) + ? () { + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { + print(value); + if (value != null) { + _selectedPaymentMethod = value; + _selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value}; + onPayNowClick(); + } + }); + } + : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, + ), ), - _payNow(context, onPayNowClick: onPayNowClick) ], ), ) - ], - ), - ); - }); + : SizedBox(), + ); + }, + ); + } + + void confirmSelectHospitalDialog(List hospitals) { + List list = [ + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = hospitals[index]; + setState(() {}); + }, + ), + ); + } + + String getHospitalName() { + if (_selectedHospital != null) + return _selectedHospital.name; + else + return TranslationBase.of(context).selectHospital; } fetchData() async { - await viewModel.service.cartItems(context: context).catchError((error) {}); + await viewModel.service.cartItems(context: context).then((value) { + subtotal = value['subtotal'] ?? 0.0; + tax = value['tax'] ?? 0.0; + total = value['total'] ?? 0.0; + }).catchError((error) {}); + setState(() {}); } - paymentClosed( - {@required int orderId, @required bool withStatus, dynamic data}) async { + paymentClosed({@required int orderId, @required bool withStatus, dynamic data}) async { viewModel.service.getOrderById(orderId, context: context).then((value) { var heading = withStatus ? "Success" : "Failed"; - var title = "Your order has been placed successfully"; + var title = withStatus ? "Your order has been placed successfully" : "Failed to place your order"; var subTitle = "Order# ${value.data.customOrderNumber}"; - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => PackageOrderCompletedPage( - heading: heading, title: title, subTitle: subTitle))); + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => PackageOrderCompletedPage(heading: heading, title: title, subTitle: subTitle))); }).catchError((error) { debugPrint(error); }); } } -// /* Payment Footer Widgets */ -// --------------------------- -String _selectedPaymentMethod; -Widget _paymentOptions(BuildContext context, Function(String) onSelected) { - double height = 30; - - Widget buttonContent(bool isSelected, String imageName) { - return Container( - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: isSelected ? Colors.green[50] : Colors.grey[200], - blurRadius: 1, - spreadRadius: 2, - ), - ], - borderRadius: BorderRadius.all(Radius.circular(5)), - border: Border.all( - color: isSelected ? Colors.green : Colors.grey, - width: isSelected ? 1 : 0.5)), - child: Padding( - padding: const EdgeInsets.all(4), - child: Image.asset('assets/images/new-design/$imageName'), - )); - } - - return Padding( - padding: const EdgeInsets.all(5), - child: Container( - height: height, - color: Colors.transparent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'), - onTap: () { - onSelected("mada"); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: buttonContent(_selectedPaymentMethod == "visa", 'visa.png'), - onTap: () { - onSelected("visa"); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: buttonContent( - _selectedPaymentMethod == "mastercard", 'mastercard.png'), - onTap: () { - onSelected("mastercard"); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: buttonContent( - _selectedPaymentMethod == "installment", 'installment.png'), - onTap: () { - onSelected("installment"); - }, - ), - ], - ), - ), - ); -} +// Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) { +// bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null)); +// +// String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2); +// String _tax = (tax ?? 0.0).toStringAsFixed(2); +// String _total = (total ?? 0).toStringAsFixed(2); +// +// return Padding( +// padding: const EdgeInsets.all(5), +// child: Container( +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.end, +// children: [ +// Padding( +// padding: const EdgeInsets.all(5), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Texts('${TranslationBase.of(context).subtotal}: $_subtotal ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8), +// Texts('${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8), +// Padding( +// padding: const EdgeInsets.all(3), +// child: Container( +// height: 0.25, +// width: 120, +// color: Colors.grey[300], +// ), +// ), +// Texts('${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, fontSize: 15) +// ], +// ), +// ), +// Expanded(child: Container()), +// RaisedButton( +// elevation: 0, +// child: Texts( +// TranslationBase.of(context).payNow, +// fontSize: 15, +// color: Colors.white, +// fontWeight: FontWeight.bold, +// ), +// padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0), +// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5), side: BorderSide(color: Theme.of(context).primaryColor, width: 0.5)), +// color: Theme.of(context).primaryColor, +// onPressed: isPayNowAQctive ? onPayNowClick : null, +// ), +// ], +// )), +// ); +// } -bool _agreeTerms = false; -Widget _termsAndCondition(BuildContext context, - {@required Function(bool) onSelected, @required VoidCallback onInfoClick}) { - return Padding( - padding: const EdgeInsets.all(5), - child: Row( - children: [ - InkWell( - child: Icon( - _agreeTerms - ? Icons.check_circle - : Icons.radio_button_unchecked_sharp, - size: 20, - color: _agreeTerms ? Colors.green[600] : Colors.grey[400], - ), - onTap: () { - onSelected(!_agreeTerms); - }, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Texts( - TranslationBase.of(context).pharmacyServiceTermsCondition, - fontWeight: FontWeight.normal, - fontSize: 13, - ), - )), - InkWell( - child: Icon( - Icons.info, - size: 20, - color: Colors.grey[600], - ), - onTap: () { - onInfoClick(); - }, - ), - ], +_getNormalText(text, {bool isBold = false, bool isTotal = false}) { + return Text( + text, + style: TextStyle( + fontSize: isBold + ? isTotal + ? 16 + : 12 + : 10, + letterSpacing: -0.5, + color: isBold ? Colors.black : Colors.grey[700], + fontWeight: FontWeight.w600, ), ); } -Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { - bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null)); - - return Padding( - padding: const EdgeInsets.all(5), - child: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - '${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}', - heightFactor: 1.5, - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 8), - Texts( - '${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}', - heightFactor: 1.5, - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 8), - Padding( - padding: const EdgeInsets.all(3), - child: Container( - height: 0.25, - width: 120, - color: Colors.grey[300], - ), - ), - Texts( - '${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}', - heightFactor: 1.5, - fontWeight: FontWeight.bold, - color: Colors.black54, - fontSize: 15) - ], - ), - ), - Expanded(child: Container()), - RaisedButton( - child: Texts( - TranslationBase.of(context).payNow, - fontSize: 15, - color: Colors.white, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - side: BorderSide( - color: Theme.of(context).primaryColor, width: 0.5)), - color: Theme.of(context).primaryColor, - onPressed: isPayNowAQctive ? onPayNowClick : null, - ), - ], - )), - ); -} -// ------------------- - Widget _cartItemDeleteContainer() { _animationController.duration = Duration(milliseconds: 500); _animationController.repeat(reverse: true); diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index c09e10ea..d323b36d 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -1,240 +1,273 @@ -import 'package:after_layout/after_layout.dart'; -import 'package:carousel_slider/carousel_slider.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/packages_offers/requests/AddProductToCartRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart'; -import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/CreateCustomerDailogPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' as auth; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; -import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart'; -import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_material_pickers/flutter_material_pickers.dart'; - -dynamic languageID; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; class PackagesHomePage extends StatefulWidget { - dynamic offersModel; - PackagesHomePage({@required this.offersModel}); + final AuthenticatedUser user; + + PackagesHomePage(this.user); @override _PackagesHomePageState createState() => _PackagesHomePageState(); - } -class _PackagesHomePageState extends State with AfterLayoutMixin{ - getLanguageID() async { - languageID = await sharedPref.getString(APP_LANGUAGE); - } +class _PackagesHomePageState extends State { + ProjectViewModel projectViewModel; @override void initState() { super.initState(); - getLanguageID(); - } - - @override - void afterFirstLayout(BuildContext context) async{ - viewModel.service.loadOffersPackagesDataForMainPage(context: context, completion: (){ - setState((){}); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + viewModel.service.patientUser = widget.user; + viewModel.service.loadOffersPackagesDataForMainPage( + context: context, + completion: () { + setState(() {}); + }); }); } // Controllers var _searchTextController = TextEditingController(); - var _filterTextController = TextEditingController(); - var _carouselController = CarouselController(); - - - int carouselIndicatorIndex = 0; - CarouselSlider _bannerCarousel; - TextField _textFieldSearch; - TextField _textFieldFilterSelection; ListView _listViewLatestOffers; ListView _listViewBestSeller; PackagesViewModel viewModel; - onCartClick(){ - if (viewModel.service.customer == null){ + onCartClick() { + if (viewModel.service.customer == null) { utils.Utils.showErrorToast("Cart is empty for your current session"); return; } - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => PackagesCartPage() - ) - ); + Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => PackagesCartPage())); } onProductCartClick(PackagesResponseModel product) async { - if(viewModel.service.customer == null) - viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + if (viewModel.service.customer == null) { + // viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + loginCheck(context); + } - if(viewModel.service.customer != null) { + if (viewModel.service.customer != null) { var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); - await viewModel.service.addProductToCart(request, context: context).then((response){ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); - }).catchError((error) { - utils.Utils.showErrorToast(error); + await viewModel.service.addProductToCart(request, context: context).then((response) {}).catchError((error) { + utils.Utils.showErrorToast(error.toString()); }); } } AppScaffold appScaffold; + PackagesCategoriesResponseModel selectedClinic; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( - allowAny: true, - onModelReady: (model) => viewModel = model, - builder: (_, model, wi){ - return - appScaffold = - AppScaffold( - appBarTitle: TranslationBase.of(context).offerAndPackages, - isShowAppBar: true, - isPharmacy: false, - showPharmacyCart: false, - showHomeAppBarIcon: false, - isOfferPackages: true, - showOfferPackagesCart: true, - isShowDecPage: false, - body: ListView( + allowAny: true, + onModelReady: (model) => viewModel = model, + builder: (_, model, wi) { + return appScaffold = AppScaffold( + description: TranslationBase.of(context).offerAndPackagesDetails, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png')], + appBarTitle: TranslationBase.of(context).offerAndPackages, + isShowAppBar: true, + isPharmacy: false, + showPharmacyCart: false, + isOfferPackages: true, + showOfferPackagesCart: false, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: projectViewModel.isArabic ? const EdgeInsets.only(top: 21, right: 21, bottom: 21) : const EdgeInsets.only(top: 21, left: 21, bottom: 21), + child: Column( children: [ - - // Top Banner Carousel - AspectRatio( - aspectRatio: 2.2/1, - child: bannerCarousel() + inputWidget(TranslationBase.of(context).search, "", _searchTextController, isInputTypeNum: false), + SizedBox( + height: 10, ), - - Center( - child: CarouselIndicator( - activeColor: Theme.of(context).appBarTheme.color, - color: Colors.grey[300], - cornerRadius: 15, - width: 15, height: 15, - count: _bannerCarousel.itemCount, - index: carouselIndicatorIndex, - onClick: (index){ - debugPrint('onClick at ${index}'); + InkWell( + onTap: () => showClinicSelectionList(), + child: Container( + padding: EdgeInsets.all(12), + margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + selectedClinic != null ? selectedClinic.name : TranslationBase.of(context).browseOffers, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), + SizedBox( + height: 20, + ), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: viewModel.bestSellerList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.bestSellerList[index], + onCartClick: onProductCartClick, + ); }, ), ), - - SizedBox(height: 10,), - - Padding( - padding: const EdgeInsets.all(15), - child: Column( - children: [ - // Search Textfield - searchTextField(), - - SizedBox(height: 10,), - - // Filter Selection - filterOptionSelection(), - - SizedBox(height: 20,), - - // Horizontal Scrollable Cards - Texts( - "Latest offers", - fontWeight: FontWeight.bold, - color: Colors.black87, - fontSize: 20 - ), - - // Latest Offers Horizontal Scrollable List - AspectRatio( - aspectRatio: 1.3/1, - child: LayoutBuilder(builder: (context, constraints){ - double itemContentPadding = 10; - double itemWidth = (constraints.maxWidth/2) - (itemContentPadding*2); - return latestOfferListView(itemWidth: itemWidth, itemContentPadding: itemContentPadding); - }), - ), - - SizedBox(height: 10,), - - Texts( - "Best sellers", - fontWeight: FontWeight.bold, - color: Colors.black87, - fontSize: 20 - ), - - - // Best Seller Horizontal Scrollable List - AspectRatio( - aspectRatio: 1.3/1, - child: LayoutBuilder(builder: (context, constraints){ - double itemContentPadding = 10; // 10 is content padding in each item - double itemWidth = (constraints.maxWidth/2) - (itemContentPadding*2 /* 2 = LeftRight */); - return bestSellerListView(itemWidth: itemWidth, itemContentPadding: itemContentPadding); - }), - ) - - ],), + SizedBox( + height: 21, + ), + // // Best Seller Horizontal Scrollable List + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: viewModel.latestOffersList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.latestOffersList[index], + onCartClick: onProductCartClick, + ); + }, + ), ), ], ), + ), + SizedBox( + height: 50.0, ) - .setOnAppBarCartClick(onCartClick); - } + ], + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: const EdgeInsets.all(12.0), + child: SizedBox( + height: 43, + width: double.infinity, + child: FlatButton( + onPressed: () { + onCartClick(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SvgPicture.asset("assets/images/new/cart.svg"), + // child: Icon( + // Icons.add_shopping_cart_rounded, + // size: 30.0, + // color: Colors.white, + // ), + ), + Container( + child: Text( + TranslationBase.of(context).myCart, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + ), + ), + ], + ), + color: const Color(0xffD02127), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + ), + ), + ); + }, ); } - - - showClinicSelectionList() async { var clinics = viewModel.service.categoryList; - if(clinics.isEmpty) { + if (clinics.isEmpty) { GifLoaderDialogUtils.showMyDialog(context); clinics = await viewModel.service.getAllCategories(OffersCategoriesRequestModel()); GifLoaderDialogUtils.hideDialog(context); } - List options = clinics.map((e) => e.toString()).toList(); - - showMaterialSelectionPicker( + List list = [ + for (int i = 0; i < clinics.length; i++) RadioSelectionDialogModel(clinics[i].name, i), + ]; + showDialog( context: context, - title: "Select Clinic", - items: options, - selectedItem: options.first, - onChanged: (value) async { - var selectedClinic = clinics.firstWhere((element) => element.toString() == value); - var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true); - if(clinicProducts.isNotEmpty) - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => ClinicPackagesPage(products: clinicProducts) - ) - ); - else - utils.Utils.showErrorToast("No offers available for this clinic"); - }, + child: RadioSelectionDialog( + listData: list, + selectedIndex: 0, + isScrollable: true, + onValueSelected: (index) async { + selectedClinic = clinics[index]; + var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true); + if (clinicProducts.isNotEmpty) + Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => ClinicPackagesPage(products: clinicProducts))); + else + utils.Utils.showErrorToast("No offers available for this clinic"); + setState(() {}); + }, + ), ); } @@ -242,177 +275,144 @@ class _PackagesHomePageState extends State with AfterLayoutMix // Main Widgets of Page //---------------------------------- - CarouselSlider bannerCarousel(){ - _bannerCarousel = CarouselSlider.builder( - carouselController: _carouselController, - itemCount: 10, - itemBuilder: (BuildContext context, int itemIndex) { - return Padding( - padding: const EdgeInsets.only(top: 10, bottom: 10, left: 15, right: 15), - child: FractionallySizedBox( - widthFactor: 1, - heightFactor: 1, - child: utils.applyShadow( - spreadRadius: 1, - blurRadius: 5, - child: InkWell( - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: utils.Utils.loadNetworkImage(url: "https://wallpaperaccess.com/full/30103.jpg",) - ), - onTap: (){ - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => OfferAndPackagesDetail(model: "",) - ) - ); - }, - ) - ), - ), + Widget latestOfferListView({@required double itemWidth, @required double itemContentPadding}) { + return _listViewLatestOffers = ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + itemCount: viewModel.bestSellerList.length, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemWidth: itemWidth, + itemContentPadding: itemContentPadding, + itemModel: viewModel.bestSellerList[index], + onCartClick: onProductCartClick, ); }, - options: CarouselOptions( - autoPlayInterval: Duration(milliseconds: 3500), - enlargeStrategy: CenterPageEnlargeStrategy.scale, - enlargeCenterPage: true, - autoPlay: false, - autoPlayCurve: Curves.fastOutSlowIn, - enableInfiniteScroll: true, - autoPlayAnimationDuration: Duration(milliseconds: 1500), - viewportFraction: 1, - onPageChanged: (page, reason){ - setState(() { - carouselIndicatorIndex = page; - }); - }, - ), + separatorBuilder: separator, ); - return _bannerCarousel; - } - - TextField searchTextField(){ - return _textFieldSearch = - TextField( - controller: _searchTextController, - decoration: InputDecoration( - contentPadding: EdgeInsets.only(top: 0.0, bottom: 0.0, left: 10, right: 10), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( width: 0.5, color: Colors.grey), - borderRadius: const BorderRadius.all( - const Radius.circular(10.0), - ), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( width: 1, color: Colors.grey), - borderRadius: const BorderRadius.all( - const Radius.circular(10.0), - ), - ), - filled: true, - fillColor: Colors.white, - hintText: "Search", - hintStyle: TextStyle(color: Colors.grey[350], fontWeight: FontWeight.bold), - suffixIcon: IconButton( - onPressed: (){ - // viewModel.search(text: _searchTextController.text); - }, - icon: Icon(Icons.search_rounded, size: 35,), - ), - ), - ); - } - Widget filterOptionSelection(){ - _textFieldFilterSelection = - TextField( - enabled: false, - controller: _searchTextController, - decoration: InputDecoration( - contentPadding: EdgeInsets.only(top: 0.0, bottom: 0.0, left: 10, right: 10), - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1), - borderRadius: const BorderRadius.all( - const Radius.circular(10.0), - ), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide( width: 0.5, color: Colors.grey), - borderRadius: const BorderRadius.all( - const Radius.circular(10.0), - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(10.0), - ), - ), - filled: true, - fillColor: Colors.white, - hintText: "Browse offers by Clinic", - hintStyle: TextStyle(color: Colors.grey[350], fontWeight: FontWeight.bold), - suffixIcon: IconButton( - onPressed: (){ - showClinicSelectionList(); - }, - icon: Icon(Icons.keyboard_arrow_down_rounded, size: 35, color: Colors.grey,), - ), - ), + Widget bestSellerListView({@required double itemWidth, @required double itemContentPadding}) { + return _listViewLatestOffers = ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: viewModel.bestSellerList.length, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemWidth: itemWidth, + itemContentPadding: itemContentPadding, + itemModel: viewModel.bestSellerList[index], + onCartClick: onProductCartClick, ); - - return InkWell( - child: _textFieldFilterSelection, - onTap: (){ - showClinicSelectionList(); }, + separatorBuilder: separator, ); - } - Widget latestOfferListView({@required double itemWidth, @required double itemContentPadding}){ - return _listViewLatestOffers = - ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: viewModel.bestSellerList.length, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard(itemWidth: itemWidth, itemContentPadding: itemContentPadding, itemModel: viewModel.bestSellerList[index], onCartClick: onProductCartClick,); - }, - separatorBuilder: separator, - ); - + Widget separator(BuildContext context, int index) { + return Container( + width: 1, + decoration: BoxDecoration( + gradient: + LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 4.0), colors: [Colors.grey, Colors.grey[100], Colors.grey[200], Colors.grey[300], Colors.grey[400], Colors.grey[500]])), + ); } - Widget bestSellerListView({@required double itemWidth, @required double itemContentPadding}){ - return _listViewLatestOffers = - ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: viewModel.bestSellerList.length, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard(itemWidth: itemWidth, itemContentPadding: itemContentPadding, itemModel: viewModel.bestSellerList[index], onCartClick: onProductCartClick,); - }, - separatorBuilder: separator, - ); + loginCheck(context) async { + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + auth.AuthProvider().selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + sharedPref.setObject(IMEI_USER_DATA, value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } } - - Widget separator(BuildContext context, int index){ + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { return Container( - width: 1, + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), + alignment: Alignment.center, decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment(-1.0, -2.0), - end: Alignment(1.0, 4.0), - colors: [ - Colors.grey, - Colors.grey[100], - Colors.grey[200], - Colors.grey[300], - Colors.grey[400], - Colors.grey[500] - ] - )), + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + Icon(Icons.search_outlined), + ], + ), + ), ); } } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 1a93a7b1..33e616a5 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,44 +1,42 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.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/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:rating_bar/rating_bar.dart'; + import 'base/base_view.dart'; class ParentCategorisePage extends StatefulWidget { String id; String titleName; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => - _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -52,7 +50,6 @@ class _ParentCategorisePageState extends State { this.productID, }); - Map values = {'huusam': false, 'ali': false, 'noor': false}; bool checkedBrands = false; bool checkedCategorise = false; String categoriseName = "Personal Care"; @@ -64,28 +61,46 @@ class _ParentCategorisePageState extends State { size: 29.0, ); + int pageIndex = 1; + List entityList = List(); List entityListBrands = List(); + RefreshController controller = RefreshController(); + @override Widget build(BuildContext context) { TextEditingController minField = TextEditingController(); TextEditingController maxField = TextEditingController(); ProjectViewModel projectViewModel = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCategoriseParent(i: id), + onModelReady: (model) => model.getCategoriseParent(i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - AppScaffold( - isPharmacy: true, - appBarTitle: titleName, - isBottomBar: true, - isShowAppBar: true, - backgroundColor: Colors.white, - isShowDecPage: false, - baseViewModel: model, - body: SingleChildScrollView( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( + isPharmacy: true, + appBarTitle: titleName, + isBottomBar: true, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: SmartRefresher( + enablePullDown: false, + controller: controller, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getParentProducts(pageIndex: pageIndex, i: id, isLoading: true, context: context); + if (model.state != ViewState.BusyLocal && pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, + child: SingleChildScrollView( child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -121,85 +136,33 @@ class _ParentCategorisePageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: InkWell( - child: Container( - child: Texts( - TranslationBase.of(context) - .viewCategorise, + InkWell( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context).viewCategorise, // 'View All Categories', - fontWeight: FontWeight.w300, + fontWeight: FontWeight.w300, + ), ), ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategoriseModalsheet( + Icon(Icons.arrow_forward) + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( // id: model.categorise[0].id, // titleName: model.categorise[0].name, - )), - ); -// showModalBottomSheet( -// isScrollControlled: true, -// context: context, -// builder: (BuildContext context) { -// return Container( -// // height: MediaQuery.of(context) -// // .size -// // .height * -// // 0.89, -// color: Colors.white, -// child: Center( -// child: ListView.builder( -// scrollDirection: Axis.vertical, -// itemCount: model.categoriseParent.length, -// itemBuilder: (BuildContext context, int index) { -// return Container( -// child: Padding( -// padding: EdgeInsets.all(4.0), -// child: InkWell( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Texts(projectViewModel.isArabic -// ? model.categoriseParent[index].namen -// : model.categoriseParent[index].name), -// Divider( -// thickness: 0.6, -// color: Colors.black12, -// ) -// ], -// ), -// onTap: () { -// Navigator.push( -// context, -// FadePage( -// page: SubCategorisePage( -// title: model.categoriseParent[index].name, -// id: model.categoriseParent[index].id, -// parentId: id, -// )), -// ); -// }, -// ), -// ), -// ); -// }), -// ), -// ); -// }, -// ); - }, - ), - ), - Icon(Icons.arrow_forward) - ], - ), + )), + ); + }), Divider( thickness: 1.0, color: Colors.grey.shade400, @@ -215,28 +178,22 @@ class _ParentCategorisePageState extends State { child: Center( child: ListView.builder( scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 - ? 8 - : model.categoriseParent.length, + itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), + padding: EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), + padding: EdgeInsets.symmetric(horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), + color: Colors.orange.shade200.withOpacity(0.45), ), child: Center( child: Icon( @@ -247,23 +204,14 @@ class _ParentCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.197, + width: MediaQuery.of(context).size.width * 0.197, // height: MediaQuery.of(context) // .size // .height * // 0.08, child: Center( child: Texts( - projectViewModel.isArabic - ? model - .categoriseParent[index] - .namen - : model - .categoriseParent[index] - .name, + projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, fontSize: 13.4, fontWeight: FontWeight.w600, maxLines: 3, @@ -277,10 +225,8 @@ class _ParentCategorisePageState extends State { context, FadePage( page: SubCategorisePage( - title: model - .categoriseParent[index].name, - id: model - .categoriseParent[index].id, + title: projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, + id: model.categoriseParent[index].id, parentId: id, )), ); @@ -312,7 +258,7 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - 'Refine', + TranslationBase.of(context).refine, fontWeight: FontWeight.w600, ), ], @@ -326,21 +272,16 @@ class _ParentCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context) - .size - .height * - 1.95, + height: MediaQuery.of(context).size.height * 1.95, child: Column( children: [ Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -350,13 +291,10 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of( - context) - .refine, + TranslationBase.of(context).refine, // 'Refine', - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, ), SizedBox( width: 250.0, @@ -364,17 +302,13 @@ class _ParentCategorisePageState extends State { InkWell( child: Texts( // 'Close', - TranslationBase.of( - context) - .closeIt, + TranslationBase.of(context).closeIt, color: Colors.red, - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop( - context); + Navigator.pop(context); }, ), ], @@ -387,39 +321,26 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .categorise), + title: Texts(TranslationBase.of(context).categorise), children: [ ProcedureListWidget( model: model, - masterList: model - .categoriseParent, - removeHistory: - (item) { + masterList: model.categoriseParent, + removeHistory: (item) { setState(() { - entityList - .remove( - item); + entityList.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityList.add( - history); + entityList.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelected( - master), + isEntityListSelected: (master) => isEntityListSelected(master), ) ], ), @@ -428,40 +349,26 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .brands), + title: Texts(TranslationBase.of(context).brands), children: [ ProcedureListWidget( model: model, - masterList: model - .brandsList, - removeHistory: - (item) { + masterList: model.brandsList, + removeHistory: (item) { setState(() { - entityListBrands - .remove( - item); + entityListBrands.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityListBrands - .add( - history); + entityListBrands.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelectedBrands( - master), + isEntityListSelected: (master) => isEntityListSelectedBrands(master), ) ], ), @@ -470,69 +377,43 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .price), + title: Texts(TranslationBase.of(context).price), children: [ Container( - color: Color( - 0xffEEEEEE), + color: Color(0xffEEEEEE), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Min'), + Texts(TranslationBase.of(context).min), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - minField, + controller: minField, ), ), ], ), Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Max'), + Texts(TranslationBase.of(context).max), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - maxField, + controller: maxField, ), ), ], @@ -547,28 +428,18 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, + height: MediaQuery.of(context).size.height * 0.4, ), Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( width: 100, child: Button( - label: TranslationBase.of( - context) - .reset, - backgroundColor: - Colors.red, + label: TranslationBase.of(context).reset, + backgroundColor: Colors.red, ), ), SizedBox( @@ -577,67 +448,34 @@ class _ParentCategorisePageState extends State { Container( width: 200, child: Button( - onTap: - () async { - String - categoriesId = - ""; - for (CategoriseParentModel category - in entityList) { - if (categoriesId == - "") { - categoriesId = - category - .id; + onTap: () async { + String categoriesId = ""; + for (CategoriseParentModel category in entityList) { + if (categoriesId == "") { + categoriesId = category.id; } else { - categoriesId = - "$categoriesId,${category.id}"; + categoriesId = "$categoriesId,${category.id}"; } } - String - brandIds = - ""; - for (CategoriseParentModel brand - in entityListBrands) { - if (brandIds == - "") { - brandIds = - brand - .id; + String brandIds = ""; + for (CategoriseParentModel brand in entityListBrands) { + if (brandIds == "") { + brandIds = brand.id; } else { - brandIds = - "$brandIds,${brand.id}"; + brandIds = "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils - .showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model.getFilteredProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), - categoryId: - categoriesId, - brandId: - brandIds); - GifLoaderDialogUtils - .hideDialog( - context); + min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); + GifLoaderDialogUtils.hideDialog(context); - Navigator.pop( - context); + Navigator.pop(context); }, - label: TranslationBase.of( - context) - .apply, - backgroundColor: - Colors - .green, + label: TranslationBase.of(context).apply, + backgroundColor: Colors.green, ), ), ], @@ -676,7 +514,7 @@ class _ParentCategorisePageState extends State { styleTwo = true; styleIcon = Icon( Icons.auto_awesome_mosaic, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } else { @@ -684,7 +522,7 @@ class _ParentCategorisePageState extends State { styleTwo = false; styleIcon = Icon( Icons.widgets_sharp, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } @@ -703,237 +541,319 @@ class _ParentCategorisePageState extends State { ), model.parentProducts.isNotEmpty ? styleOne == true - ? Container( - height: model.parentProducts.length * - MediaQuery.of(context).size.height * - 0.15, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, - ), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.parentProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: - Radius.circular(110.0), + ? model.state != ViewState.BusyLocal + ? Container( + height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.parentProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: model.parentProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model.parentProducts[index].discountName != null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: BoxDecoration(), + child: Padding( + padding: EdgeInsets.only( + right: 5.0, + top: 20.0, + bottom: 5.0, + ), + child: Texts( + TranslationBase.of(context).offers.toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: FontWeight.w900, + ), + ), + transform: new Matrix4.rotationZ(5.837200), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.parentProducts[index].images.isNotEmpty + ? model.parentProducts[index].images[0].thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), +// Container( +// width: model.parentProducts[index].rxMessage != +// null +// ? MediaQuery.of(context) +// .size +// .width / +// 5 +// : 0, +// padding: +// EdgeInsets +// .all( +// 4), +// decoration: +// BoxDecoration( +// color: Color( +// 0xffb23838), +// borderRadius: +// BorderRadius.only( +// topLeft: +// Radius.circular(6)), +// ), +// child:model.parentProducts[index].rxMessage != null ? +// Texts(projectProvider.isArabic +// ? model.parentProducts[index].rxMessagen +// : model.parentProducts[index].rxMessage, +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ) +// : Texts(""), +// // Texts( +// // model.parentProducts[index].rxMessage != +// null +// ? model +// .parentProducts[index] +// .rxMessage +// : "", +// // color: Colors +// .white, +// // regular: +// true, +// // fontSize: +// 10, +// // fontWeight: +// FontWeight +// .w400, +// // ), +// ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.parentProducts[index].discountName != null) + Container( + width: double.infinity, + height: 13.0, + decoration: BoxDecoration( + color: Color(0xff5AB145), + ), + child: Center( + child: Texts( + model.parentProducts[index].discountName, + regular: true, + color: Colors.white, + fontSize: 10.4, + ), + ), + ), + Texts( + projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w700, + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ +// StarRating( +// totalAverage: model.parentProducts[index].approvedRatingSum > 0 +// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), ), - color: Colors.white, ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model.parentProducts[index]), + )), + }, + )); + }, + ), + ) + : Container( + height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( children: [ Stack( children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: - BoxDecoration(), + Column( + children: [ + Container( + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets - .only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - 'offer' - .toUpperCase(), - color: Colors - .red, - fontSize: - 13.0, - fontWeight: - FontWeight - .w900, + padding: EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, ), ), - transform: new Matrix4 - .rotationZ( - 5.837200), ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), + Container( + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: model.parentProducts[index].images.isNotEmpty + ? Image.network( + model.parentProducts[index].images[0].thumb, + fit: BoxFit.contain, + height: 70, + ) + : Text(TranslationBase.of(context).noImage), + ), + ], ), - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), + Column( + children: [ + Container( + width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + ), + child: model.parentProducts[index].rxMessage != null + ? Texts( + projectProvider.isArabic ? model.parentProducts[index].rxMessagen : model.parentProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + : Texts(""), +// Texts( +// model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), + ), + ], ), ], ), Container( - margin: - EdgeInsets.symmetric( - horizontal: 6, + margin: EdgeInsets.symmetric( + horizontal: 0, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - Container( - width: double - .infinity, - height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), - ), - child: Center( - child: Texts( - model - .parentProducts[ - index] - .discountName, - regular: true, - color: Colors - .white, - fontSize: - 10.4, - ), - ), + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of(context).size.width * 0.635, + child: Texts( + projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, + regular: true, + fontSize: 13.2, + fontWeight: FontWeight.w500, + maxLines: 5, ), - Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model - .parentProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w700, + ), + SizedBox( + height: 8.0, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -942,317 +862,99 @@ class _ParentCategorisePageState extends State { ), Row( children: [ - StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model.parentProducts[index].approvedRatingSum.toDouble() / - model.parentProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), +// StarRating( +// totalAverage: model.parentProducts[index].approvedRatingSum > 0 +// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), Texts( "(${model.parentProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), ], ), ), + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon( + Icons.shopping_cart, + size: 18, + color: CustomColors.green, + ), + onPressed: () async { + if (model.parentProducts[index].rxMessage == null) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.parentProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + }), + ) + : Container(), ], ), ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), - )), - }, - )); - }, - ), - ) - : Container( - height: model.parentProducts.length * - MediaQuery.of(context).size.height * - 0.122, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), - ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, - height: 80, - ), - ), - ], - ), - Column( - children: [ - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), - ), - ], - ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model - .parentProducts[ - index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model.parentProducts[index].approvedRatingSum - .toDouble() / - model - .parentProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - widget.authenticatedUserObject - .isLogin - ? Container( - child: IconButton( - icon: Icon( - Icons - .shopping_cart, - size: 18, - color: - Colors.blue, - ), - onPressed: - () async { - if (model - .parentProducts[ - index] - .rxMessage == - null) { - GifLoaderDialogUtils - .showMyDialog( - context); - await addToCartFunction( - 1, - model - .parentProducts[ - index] - .id); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.push( - context, - FadePage( - page: - CartOrderPage())); - } else { - AppToast.showErrorToast( - message: TranslationBase.of( - context) - .needPrescription); - } - }), - ) - : Container(), - ], + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model.parentProducts[index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model - .parentProducts[index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).noData, + // 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], + ), ), + ) + : Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], ), ), ) @@ -1260,17 +962,16 @@ class _ParentCategorisePageState extends State { ), ), ), - )); + ))); } addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1278,8 +979,7 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index 1b221454..13a97866 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -5,12 +5,11 @@ import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page. import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.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:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class PaymentService extends StatelessWidget { @@ -21,151 +20,31 @@ class PaymentService extends StatelessWidget { Widget build(BuildContext context) { projectViewModel = Provider.of(context); model = Provider.of(context); + List paymentServiceList = getPaymentServiceList(context); return AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).paymentService, body: SingleChildScrollView( child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.all(20.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: AdvancePaymentPage())), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).payment, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).paymentOnline, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10), - child: Image.asset( - 'assets/images/online_payment_icon.png', - fit: BoxFit.fill, - height: 55, - width: double.infinity, - ), - ), - ], - ), - ), - ), - ), - //if(!projectViewModel.havePrivilege(33)) - Expanded( - child: InkWell( - onTap: () => navigateToToDoPage(context), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).onlineCheckIn, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).appointment, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Align( - alignment: !projectViewModel.isArabic - ? Alignment.centerRight - : Alignment.centerLeft, - child: Image.asset( - 'assets/images/device_icon.png', - height: 55, - ), - ), - ], - ), - ), - ), - ) - ], - ), - //if(!projectViewModel.havePrivilege(33)) - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, FadePage(page: MyBalancePage())), - child: Container( - margin: EdgeInsets.all(5.0), - padding: EdgeInsets.all(9), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.0), - shape: BoxShape.rectangle), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).hmg, - color: HexColor('#B61422'), - bold: true, - ), - Texts( - TranslationBase.of(context).wallet, - fontSize: 14, - fontWeight: FontWeight.normal, - ), - SizedBox( - height: 12, - ), - Align( - alignment: !projectViewModel.isArabic - ? Alignment.centerRight - : Alignment.centerLeft, - child: Image.asset( - 'assets/images/new-design/check-in.png', - height: 55, - ), - ), - ], - ), - ), - ), - ), - Expanded( - child: Container(), - ) - ], + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: paymentServiceList.length, + itemBuilder: (BuildContext context, int index) { + return paymentServiceList[index]; + }, + ), ), ], ), @@ -174,13 +53,65 @@ class PaymentService extends StatelessWidget { ); } + List getPaymentServiceList(BuildContext context) { + List medical = List(); + + medical.add( + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: AdvancePaymentPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).payment, + imagePath: 'assets/images/new-design/online_payment_icon.png', + subTitle: TranslationBase.of(context).paymentOnline, + isPngImage: true, + width: 65.0, + height: 55.0, + ), + ), + ); + + medical.add( + InkWell( + onTap: () { + navigateToToDoPage(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).onlineCheckIn, + imagePath: 'assets/images/device_icon.png', + subTitle: TranslationBase.of(context).appointment, + isPngImage: true, + width: 45.0, + height: 45.0, + ), + ), + ); + + medical.add( + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyBalancePage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).hmg, + imagePath: 'assets/images/check-in.png', + subTitle: TranslationBase.of(context).wallet, + isPngImage: true, + width: 45.0, + height: 45.0, + ), + ), + ); + return medical; + } + navigateToToDoPage(BuildContext context) { if (projectViewModel.isLogin) { if (model.count != 0) { Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); } else { - AppToast.showErrorToast( - message: TranslationBase.of(context).upcomingEmpty); + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); } } else { Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 2b88d30a..46c5e7a3 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -48,7 +48,7 @@ class _ProductCheckTypeWidgetState extends State { deleteWishListItem(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); GifLoaderDialogUtils.showMyDialog(context); - await x.deleteWishlistData(itemID); + await x.deleteWishlistData(itemID, context); await widget.model.getWishlistData(isLocalLoader: true); GifLoaderDialogUtils.hideDialog(context); } diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart index 37e2fc8c..afa5382f 100644 --- a/lib/pages/pharmacies/compare-list.dart +++ b/lib/pages/pharmacies/compare-list.dart @@ -1,26 +1,35 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; class CompareList with ChangeNotifier { List _product = []; List get productListItems => _product; - void addItem(data) { + void addItem(data, context) { if (_product.length == 0) { _product.add(data); - AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg + // 'You have added a product to the Compare list' + ); } else { for (int i = 0; i < _product.length; i++) { if (_product.length <= 4 && _product[i].id != data.id) { _product.add(data); - AppToast.showSuccessToast(message: 'You have added a product to the Compare list'); + AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg + // 'You have added a product to the Compare list' + ); break; } else if(_product[i].id == data.id){ - AppToast.showErrorToast(message: 'the item is already in the list'); + AppToast.showErrorToast(message:TranslationBase.of(context).itInListMsg + // 'the item is already in the list' + ); } else if(_product.length == 4){ - AppToast.showErrorToast(message: 'your compare list is full'); + AppToast.showErrorToast(message: TranslationBase.of(context).compareListFull + // 'your compare list is full' + ); } } } diff --git a/lib/pages/pharmacies/medicine_search_screen.dart b/lib/pages/pharmacies/medicine_search_screen.dart index 5c31f2de..f945c545 100644 --- a/lib/pages/pharmacies/medicine_search_screen.dart +++ b/lib/pages/pharmacies/medicine_search_screen.dart @@ -1,20 +1,19 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart'; -import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/drug_item.dart'; -import 'package:diplomaticquarterapp/core/service/pharmacies_service.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/pharmacies_list_screen.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../base/base_view.dart'; class MedicineSearch extends StatelessWidget { final textController = TextEditingController(); diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index fe04784b..15960b30 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -1,13 +1,12 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/pages/final_products_page.dart'; -import 'package:diplomaticquarterapp/pages/login/register-info.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -36,106 +35,121 @@ class _ProductBrandsPageState extends State { isPharmacy: true, isShowDecPage: false, body: SingleChildScrollView( - child: Container( - child: Column( - children: [ - Container( - color: Colors.white, - alignment: languageID == 'ar' - ? Alignment.topRight - : Alignment.topLeft, - padding: languageID == 'ar' - ? EdgeInsets.only(right: 10.0, top: 10.0) - : EdgeInsets.only(left: 10.0, top: 10.0), - child: Text( - TranslationBase.of(context).topBrands, - style: TextStyle( - fontWeight: FontWeight.bold, + child: NetworkBaseView( + baseViewModel: model, + isLocalLoader:true, + child: Container( + child: Column( + children: [ + Container( + color: Colors.white, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10.0, top: 10.0) + : EdgeInsets.only(left: 10.0, top: 10.0), + child: Text( + TranslationBase.of(context).topBrands, + style: TextStyle( + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - height: 220, - width: double.infinity, - color: Colors.white, - child: topBrand(context), - ), - SizedBox( - height: 10, - ), - Container( - height: MediaQuery.of(context).size.height * 0.056, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), + Container( + height: 220, + width: double.infinity, color: Colors.white, + child: topBrand(context), ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.076, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, ), - onTap: () { - Navigator.push( - context, - FadePage(page: SearchBrandsPage()), - ); - }, + child: topBrand(context), ), - ), - SizedBox( - height: 10, - ), - Container( - height: 420, - width: double.infinity, - color: Colors.white, - child: ListView.builder( - itemCount: model.brandsListList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Container( - margin: EdgeInsets.only(top: 50, left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - languageID == 'ar' - ? Text(model.brandsListList[index].namen) - : Text(model.brandsListList[index].name), - SizedBox( - height: 3, - ), - Divider(height: 1, color: Colors.grey) - ], + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.066, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => FinalProductsPage( - id: model.brandsListList[index].id - .toString(), - )), - ); - }, + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + FadePage(page: SearchBrandsPage()), ); - }), - ), - ], + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 250, + width: double.infinity, + color: Colors.white, + child: ListView.builder( + itemCount: model.brandsListList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Container( + margin: EdgeInsets.only(top: 50, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + languageID == 'ar' + ? Text(model.brandsListList[index].namen) + : Text(model.brandsListList[index].name), + SizedBox( + height: 3, + ), + Divider(height: 1, color: Colors.grey) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage( + id: model.brandsListList[index].id + .toString(), + )), + ); + }, + ); + }), + ), + ], + ), ), ), ), diff --git a/lib/pages/pharmacies/screens/address-select-page.dart b/lib/pages/pharmacies/screens/address-select-page.dart index 6c39ba3f..9378fb3b 100644 --- a/lib/pages/pharmacies/screens/address-select-page.dart +++ b/lib/pages/pharmacies/screens/address-select-page.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -23,6 +22,7 @@ class AddressSelectPageTest extends StatelessWidget { "Set address", style: new TextStyle(color: Colors.white, fontSize: 14), ), + elevation: 0, color: Colors.blueAccent, disabledColor: Colors.blueAccent, ), diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart deleted file mode 100644 index d93c3637..00000000 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ /dev/null @@ -1,456 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:http/http.dart'; -import 'package:provider/provider.dart'; - -import 'cart-page/cart-order-preview.dart'; - -class CartOrderPage extends StatefulWidget { - - - const CartOrderPage({ Key key}) - : super(key: key); - - - @override - _CartOrderPageState createState() => _CartOrderPageState(); -} - -class _CartOrderPageState extends State { - bool isLoading = true; - - @override - void initState() { - super.initState(); - getData(); - - } - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context); - OrderPreviewViewModel model = Provider.of(context); - - final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - // baseViewModel: model, - isLoading: isLoading, - isLocalLoader: true, - child: AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - showHomeAppBarIcon: false, - isShowDecPage: true, - baseViewModel: model, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? Container( - height: height * 0.85, - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Image.asset( - "assets/images/pharmacy_module/payment.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), - SizedBox( - height: 120, - ) - ], - ), - ), - ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, -// 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), - ), - ); - } - - void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); - setState(() { - isLoading = false; - }); - } -} - -class OrderBottomWidget extends StatefulWidget { - final List addresses; - final double height; - - OrderBottomWidget(this.addresses, this.height); - - @override - _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); -} - -class _OrderBottomWidgetState extends State { - bool isAgree = false; - - @override - Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Divider( - color: Color(0xFFD6D6D6), - height: 1, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: widget.height * 0.070, - color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - isAgree = !isAgree; - }); - }, - child: Container( - width: 25.0, - height: widget.height * 0.070, - decoration: new BoxDecoration( - color: !isAgree ? Color(0xffeeeeee) : Colors.green, - shape: BoxShape.circle, - ), - child: !isAgree - ? null - : Padding( - padding: const EdgeInsets.all(0.0), - child: Icon( - Icons.check, - color: Colors.white, - size: 25, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - margin: const EdgeInsets.symmetric(vertical: 4), - child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, - fontSize: 13, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ), - InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, - child: Container( - child: Icon( - Icons.info, - size: 25, - color: Color(0xff005aff), -// color: Color(0xff005aff), - ), - ), - ), - ], - ), - ), - Container( - height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), - child: Row( - children: [ - Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}", - fontSize: projectProvider.isArabic ? 12 : 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), - child: Texts( - "${TranslationBase.of(context).inclusiveVat}", - fontSize: 8, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - RaisedButton( - onPressed: isAgree -// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 - ? () => { - if(cart.isCartItemsOutOfStock()){ - // Toast msg - AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) - }else { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } - } - : null, - child: new Text( - "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), - ), - color: Color(0xFF4CAF50), - disabledColor:Color(0xFF4CAF50), -// disabledColor: Color(0xff005aff), - ) -// RaisedButton( -// onPressed: isAgree -//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 -// ? () => { -// Navigator.push( -// context, -// FadePage( -// page: -// OrderPreviewPage(widget.addresses))) -// } -// : null, -// child: new Text( -// "${TranslationBase.of(context).checkOut}", -// style: new TextStyle( -// color: -// isAgree ? Colors.white : Colors.grey.shade300, -// fontSize: 14), -// ), -// color: Color(0xff005aff), -// disabledColor: Color(0xff005aff), -// ) - ], - ), - ), - ], - ) - : Container(); - } -} diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 31cfa666..70858fa9 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -1,10 +1,15 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; @@ -13,8 +18,12 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:http/http.dart'; import 'package:provider/provider.dart'; +import '../../../../locator.dart'; +import 'cart-order-preview.dart'; + class CartOrderPage extends StatefulWidget { final Function(int) changeTab; @@ -39,24 +48,23 @@ class _CartOrderPageState extends State { OrderPreviewViewModel model = Provider.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - // baseViewModel: model, - isLoading: isLoading, - isLocalLoader: true, - child: AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - //isBottomBar: true, - showHomeAppBarIcon: false, - isShowDecPage: false, - isMainPharmacyPages: true, - baseViewModel: model, - backButtonTab: - widget.changeTab != null ? () => widget.changeTab(0) : null, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || + return AppScaffold( + appBarTitle: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isPharmacy: true, + showHomeAppBarIcon: false, + isShowDecPage: false, + isMainPharmacyPages: true, + showPharmacyCart: false, + baseViewModel: model, + backButtonTab: () { + widget.changeTab(0); + }, + backgroundColor: Colors.white, + body: NetworkBaseView( + isLoading: isLoading, + isLocalLoader: true, + child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? Container( height: height * 0.85, @@ -91,32 +99,34 @@ class _CartOrderPageState extends State { : 0, (index) => ProductOrderItem( model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse + .shoppingCarts[index], () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.changeProductQuantity(model + .cartResponse.shoppingCarts[index]); + if (model.state != ViewState.Error) { + // appScaffold.appBar.badgeUpdater( + // '${value.quantityCount ?? 0}'); + } + if (model.state == + ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + GifLoaderDialogUtils.hideDialog( + context); + }, () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .deleteProduct(model.cartResponse .shoppingCarts[index]) .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } + GifLoaderDialogUtils.hideDialog( + context); }); })) ], @@ -187,7 +197,7 @@ class _CartOrderPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -202,7 +212,7 @@ class _CartOrderPageState extends State { endIndent: 0, ), Image.asset( - "assets/images/pharmacy_module/payment_image.png", + "assets/images/pharmacy_module/payment.png", width: mediaQuery.size.width - 20, height: 30.0, fit: BoxFit.scaleDown, @@ -239,14 +249,14 @@ class _CartOrderPageState extends State { ], ), ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), + ), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height, model, isLoading), ), ); } @@ -263,8 +273,10 @@ class _CartOrderPageState extends State { class OrderBottomWidget extends StatefulWidget { final List addresses; final double height; + final OrderPreviewViewModel model; + final bool isLoading; - OrderBottomWidget(this.addresses, this.height); + OrderBottomWidget(this.addresses, this.height, this.model, this.isLoading); @override _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); @@ -276,9 +288,9 @@ class _OrderBottomWidgetState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) + + return ! widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || + widget.model.cartResponse.shoppingCarts.length == 0) ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -292,7 +304,7 @@ class _OrderBottomWidgetState extends State { Container( height: widget.height * 0.070, color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.only(left: 15.0, right: 15.0), child: Row( children: [ InkWell( @@ -342,7 +354,8 @@ class _OrderBottomWidgetState extends State { child: Icon( Icons.info, size: 25, - color: Color(0xff005aff), + color: Color(0xFF4CAF50), +// color: Color(0xff005aff), ), ), ), @@ -351,7 +364,8 @@ class _OrderBottomWidgetState extends State { ), Container( height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + padding: EdgeInsets.only(left: 20.0, right: 20.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -366,7 +380,7 @@ class _OrderBottomWidgetState extends State { child: Row( children: [ Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", fontSize: projectProvider.isArabic ? 12 : 14, fontWeight: FontWeight.bold, ), @@ -384,7 +398,7 @@ class _OrderBottomWidgetState extends State { ), ), Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + "${widget.model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", fontSize: 10, color: Colors.grey, fontWeight: FontWeight.bold, @@ -394,12 +408,25 @@ class _OrderBottomWidgetState extends State { ), RaisedButton( onPressed: isAgree +// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) + if (widget.model.isCartItemsOutOfStock()) + { + // Toast msg + AppToast.showErrorToast( + message: TranslationBase.of(context) + .outOfStockMsg) + } + else + { + _navigateToAddressPage(widget + .model.user.patientIdentificationNo) + // Navigator.push( + // context, + // FadePage( + // page: + // OrderPreviewPage(widget.addresses))) + } } : null, child: new Text( @@ -409,9 +436,10 @@ class _OrderBottomWidgetState extends State { isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), - color: Color(0xff005aff), - disabledColor: Color(0xff005aff), - ), + color: Color(0xFF4CAF50), + disabledColor: Color(0xFF848484), +// disabledColor: Color(0xff005aff), + ) ], ), ), @@ -419,4 +447,24 @@ class _OrderBottomWidgetState extends State { ) : Container(); } + + _navigateToAddressPage(String identificationNo) { + Navigator.push( + context, + FadePage( + page: PharmacyAddressesPage( + orderPreviewViewModel: widget.model, + ))).then((result) async { + if (result != null) { + GifLoaderDialogUtils.showMyDialog(context); + var address = result; + widget.model.paymentCheckoutData.address = + Addresses.fromJson(address.toJson()); + await widget.model.getInformationsByAddress(identificationNo); + await widget.model.getShoppingCart(); + // widget.changeMainState(); + GifLoaderDialogUtils.hideDialog(context); + } + }); + } } diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 25c02dd0..0110984c 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -15,8 +15,9 @@ import 'lakum_widget.dart'; class OrderPreviewPage extends StatefulWidget { final List addresses; + final OrderPreviewViewModel model; - OrderPreviewPage(this.addresses); + OrderPreviewPage({this.addresses, this.model}); @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); @@ -33,9 +34,7 @@ class _OrderPreviewPageState extends State { } void getData() async { - if (isLoading) - await Provider.of(context, listen: false) - .getShoppingCart(); + if (isLoading) await Provider.of(context, listen: false).getShoppingCart(); setState(() { isLoading = false; }); @@ -45,7 +44,7 @@ class _OrderPreviewPageState extends State { Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - OrderPreviewViewModel model = Provider.of(context); + // OrderPreviewViewModel widget.model = Provider.of(context); return AppScaffold( appBarTitle: "${TranslationBase.of(context).checkOut}", isShowAppBar: true, @@ -54,7 +53,7 @@ class _OrderPreviewPageState extends State { isLoading: isLoading, isLocalLoader: true, backgroundColor: Colors.white, - // baseViewModel: model, + // baseViewModel: widget.model, body: Container( color: Color(0xFFF1F1F1), height: height * 0.90, @@ -63,19 +62,19 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(model, widget.addresses), + SelectAddressWidget(widget.model, widget.addresses, changeMainState, isUpdating: true,), SizedBox( height: 10, ), - SelectPaymentOptionWidget(model), + SelectPaymentOptionWidget(widget.model, changeMainState,isUpdating: true,), SizedBox( height: 10, ), - model.paymentCheckoutData.lacumInformation != null + widget.model.paymentCheckoutData.lacumInformation != null ? Container( child: Column( children: [ - LakumWidget(model), + LakumWidget(widget.model), SizedBox( height: 10, ), @@ -97,11 +96,8 @@ class _OrderPreviewPageState extends State { color: Colors.black, ), ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderPreviewItem( - model.cartResponse.shoppingCarts[index]), + widget.model.cartResponse.shoppingCarts != null ? widget.model.cartResponse.shoppingCarts.length : 0, + (index) => ProductOrderPreviewItem(widget.model.cartResponse.shoppingCarts[index]), ), ], ), @@ -109,7 +105,7 @@ class _OrderPreviewPageState extends State { Container( width: double.infinity, padding: EdgeInsets.all(8), - child: model.cartResponse.subtotal != null + child: widget.model.cartResponse.subtotal != null ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -132,7 +128,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotal).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -156,7 +152,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.totalAdditionalShippingCharge).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -180,7 +176,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.w500, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.w500, @@ -204,7 +200,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -219,9 +215,7 @@ class _OrderPreviewPageState extends State { : Container(), ), SizedBox( - height: model.cartResponse.shoppingCarts != null - ? height * 0.10 - : 0, + height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, ) ], ), @@ -229,10 +223,14 @@ class _OrderPreviewPageState extends State { ), ), bottomSheet: Container( - height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, + height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, color: Colors.white, - child: PaymentBottomWidget(model), + child: PaymentBottomWidget(widget.model), ), ); } + + changeMainState() { + setState(() {}); + } } 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 e0063878..6eee6528 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -40,7 +40,7 @@ class PaymentBottomWidget extends StatelessWidget { child: Row( children: [ Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xff929295), @@ -68,6 +68,7 @@ class PaymentBottomWidget extends StatelessWidget { ), Container( child: RaisedButton( + elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), side: BorderSide( @@ -85,10 +86,11 @@ class PaymentBottomWidget extends StatelessWidget { await model.makeOrder(); if (model.state == ViewState.Idle) { AppToast.showSuccessToast( - message: - "Order has been placed successfully!!"); + message: TranslationBase.of(context).compeleteOrderMsg + // "Order has been placed successfully!!" + ); openPayment( - model.orderListModel[0], model.user); + model.orderListModel[0], model.authenticatedUserObject.user); } else { AppToast.showErrorToast(message: model.error); } @@ -190,6 +192,8 @@ class PaymentBottomWidget extends StatelessWidget { 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/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index bf958a36..a1634e21 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -1,23 +1,10 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.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/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -25,51 +12,49 @@ import 'package:provider/provider.dart'; class SelectAddressWidget extends StatefulWidget { final OrderPreviewViewModel model; final List addresses; + final Function changeMainState; + final bool isUpdating; - SelectAddressWidget(this.model, this.addresses); + SelectAddressWidget(this.model, this.addresses, this.changeMainState, + {this.isUpdating = false}); @override _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); } class _SelectAddressWidgetState extends State { - Addresses address; + AddressInfo address; - _navigateToAddressPage() { - Navigator.push(context, FadePage(page: PharmacyAddressesPage())) - .then((result) { + _navigateToAddressPage(String identificationNo) { + Navigator.push(context, FadePage(page: PharmacyAddressesPage(orderPreviewViewModel: widget.model,isUpdate: widget.isUpdating,changeMainState: widget.changeMainState,))).then((result) async { if (result != null) { + GifLoaderDialogUtils.showMyDialog(context); address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); + widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson()); + await widget.model.getInformationsByAddress(identificationNo); + await widget.model.getShoppingCart(); + widget.changeMainState(); + GifLoaderDialogUtils.hideDialog(context); } - - /* setState(() { - if (result != null) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); - } - })*/ }); } @override void initState() { - if (widget.model.paymentCheckoutData.address != null) { - address = widget.model.paymentCheckoutData.address; - } super.initState(); } @override Widget build(BuildContext context) { OrderPreviewViewModel model = Provider.of(context); + if (widget.model.paymentCheckoutData.address != null) { + address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address.toJson()); + } return Container( color: Colors.white, child: address == null ? InkWell( - onTap: () => {_navigateToAddressPage()}, + onTap: () => {_navigateToAddressPage(model.user.patientIdentificationNo)}, child: Container( margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), child: Row( @@ -82,8 +67,7 @@ class _SelectAddressWidgetState extends State { ), Expanded( child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).selectAddress, fontSize: 14, @@ -117,8 +101,7 @@ class _SelectAddressWidgetState extends State { ), Expanded( child: Container( - padding: EdgeInsets.symmetric( - vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).shippingAddress, fontSize: 14, @@ -128,7 +111,7 @@ class _SelectAddressWidgetState extends State { ), ), InkWell( - onTap: () => {_navigateToAddressPage()}, + onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user.patientIdentificationNo)}, child: Texts( TranslationBase.of(context).changeAddress, fontSize: 12, @@ -193,8 +176,7 @@ class _SelectAddressWidgetState extends State { fit: BoxFit.scaleDown, ), Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( "${TranslationBase.of(context).shipBy}", fontSize: 12, @@ -206,9 +188,7 @@ class _SelectAddressWidgetState extends State { child: Image.asset( model.paymentCheckoutData.shippingOption == null ? "" - : model.paymentCheckoutData.shippingOption - .shippingRateComputationMethodSystemName == - "Shipping.FixedOrByWeight" + : model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart index 9234bb38..67692c5d 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -1,42 +1,28 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class SelectPaymentOptionWidget extends StatefulWidget { final OrderPreviewViewModel model; + final Function changeMainState; + final bool isUpdating; - SelectPaymentOptionWidget(this.model); + + SelectPaymentOptionWidget(this.model, this.changeMainState, {this.isUpdating = false}); @override - _SelectPaymentOptionWidgetState createState() => - _SelectPaymentOptionWidgetState(); + _SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState(); } class _SelectPaymentOptionWidgetState extends State { PaymentOption paymentOption; _navigateToPaymentOption() { - Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + Navigator.push(context, FadePage(page: PaymentMethodSelectPage(model: widget.model,changeMainState:widget.changeMainState,isUpdating: widget.isUpdating,))) .then((result) => { setState(() { if (result != null) { @@ -44,20 +30,21 @@ class _SelectPaymentOptionWidgetState extends State { widget.model.paymentCheckoutData.paymentOption = paymentOption; } + widget.changeMainState(); }) }); } @override void initState() { - if (widget.model.paymentCheckoutData.paymentOption != null) { - paymentOption = widget.model.paymentCheckoutData.paymentOption; - } super.initState(); } @override Widget build(BuildContext context) { + if (widget.model.paymentCheckoutData.paymentOption != null) { + paymentOption = widget.model.paymentCheckoutData.paymentOption; + } return Container( color: Colors.white, child: paymentOption == null @@ -75,8 +62,7 @@ class _SelectPaymentOptionWidgetState extends State { ), Expanded( child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).selectPaymentOption, fontSize: 14, diff --git a/lib/pages/pharmacies/screens/lacum-registration-page.dart b/lib/pages/pharmacies/screens/lacum-registration-page.dart index c40771b8..dc309c00 100644 --- a/lib/pages/pharmacies/screens/lacum-registration-page.dart +++ b/lib/pages/pharmacies/screens/lacum-registration-page.dart @@ -48,18 +48,18 @@ class _LakumRegistrationPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( - appBarTitle: - "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", + appBarTitle: "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", isShowAppBar: true, isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, backgroundColor: Colors.white, baseViewModel: model, body: Container( width: double.infinity, child: SingleChildScrollView( child: SizedBox( - height: - mediaQuery.size.height - 60 - mediaQuery.padding.top, + height: mediaQuery.size.height - 60 - mediaQuery.padding.top, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -130,35 +130,26 @@ class _LakumRegistrationPageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .prefferedLanguage, + TranslationBase.of(context).prefferedLanguage, fontSize: 13, fontWeight: FontWeight.normal, color: Color(0xff8a8a8a), ), InkWell( onTap: () { - RadioGroupDialog dialog = - new RadioGroupDialog( - context: context, - title: TranslationBase.of(context) - .prefferedLanguage, - okText: - TranslationBase.of(context) - .confirm, - cancelText: - TranslationBase.of(context) - .cancel_nocaps, - list: languages, - okFunction: (selectedValue) { - setState(() { - selectedLanguage = - selectedValue; - }); - print( - "selectedLanguage = ${selectedValue.name}"); - }, - cancelFunction: () => {}); + RadioGroupDialog dialog = new RadioGroupDialog( + context: context, + title: TranslationBase.of(context).prefferedLanguage, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + list: languages, + okFunction: (selectedValue) { + setState(() { + selectedLanguage = selectedValue; + }); + print("selectedLanguage = ${selectedValue.name}"); + }, + cancelFunction: () => {}); showDialog( barrierDismissible: false, context: context, @@ -170,11 +161,8 @@ class _LakumRegistrationPageState extends State { child: TextField( enabled: false, decoration: InputDecoration( - suffixIcon: - Icon(Icons.arrow_drop_down), - hintText: selectedLanguage == null - ? "${TranslationBase.of(context).prefferedLanguage}" - : "${selectedLanguage.name}", + suffixIcon: Icon(Icons.arrow_drop_down), + hintText: selectedLanguage == null ? "${TranslationBase.of(context).prefferedLanguage}" : "${selectedLanguage.name}", hintStyle: TextStyle( fontSize: 16, color: Colors.black, @@ -192,12 +180,10 @@ class _LakumRegistrationPageState extends State { ), Container( color: Colors.green, - margin: EdgeInsets.all(8), + margin: EdgeInsets.all(40), child: BorderedButton( TranslationBase.of(context).register, - backgroundColor: canSubmit - ? Color(0xff339933) - : Color(0xff99cc99), + backgroundColor: canSubmit ? Color(0xff339933) : Color(0xff99cc99), textColor: Colors.white, fontSize: 16, hPadding: 8, @@ -208,18 +194,13 @@ class _LakumRegistrationPageState extends State { context, FadePage( page: LakumTermsConditions( - widget - .patientIdentificationNo, - _firstNameController.text, - _lastNameController.text, - _mobileNumberController - .text, - selectedLanguage.id))) - .then((status) => { - if (status == 200) - {Navigator.pop(context, "")} - // back to previous page - }); + widget.patientIdentificationNo, _firstNameController.text, _lastNameController.text, _mobileNumberController.text, selectedLanguage.id))) + .then( + (status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }, + ); } : null, ), diff --git a/lib/pages/pharmacies/screens/lacum-setting-page.dart b/lib/pages/pharmacies/screens/lacum-setting-page.dart index 4f7f5fd6..7c402402 100644 --- a/lib/pages/pharmacies/screens/lacum-setting-page.dart +++ b/lib/pages/pharmacies/screens/lacum-setting-page.dart @@ -112,8 +112,8 @@ class _LakumSettingPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts( - "Activate LAKUM Account", + Texts(TranslationBase.of(context).ActivateLAKUMAccount, +// "Activate LAKUM Account", fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index fdf3cc78..c4415852 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -1,288 +1,256 @@ -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-setting-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-transfer-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-points-year-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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-activitaion-vida-page.dart'; class LakumMainPage extends StatelessWidget { + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLacumData(), - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).lakum, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - backgroundColor: Colors.white, - baseViewModel: model, - appBarIcons: _buildAppBarICons(context, model), - // preferredSize: mediaQuery.size.height * 0.20, - body: Container( - width: double.infinity, - child: SingleChildScrollView( - child: (model.lacumGroupInformation != null && - model.lacumGroupInformation - .lakumInquiryInformationObjVersion != - null) - ? Column( - children: [ - Stack( - children: [ - Container( - height: mediaQuery.size.height * 0.15, - color: Colors.green, - ), - Column( - children: [ - SizedBox( - height: mediaQuery.size.height * 0.05, - ), - Container( - width: mediaQuery.size.width * 1, - child: LakumBannerWidget( - model, mediaQuery, true)), - ], - ) - ], - ), - SizedBox( - height: 20, - ), - LakumHomeButtons(mediaQuery, model), - SizedBox( - height: 20, - ), - Container( - height: 100, - margin: EdgeInsets.symmetric(horizontal: 16), - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - LacumPointsWidget( - mediaQuery, - 1, - TranslationBase.of(context).balance, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalance, - null), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 2, - TranslationBase.of(context).gained, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .gainedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .gainedPointsAmountPerYear), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 3, - TranslationBase.of(context).consumed, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount != - null - ? int.parse(model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount) - : 0, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmountPerYear), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 4, - TranslationBase.of(context).transferred, - 0, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .transferPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .transferPointsAmountPerYear), - ], + onModelReady: (model) async { + await model.getLacumData(); + if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) { + navigateToLakumRegister(context); + } else { + if (model.lacumInformation.status == "Hold") { + Navigator.pushReplacement(context, FadePage(page: LakumActivationVidaPage())); + } + } + }, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).lakum, + isShowAppBar: true, + isPharmacy: true, + showPharmacyCart: false, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + appBarIcons: _buildAppBarICons(context, model), + // preferredSize: mediaQuery.size.height * 0.20, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: (model.lacumGroupInformation != null && model.lacumGroupInformation.lakumInquiryInformationObjVersion != null) + ? Column( + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.02, ), + Container(width: mediaQuery.size.width * 1, child: LakumBannerWidget(model, mediaQuery, true)), + ], + ) + ], + ), + SizedBox( + width: 8, + ), + LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), + SizedBox( + height: 20, + ), + Container( + height: 125, + margin: EdgeInsets.symmetric(horizontal: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + LacumPointsWidget(mediaQuery, 1, TranslationBase.of(context).balance, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance, null), + SizedBox( + width: 8, ), + LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), SizedBox( - height: 20, + width: 8, ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + : 0, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), SizedBox( - height: 8, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + width: 8, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/expired_icon.png", - fit: BoxFit.fill, - width: 25, - height: 25, - ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts( - "Expired", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points", - fontWeight: FontWeight.bold, + LacumPointsWidget(mediaQuery, 4, TranslationBase.of(context).transferred, 0, model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPoints, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPointsAmountPerYear), + ], + ), + ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + : 0, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), + SizedBox( + width: 8, + ), + SizedBox( + height: 8, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context).expiryDate, +// "Expired", fontSize: 14, ), - ], - ), + ) + ], ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints}${TranslationBase.of(context).lakumPoint} ", + fontWeight: FontWeight.bold, + fontSize: 14, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", - fit: BoxFit.fill, - width: 20, - height: 25, - ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts( - "Waiting gained", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", - fontWeight: FontWeight.bold, + ], + ), + ), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", + fit: BoxFit.fill, + width: 20, + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context).Waitinggained, +// "Waiting gained", fontSize: 14, ), - ], - ), + ) + ], ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", - fit: BoxFit.fill, - width: 25, - height: 25, - ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts( - "Will Be Expired", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points", - fontWeight: FontWeight.bold, + ])), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context).WillBeExpired, +// "Will Be Expired", fontSize: 14, ), - ], - ), + ) + ], ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, ), ], - ) - : Container(), - ), - ), - )); + ), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + ), + + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ], + ) + : Container(), + ), + ), + ), + ); + } + + navigateToLakumRegister(BuildContext context) { + Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo))); } } @@ -292,12 +260,7 @@ List _buildAppBarICons(BuildContext context, LacumViewModel model) { icon: Icon(Icons.settings), color: Colors.white, onPressed: () { - Navigator.push( - context, - FadePage( - page: LakumSettingPage( - model.lacumInformation, model.lacumGroupInformation))) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); }, ), ]; @@ -319,9 +282,7 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Account activate click"); - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LakumActivationVidaPage())).then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -364,12 +325,7 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Lacum transfer click"); - Navigator.push( - context, - FadePage( - page: LacumTransferPage(model.lacumInformation, - model.lacumGroupInformation))) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -420,8 +376,7 @@ class LacumPointsWidget extends StatelessWidget { Color titleColor; final List pointsAmountPerYear; - LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, - this.point, this.pointsAmountPerYear) { + LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, this.point, this.pointsAmountPerYear) { if (pointType == 1) { titleColor = Color(0xffefefef); } else if (pointType == 2) { @@ -439,16 +394,16 @@ class LacumPointsWidget extends StatelessWidget { onTap: () { if (pointType != 1) { if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { - Navigator.push(context, - FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + Navigator.push(context, FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); } else { + AppToast.showErrorToast(message: TranslationBase.of(context).lakumMsg); // show snackBar No Details Points are there } } }, child: Container( - width: mediaQuery.size.width / 2 - 16, - padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 4), + width: mediaQuery.size.width / 2 - 25, + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 2), decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), @@ -495,7 +450,8 @@ class LacumPointsWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "RIYAL", + TranslationBase.of(context).RIYAL, +// "RIYAL", fontSize: 13, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, @@ -521,12 +477,13 @@ class LacumPointsWidget extends StatelessWidget { ), Expanded( child: Container( - margin: EdgeInsets.only(left: 4), + margin: EdgeInsets.only(left: 8, right: 8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - "POINT", + TranslationBase.of(context).point, +// "POINT", fontSize: 12, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, diff --git a/lib/pages/pharmacies/screens/lakum-points-month-page.dart b/lib/pages/pharmacies/screens/lakum-points-month-page.dart index 47270eee..26c88755 100644 --- a/lib/pages/pharmacies/screens/lakum-points-month-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-month-page.dart @@ -26,7 +26,7 @@ class _LakumPointsMonthPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( - title: "Lakum points", + title: TranslationBase.of(context).LakumPoint, isShowAppBar: true, isShowDecPage: false, backgroundColor: Colors.white, diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart index f7b6d9e6..df333cdf 100644 --- a/lib/pages/pharmacies/screens/lakum-points-year-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.d import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lakum-point-table-row-widget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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'; @@ -26,7 +27,7 @@ class _LakumPointsYearPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( - title: "Lakum points", + title: TranslationBase.of(context).LakumPoint, isShowAppBar: true, isShowDecPage: false, backgroundColor: Colors.white, @@ -143,8 +144,8 @@ class LacumPointsYearWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - "POINT", + Texts(TranslationBase.of(context).point, +// "POINT", fontSize: 12, fontWeight: FontWeight.bold, color: isSelected ? Colors.white : Colors.black, @@ -172,8 +173,8 @@ class LacumPointsYearWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Texts( - "RIYAL", + Texts(TranslationBase.of(context).sar, +// "RIYAL", fontSize: 13, fontWeight: FontWeight.bold, color: isSelected ? Colors.white : Colors.black, diff --git a/lib/pages/pharmacies/screens/order-preview-page.dart b/lib/pages/pharmacies/screens/order-preview-page.dart deleted file mode 100644 index d9646fcf..00000000 --- a/lib/pages/pharmacies/screens/order-preview-page.dart +++ /dev/null @@ -1,48 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class OrderPreviewPage extends StatelessWidget { - @override - Widget build(BuildContext context) { - return BaseView( - builder: (_, model, wi) => AppScaffold( - title: "Shopping Cart", - isShowAppBar: true, - isShowDecPage: false, - baseViewModel: model, - backgroundColor: Colors.white, - body: Container( - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon(Icons.delete_outline_sharp, color: Colors.grey.shade800,), - onTap: () => {}, - ), - const Divider( - color: Colors.grey, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - - ], - ), - ), - ), - ), - ), - ); - } -} - diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 8cdbaf3c..978afae3 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -1,11 +1,25 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/theme/colors.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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'cart-page/cart-order-preview.dart'; + class PaymentMethodSelectPage extends StatefulWidget { + final OrderPreviewViewModel model; + final bool isUpdating; + final Function changeMainState; + + const PaymentMethodSelectPage( + {Key key, this.model, this.isUpdating = false, this.changeMainState}) + : super(key: key); + @override _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); @@ -20,8 +34,9 @@ class _PaymentMethodSelectPageState extends State { double cardWidth = screenSize.width / 2 - 32; return AppScaffold( - title: "Payment method", + appBarTitle: TranslationBase.of(context).paymentMethod, isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, body: Container( width: double.infinity, @@ -30,64 +45,48 @@ class _PaymentMethodSelectPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Center( - child: Texts( + child: Text( TranslationBase.of(context).selectPaymentOption, - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.black, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.black, + ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), child: Column( children: [ - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.meda, - () => { - setState(() { - selectedPaymentOption = PaymentOption.meda; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.sadad, - () => { - setState(() { - selectedPaymentOption = PaymentOption.sadad; - }) - }), - ], - ), - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.visa, - () => { - setState(() { - selectedPaymentOption = PaymentOption.visa; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.mastercard, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.mastercard; - }) - }), - ], - ), PaymentMethodCard( - (cardWidth * 2 + 32), + cardWidth, + selectedPaymentOption, + PaymentOption.meda, + () => { + setState(() { + selectedPaymentOption = PaymentOption.meda; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.visa, + () => { + setState(() { + selectedPaymentOption = PaymentOption.visa; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.mastercard, + () => { + setState(() { + selectedPaymentOption = PaymentOption.mastercard; + }) + }), + PaymentMethodCard( + cardWidth, selectedPaymentOption, PaymentOption.installments, () => { @@ -96,6 +95,16 @@ class _PaymentMethodSelectPageState extends State { PaymentOption.installments; }) }), + if (Platform.isIOS) + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.applepay, + () => { + setState(() { + selectedPaymentOption = PaymentOption.applepay; + }) + }), ], ), ), @@ -103,18 +112,32 @@ class _PaymentMethodSelectPageState extends State { ), ), bottomSheet: Container( - height: screenSize.height * 0.08, - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: BorderedButton( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), + child: DefaultButton( TranslationBase.of(context).next, - backgroundColor: Color(0xff5AB154), - textColor: Colors.white, - fontSize: 16, - hPadding: 8, - vPadding: 12, - handler: selectedPaymentOption != null - ? () => {Navigator.pop(context, selectedPaymentOption)} + selectedPaymentOption != null + ? () { + widget.model.paymentCheckoutData.paymentOption = + selectedPaymentOption; + if (widget.isUpdating) { + widget.changeMainState(); + Navigator.pop(context); + return; + } else { + Navigator.push( + context, + FadePage( + page: OrderPreviewPage( + model: widget.model, + ), + ), + ); + } + // Navigator.pop(context, selectedPaymentOption); + } : null, + color: Color(0xff5AB154), ), ), ); @@ -138,50 +161,68 @@ class PaymentMethodCard extends StatelessWidget { isSelected = true; } - return InkWell( - onTap: selectMethod, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), - child: Stack( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), - margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), - decoration: new BoxDecoration( - color: Colors.grey.shade100, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.fromBorderSide(BorderSide( - color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, - width: 0.8, - )), - ), - width: cardWidth, - child: Image.asset( - getPaymentOptionImage(paymentOption), - fit: BoxFit.cover, - ), - ), - if (isSelected) - Positioned( - right: 1, - child: Icon( - Icons.check_circle, - color: Color(0xff20BC11), - size: 30, + return Container( + width: MediaQuery.of(context).size.width * 0.99, + child: InkWell( + onTap: selectMethod, + 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: isSelected + ? 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( + isSelected + ? CustomColors.accentColor + : Colors.transparent, + 100, + Colors.grey, + 0.5), ), - ), - ], + mWidth(12), + Container( + height: 70.0, + width: 70.0, + child: Image.asset(getPaymentOptionImage(paymentOption)), + ), + mFlex(1), + if (isSelected) + 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, + ), + ), + ), + ], + ), + ), ), ), ); } String getPaymentOptionImage(PaymentOption paymentOption) { - String assetFile = "assets/images/pharmacy_module/payment/"; + String assetFile = "assets/images/new/payment/"; switch (paymentOption.index) { case 0: - return "${assetFile}mada.png"; + return "${assetFile}Mada.png"; break; case 1: return "${assetFile}sadad.png"; @@ -190,10 +231,13 @@ class PaymentMethodCard extends StatelessWidget { return "${assetFile}visa.png"; break; case 3: - return "${assetFile}mastercard.png"; + return "${assetFile}Mastercard.png"; break; case 4: - return "${assetFile}installment.png"; + return "${assetFile}installments.png"; + break; + case 5: + return "${assetFile}Apple_Pay.png"; break; default: return ""; diff --git a/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart index 87c1b97c..6c58970c 100644 --- a/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart +++ b/lib/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/tems-conditi import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 77eca9c6..1f90f454 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BestSellerWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewButtons.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/MostViewedWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/PrescriptionsWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ShopByBrandWidget.dart'; @@ -11,6 +12,15 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +bool isInWishlist = false; +int price = 0; +var itemID; +var product; +var customerId; +var item; +dynamic languageID; +List wishlistData; + class PharmacyPage extends StatefulWidget { @override _PharmacyPageState createState() => _PharmacyPageState(); @@ -46,11 +56,12 @@ class _PharmacyPageState extends State { //crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(model), PrescriptionsWidget(), - ShopByBrandWidget(), + //ShopByBrandWidget(), + MostViewedWidget(), RecentlyViewedWidget(), BestSellerWidget(), + //ShopByBrandWidget(), ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 9e717de6..13e94c87 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,82 +1,73 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + @override Widget build(BuildContext context) { return previousModel.productLocationService.length == 0 ? Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).noLocationAvailable, - ), - ) + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: previousModel.productLocationService.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(previousModel - .productLocationService[index].projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - previousModel.productLocationService[index] - .locationDescription + - "\n" + - convertCityName( - previousModel.productLocationService[0].cityName - .toString(), + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: previousModel.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(previousModel.productLocationService[index].projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), + style: TextStyle(fontSize: 12), ), - style: TextStyle(fontSize: 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], ), - ), - ], - ), - Divider(height: 1.2, color: Colors.grey) - ], - ), - ); - }, - ); + Divider(height: 1.2, color: Colors.grey) + ], + ), + ); + }, + ); } convertCityName(txt) { diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 19286b6a..644ab693 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,17 +1,15 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; -import '../../cart-page/cart-order-page.dart'; -import '../product-detail.dart'; class FooterWidget extends StatefulWidget { final bool isAvailable; @@ -26,13 +24,8 @@ class FooterWidget extends StatefulWidget { int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, - {this.quantity, - this.isOverQuantity = false, - this.addToCartFunction, - this.addToShoppingCartFunction, - this.model}); + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, + {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -41,8 +34,7 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -52,7 +44,7 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: HexColor('#707070'), width: 0), + border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, @@ -76,9 +68,8 @@ class _FooterWidgetState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - "Quantity", - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), + TranslationBase.of(context).quantity, + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), ), InkWell( @@ -94,18 +85,14 @@ class _FooterWidgetState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, ), Container( - height: 50.0, + height: 35.0, child: ListView( scrollDirection: Axis.horizontal, children: [ SizedBox( width: 5, ), - for (int i = 1; i <= 10; i++) - QuantityBox( - label: i, - onTapFunc: onChangeValue, - isSelected: widget.quantity == i), + for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), Container( width: 100, decoration: BoxDecoration( @@ -113,16 +100,14 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + decoration: InputDecoration(labelText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; } else { setState(() { widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { + if (widget.quantity >= widget.quantityLimit) { widget.isOverQuantity = true; } else { widget.isOverQuantity = false; @@ -142,104 +127,100 @@ class _FooterWidgetState extends State { : Container( height: 20, ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70, - height: 50, - child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Text( - widget.quantity.toString(), - style: TextStyle(fontSize: 20), + Container( + height: 58, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 90, + height: 60, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + widget.quantity.toString(), + style: TextStyle(fontSize: 20), + ), ), - ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), ), - ), - ], + ], + ), + onPressed: widget.isAvailable && !widget.item.isRx + ? () { + setState(() { + if (showUI) { + quantityUI = 80; + showUI = false; + } else { + quantityUI = 160; + showUI = true; + } + }); + } + : null, ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 80; - showUI = false; - } else { - quantityUI = 160; - showUI = true; - } - }); - }, ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.45, - child: SecondaryButton( - label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity == 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - disableColor: Color(0xFF4CAF50), - onTap: () async { - if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); - } else - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); - }, - fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50), - borderRadius: 3, - color: Color(0xFF4CAF50), + SizedBox( + width: 10, ), - ), - SizedBox( - width: 5, - ), - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: SecondaryButton( - label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - onTap: () async { - await widget.addToShoppingCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - fontWeight: FontWeight.w600, - borderColor: Colors.grey[800], - borderRadius: 3, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null - ? Colors.grey - : Colors.grey[800], + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + }, + fontWeight: FontWeight.w600, + borderColor: Color(0xFF4CAF50), + borderRadius: 3, + color: Color(0xFF4CAF50), + ), + ), + SizedBox( + width: 5, + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else { + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + + } + }, + fontWeight: FontWeight.w600, + borderColor: Colors.grey[800], + borderRadius: 3, + disableColor: Colors.grey[700], + color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.isRx ? Colors.grey : Colors.grey[800], + ), ), - ), - ], + ], + ), ), ], ), diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 237c1ed8..ad802349 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -1,10 +1,9 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; @@ -12,10 +11,11 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/sh import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/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 'availability_info.dart'; import 'details_info.dart'; @@ -89,8 +89,12 @@ class __ProductDetailPageState extends State { } Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( allowAny: true, + onModelReady: (model) async { + await model.getProductReviewsData(widget.product.id).then((value) {}); + }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).productDetails, isShowAppBar: true, @@ -106,8 +110,8 @@ class __ProductDetailPageState extends State { deleteFromWishlistFunction: () async { await deleteFromWishlistFunction(itemID: itemID, model: model); }, - isInWishList:isInWishList, - addToCartFunction:addToCartFunction , + isInWishList: isInWishList, + addToCartFunction: addToCartFunction, ), body: SingleChildScrollView( child: Column( @@ -125,8 +129,7 @@ class __ProductDetailPageState extends State { fit: BoxFit.contain, ), ), - if (widget.product.discountDescription != null) - DiscountDescription(product: widget.product) + if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) ], ), ), @@ -144,17 +147,15 @@ class __ProductDetailPageState extends State { setState(() {}); }, deleteFromWishlistFunction: (item) { - deleteFromWishlistFunction( - itemID: item, model: model); + deleteFromWishlistFunction(itemID: item, model: model); setState(() {}); }, notifyMeWhenAvailable: (context, itemId) { - notifyMeWhenAvailable( - itemId: itemId, - customerId: customerId, - model: model); + notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model); }, isInWishList: isInWishList, + isStockAvailable: model.isStockAvailable, + stockAvailability: projectViewModel.isArabic ? model.stockAvailabilityn : model.stockAvailability, ), ), SizedBox( @@ -167,8 +168,7 @@ class __ProductDetailPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 15, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -205,16 +205,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isDetails - ? Colors.green - : Colors.transparent, + color: isDetails ? Colors.green : Colors.transparent, ) ], ), @@ -225,14 +221,10 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - if (widget.product.approvedTotalReviews > - 0) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductReviewsData( - widget.product.id); - GifLoaderDialogUtils.hideDialog( - context); + if (widget.product.approvedTotalReviews > 0) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductReviewsData(widget.product.id); + GifLoaderDialogUtils.hideDialog(context); } else { model.clearReview(); } @@ -244,16 +236,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isReviews - ? Colors.green - : Colors.transparent, + color: isReviews ? Colors.green : Colors.transparent, ), ], ), @@ -264,9 +252,8 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductLocationData(); + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductLocationData(widget.product.sku); GifLoaderDialogUtils.hideDialog(context); setState(() { @@ -277,16 +264,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isAvailability - ? Colors.green - : Colors.transparent, + color: isAvailability ? Colors.green : Colors.transparent, ), ], ), @@ -315,59 +298,68 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - RecommendedProducts(product: widget.product,productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction(itemID: itemID, model: model); - }, deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction(itemID: itemID, model: model); - },) + if (projectViewModel.isLogin) + RecommendedProducts( + product: widget.product, + productDetailViewModel: model, + addToWishlistFunction: (itemID) async { + await addToWishlistFunction(itemID: itemID, model: model); + }, + deleteFromWishlistFunction: (itemID) async { + await deleteFromWishlistFunction(itemID: itemID, model: model); + }, + ) ], ), ), - bottomSheet: FooterWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product, - quantity: quantity, - isOverQuantity: isOverQuantity, - addToCartFunction: addToCartFunction, - addToShoppingCartFunction: addToShoppingCartFunction, - model: model, - ), + // : AppCircularProgressIndicator(), + bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal + ? FooterWidget( + model.isStockAvailable, + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + model.stockQuantity, + widget.product, + quantity: quantity, + isOverQuantity: isOverQuantity, + addToCartFunction: addToCartFunction, + addToShoppingCartFunction: addToShoppingCartFunction, + model: model, + ) + : SizedBox(), )); } - addToShoppingCartFunction({quantity,itemID,ProductDetailViewModel model})async{ - await model.addToCartData(quantity,itemID); + addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.addToCartData(quantity, itemID, context); + GifLoaderDialogUtils.hideDialog(context); + if (model.state != ViewState.ErrorLocal) Utils.navigateToCartPage(); } addToWishlistFunction({itemID, ProductDetailViewModel model}) async { isInWishList = true; - await model.addToWishlistData(itemID); + await model.addToWishlistData(itemID, context); setState(() {}); } deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async { isInWishList = false; - await model.deleteWishlistData(itemID); + await model.deleteWishlistData(itemID, context); setState(() {}); } - addToCartFunction( - {quantity, - itemID, - ProductDetailViewModel model, - }) async { + + addToCartFunction({ + quantity, + itemID, + ProductDetailViewModel model, + }) async { GifLoaderDialogUtils.showMyDialog(context); - await model.addToCartData(quantity, itemID); + await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); } } - - -notifyMeWhenAvailable( - {itemId, customerId, ProductDetailViewModel model}) async { - await model.notifyMe(customerId, itemId); +notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { + await model.notifyMe(customerId, itemId, context); } diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 6d8ea11d..0f25b236 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -20,16 +19,13 @@ class ProductNameAndPrice extends StatefulWidget { final Function notifyMeWhenAvailable; final Function addToWishlistFunction; final Function deleteFromWishlistFunction; + final bool isStockAvailable; + final String stockAvailability; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); ProductNameAndPrice(this.context, this.item, - {this.customerId, - this.isInWishList, - this.notifyMeWhenAvailable, - this.addToWishlistFunction, - this.deleteFromWishlistFunction}); + {this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, this.isStockAvailable = true, this.stockAvailability}); @override _ProductNameAndPriceState createState() => _ProductNameAndPriceState(); @@ -51,25 +47,18 @@ class _ProductNameAndPriceState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(widget.item.price.toString() + " " + "SR", - fontWeight: FontWeight.bold, fontSize: 20), + Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20), Texts( - projectViewModel.isArabic - ? widget.item.stockAvailabilityn - : widget.item.stockAvailability, + widget.stockAvailability, fontWeight: FontWeight.bold, fontSize: 15, - color: widget.item.stockAvailability == 'Out of stock' - ? Colors.red - : Colors.green, + color: widget.isStockAvailable ? Colors.green : Colors.red, ), // SizedBox(width: 20), if (widget.authenticatedUserObject.isLogin) - widget.item.stockAvailability == 'Out of stock' && - widget.customerId != null + !widget.isStockAvailable && widget.customerId != null ? InkWell( - onTap: () => widget.notifyMeWhenAvailable( - context, widget.item.id), + onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), child: Row(children: [ Texts( TranslationBase.of(context).notifyMe, @@ -85,23 +74,15 @@ class _ProductNameAndPriceState extends State { ]), ) : IconWithBg( - icon: !widget.isInWishList - ? Icons.favorite_border - : Icons.favorite, - color: !widget.isInWishList - ? Colors.white - : Colors.red[800], + icon: !widget.isInWishList ? Icons.favorite_border : Icons.favorite, + color: !widget.isInWishList ? Colors.white : Colors.red[800], onPress: () async { { if (widget.customerId != null) { if (!widget.isInWishList) { - - await widget - .addToWishlistFunction(widget.item.id); - + await widget.addToWishlistFunction(widget.item.id); } else { - await widget - .deleteFromWishlistFunction(widget.item.id); + await widget.deleteFromWishlistFunction(widget.item.id); } } else { return; @@ -118,13 +99,9 @@ class _ProductNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: projectViewModel.isArabic - ? Alignment.topRight - : Alignment.topLeft, + alignment: projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, child: Text( - projectViewModel.isArabic - ? widget.item.namen - : widget.item.name, + projectViewModel.isArabic ? widget.item.namen : widget.item.name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), @@ -140,8 +117,7 @@ class _ProductNameAndPriceState extends State { child: Row( children: [ RatingBar.readOnly( - initialRating: double.parse( - widget.item.approvedRatingSum.toString()), + initialRating: double.parse(widget.item.approvedRatingSum.toString()), size: 15.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[400], @@ -153,11 +129,11 @@ class _ProductNameAndPriceState extends State { SizedBox( width: 10, ), - Texts( - "${widget.item.approvedRatingSum}", - fontWeight: FontWeight.bold, - fontSize: 12, - ), +// Texts( +// "${widget.item.approvedRatingSum}", +// fontWeight: FontWeight.bold, +// fontSize: 12, +// ), SizedBox( width: 30, ), @@ -172,19 +148,9 @@ class _ProductNameAndPriceState extends State { Row( children: [ Text( - projectViewModel.isArabic - ? widget.item.rxMessagen.toString() - : widget.item.rxMessage.toString(), + projectViewModel.isArabic ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), style: TextStyle(color: Colors.red, fontSize: 10), ), - SizedBox( - width: 5, - ), - Icon( - FontAwesomeIcons.questionCircle, - color: Colors.red, - size: 15.0, - ) ], ) ], diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 18277bad..f58438cf 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,8 +2,11 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -12,7 +15,6 @@ import 'package:provider/provider.dart'; import '../../../../../locator.dart'; import '../../../compare-list.dart'; -import '../../cart-page/cart-order-page.dart'; import 'icon_with_bg.dart'; class ProductAppBar extends StatelessWidget with PreferredSizeWidget { @@ -41,6 +43,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { @override Widget build(BuildContext context) { + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); return Container( color: Colors.white, child: FractionallySizedBox( @@ -73,11 +76,13 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { icon: Icons.shopping_cart, color: Colors.grey[800], onPress: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CartOrderPage()), - ); + + Navigator.pushAndRemoveUntil( + locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route r) => false); + // Navigator.push( + // context, + // MaterialPageRoute(builder: (context) => CartOrderPage()), + // ); }), if (Provider.of(context, listen: false) @@ -157,8 +162,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { Navigator.of(context).pop(); } } else { - AppToast.showErrorToast( - message: "you should add quantity"); + AppToast.showErrorToast(message: TranslationBase.of(context).addQuantity + // "you should add quantity" + ); } }), ListTile( @@ -185,7 +191,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { ), onTap: () { Provider.of(context, listen: false) - .addItem(specificationData); + .addItem(specificationData,context); Navigator.of(context).pop(); }, ), diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart index f1c0fb2e..b04201e5 100644 --- a/lib/pages/pharmacies/screens/recommended-product-page.dart +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -1,14 +1,8 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; dynamic languageID; bool isInWishlist = false; @@ -540,13 +534,13 @@ class _RecommendedProductPageState extends State addToWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlist = true; - await x.addToWishlistData(itemID); + await x.addToWishlistData(itemID, context); } deleteFromWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlist = false; - await x.addToWishlistData(itemID); + await x.addToWishlistData(itemID, context); } } diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index f053dee1..7ffe8d26 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -1,16 +1,16 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; class SearchBrandsPage extends StatefulWidget { @override @@ -24,11 +24,12 @@ class _SearchBrandsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.searchProducts(), builder: (BuildContext context, model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Search', + appBarTitle: TranslationBase.of(context).search, isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -49,24 +50,38 @@ class _SearchBrandsPageState extends State { key: _formKey, child: TextFields( autoFocus: true, - hintText: 'Search', + hintText: TranslationBase.of(context).search, fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'([A-Za-z0-9 a space])') +// ("[\u0621-\u064a-\ ]") + ) + ], + validator: (value) { + RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); + if (value.isEmpty) { + TranslationBase.of(context).pleaseEnterProductName; + }else if (!regExp.hasMatch(value)){ + AppToast.showErrorToast(message: TranslationBase.of(context).noArabicLetters); + } + return null; + }, onSaved: (value) { //searchMedicine(model, context); }, onSubmit: (value) { searchMedicine(model, context); - msg = 'No Result Found'; + msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { - return 'please Enter Product Name'; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +// return 'please Enter Product Name'; +// } +// return null; +// }, ), ), ), @@ -75,7 +90,7 @@ class _SearchBrandsPageState extends State { ), InkWell( child: Texts( - 'Cancel', + TranslationBase.of(context).cancel, fontSize: 17.0, fontWeight: FontWeight.w500, ), @@ -100,7 +115,7 @@ class _SearchBrandsPageState extends State { model.searchList.length == 0 ? Container( child: Text( - 'no data' + model.searchList.length.toString()), + TranslationBase.of(context).noData + model.searchList.length.toString()), ) : Expanded( child: Container( @@ -116,8 +131,9 @@ class _SearchBrandsPageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Container( - child: Text( - model.searchList[index].name, + child: Text( projectProvider.isArabic + ? model.searchList[index].namen + :model.searchList[index].name, style: TextStyle(fontSize: 20), ), ), diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index a2400e63..cb8560c4 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -2,13 +2,13 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; class ProductTileItem extends StatelessWidget { final AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -87,7 +87,7 @@ class ProductTileItem extends StatelessWidget { Stack( children: [ Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), alignment: Alignment.center, child: (item.images != null && item.images.length > 0) ? Image.network( @@ -101,17 +101,42 @@ class ProductTileItem extends StatelessWidget { height: itemHeight / 2, ), ), - Container( +// Container( +// width: item.rxMessage != null +// ? MediaQuery.of(context).size.width / 5 +// : 0, +// padding: EdgeInsets.all(4), +// decoration: BoxDecoration( +// color: Color(0xffb23838), +// borderRadius: +// BorderRadius.only(topLeft: Radius.circular(6)), +// ), +// child: item.rxMessage != null +// ? Texts( +// projectProvider.isArabic +// ? item.rxMessagen +// : item.rxMessage, +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ) +// : Texts(""), +// ) + ], + ), + Padding( + padding: EdgeInsets.fromLTRB(1,1,1,1), + child: Container( width: item.rxMessage != null - ? MediaQuery.of(context).size.width / 5 + ? MediaQuery.of(context).size.width / 1.0 : 0, - padding: EdgeInsets.all(4), + padding: EdgeInsets.fromLTRB(8,2,8,2), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + ), - child: item.rxMessage != null + child: item.rxMessage != null ? Texts( projectProvider.isArabic ? item.rxMessagen @@ -122,12 +147,11 @@ class ProductTileItem extends StatelessWidget { fontWeight: FontWeight.w400, ) : Texts(""), - ) - ], - ), - SizedBox(height: 8,), + ), + ), + // SizedBox(height: 4,), Padding( - padding: const EdgeInsets.symmetric(horizontal: 6.0), + padding: const EdgeInsets.symmetric(horizontal: 4.0), child: Texts( projectProvider.isArabic ? item.namen : item.name, regular: true, @@ -138,7 +162,7 @@ class ProductTileItem extends StatelessWidget { Expanded( child: Container( margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 4, vertical: 0, ), child: Column( @@ -146,7 +170,7 @@ class ProductTileItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: const EdgeInsets.only(top: 2, bottom: 2), child: Texts( "SAR ${item.price}", fontWeight: FontWeight.w600, @@ -155,15 +179,31 @@ class ProductTileItem extends StatelessWidget { ), Row( children: [ - Expanded( - child: StarRating( - totalAverage: item.approvedTotalReviews > 0 - ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .toDouble() - : 0, - forceStars: true), - ), + // Expanded( + RatingBar.readOnly( + initialRating: item.approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) +// StarRating( +// totalAverage: item.approvedTotalReviews > 0 +// ? (item.approvedRatingSum.toDouble() / +// item.approvedTotalReviews.toDouble()) +// .toDouble() +// : 0, +// forceStars: true), + // ), ], ), ], diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index a1153bcb..6302f263 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -1,10 +1,15 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.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/material.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:provider/provider.dart'; class BannerPager extends StatefulWidget { final PharmacyModuleViewModel _model; @@ -20,14 +25,16 @@ class _BannerPagerState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( child: Column( children: [ CarouselSlider( options: CarouselOptions( - aspectRatio: 7 / 2, + aspectRatio: 5 / 2, enlargeCenterPage: true, enableInfiniteScroll: false, + viewportFraction: 1.0, initialPage: 0, autoPlay: true, autoPlayInterval: Duration(seconds: 3), @@ -39,53 +46,44 @@ class _BannerPagerState extends State { }); }, ), - items: widget._model - .getBannerImagesUrl() - .mapIndexed( - (item, index) => InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: OffersCategorisePage())); - }, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 1.0), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5.0)), - child: Center( - child: index == 0 - ? Image.asset( - item, - fit: BoxFit.cover, - ) - : CachedNetworkImage( - imageUrl: item, - fit: BoxFit.fitWidth, - errorWidget: (context, url, error) => - SizedBox()), - ), + items: widget._model.getBannerImagesUrl(projectViewModel).mapIndexed( + (item, index) { + return InkWell( + onTap: () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 1.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Center( + child: index == 0 || index == 1 + ? Image.asset( + item, + fit: BoxFit.cover, + ) + : CachedNetworkImage(imageUrl: item, fit: BoxFit.fitWidth, errorWidget: (context, url, error) => SizedBox()), ), ), ), - ) - .toList(), + ); + }, + ).toList(), ), Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: widget._model - .getBannerImagesUrl() + .getBannerImagesUrl(projectViewModel) .mapIndexed( (item, index) => Container( width: 12.0, height: 4.0, - margin: - EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), + margin: EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), decoration: BoxDecoration( shape: BoxShape.rectangle, - color: _current == index - ? Color.fromRGBO(0, 250, 0, 0.9) - : Color.fromRGBO(0, 0, 0, 0.4), + color: _current == index ? Color.fromRGBO(0, 250, 0, 0.9) : Color.fromRGBO(0, 0, 0, 0.4), ), ), ) diff --git a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart index 1a33ce74..8a549b48 100644 --- a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart +++ b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart @@ -39,44 +39,44 @@ class GridViewButtons extends StatelessWidget { Navigator.push(context, FadePage(page: OffersCategorisePage())); }), ), - DashboardItem( - imageName: 'pharmacy_module/bg_2.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).medicationRefill, - 'assets/images/pharmacy_module/medication_icon.png', () { - Navigator.push( - context, FadePage(page: HomePrescriptionsPage())); - - // model.checkUserIsActivated().then((isActivated) { - // if (isActivated) { - // Navigator.push(context, FadePage(page: LakumMainPage())); - // } else { - // Navigator.push( - // context, FadePage(page: LakumActivationVidaPage())); - // } - // }); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_3.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).myPrescriptions, - 'assets/images/pharmacy_module/prescription_icon.png', () { - Navigator.push( - context, FadePage(page: HomePrescriptionsPage())); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_4.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard( - TranslationBase.of(context).searchAndScanMedication, - 'assets/images/pharmacy_module/search_scan_icon.png', - () {Navigator.push(context, FadePage(page: SearchProductsPage()));}), - ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_2.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).medicationRefill, + // 'assets/images/pharmacy_module/medication_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // + // // model.checkUserIsActivated().then((isActivated) { + // // if (isActivated) { + // // Navigator.push(context, FadePage(page: LakumMainPage())); + // // } else { + // // Navigator.push( + // // context, FadePage(page: LakumActivationVidaPage())); + // // } + // // }); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_3.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).myPrescriptions, + // 'assets/images/pharmacy_module/prescription_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_4.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard( + // TranslationBase.of(context).searchAndScanMedication, + // 'assets/images/pharmacy_module/search_scan_icon.png', + // () {Navigator.push(context, FadePage(page: SearchProductsPage()));}), + // ), ], ), ), diff --git a/lib/pages/pharmacies/widgets/home/GridViewCard.dart b/lib/pages/pharmacies/widgets/home/GridViewCard.dart index fd8bdada..8bdaf1f5 100644 --- a/lib/pages/pharmacies/widgets/home/GridViewCard.dart +++ b/lib/pages/pharmacies/widgets/home/GridViewCard.dart @@ -35,7 +35,7 @@ class GridViewCard extends StatelessWidget { text, color: Colors.white, bold: true, - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier * 1.3, ), ], ), diff --git a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart new file mode 100644 index 00000000..aa160baa --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart @@ -0,0 +1,59 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/MostViewedViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class MostViewedWidget extends StatelessWidget { + const MostViewedWidget({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getMostViewedProducts(), + allowAny: true, + builder: (_, model, wi) => NetworkBaseView( + isLocalLoader: true, + baseViewModel: model, + child: Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).mostViewed, + FinalProductsPage( + id: "", + productType: 4, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: MediaQuery.of(context).size.height / 3 + 20, + child: ListView.builder( + itemBuilder: (ctx, i) => ProductTileItem( + model.mostViewedProducts[i], + MediaQuery.of(context).size.height / 4 + 20), + scrollDirection: Axis.horizontal, + itemCount: model.mostViewedProducts.length, + ), + ) + else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 28556679..8dd59e63 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -1,20 +1,26 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.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/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class PrescriptionsWidget extends StatelessWidget { + AuthenticatedUserObject authenticatedUserObject = locator(); + @override Widget build(BuildContext context) { + + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) async { if (Provider.of(context, listen: false).isLogin) { @@ -22,35 +28,37 @@ class PrescriptionsWidget extends StatelessWidget { } }, allowAny: true, - builder: (_, model, wi) => model.prescriptionsList.length > 0 + builder: (_, model, wi) => model.prescriptionsList.length > 0 && authenticatedUserObject.isLogin ? NetworkBaseView( isLocalLoader: true, baseViewModel: model, child: Container( - height: model.prescriptionsList.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, child: Column( children: [ - ViewAllHomeWidget( - TranslationBase.of(context).myPrescription, - HomePrescriptionsPage()), + ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 14.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.only(right: 10.0, left: 10.0), + height: MediaQuery.of(context).size.height * 0.30, child: ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), - itemCount: model.prescriptionsList.length, - itemBuilder: (context, index) { - return Container( - height: MediaQuery.of(context).size.height * 0.3, - padding: EdgeInsets.only( - bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.prescriptionsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage( + prescriptions: model.prescriptionsList[index], + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.only(left: 8.0, right: 8.0), + margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( border: Border.all( color: Colors.grey, @@ -59,169 +67,124 @@ class PrescriptionsWidget extends StatelessWidget { ), color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( children: [ - Row( - children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 15.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: - Colors.transparent, - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, - ), - ), - ), - ]), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 1), - padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, - ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( - model.languageID == "ar" - ? model - .prescriptionsList[ - index] - .isInOutPatientDescriptionN - .toString() - : model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( - DateUtil.convertStringToDate( - model - .prescriptionsList[ - index] - .appointmentDate - .toString()) - .toString() - .substring(0, 10), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - ), - ) - ]), - ], + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 50, + height: 50, ), - ], + ), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + Column( + children: [ Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index] - .doctorTitle - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index] - .doctorName - .toString(), + padding: EdgeInsets.only(left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 3.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0)), + child: Text( + projectProvider.isArabic + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 15.0, - fontWeight: FontWeight.bold, ), - ), - ]), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index] - .clinicDescription - .toString(), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + DateUtil.convertStringToDate(model.prescriptionsList[index].appointmentDate.toString()).toString().substring(0, 10), style: TextStyle( - color: Colors.green, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .prescriptionsList[index] - .actualDoctorRate - .toDouble(), -// initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), ), ) ]), + ], + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), ]), - ); - }), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, + ), + ), + ), + Row(children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + SizedBox( + width: 130.0, + ), + Container( + child: Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + )), + ]), + ]), + ), + ); + }, + ), ), ], ), diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart index 14a53e72..7d10b886 100644 --- a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -125,8 +125,8 @@ class _LakumBannerWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - "IDENTIFICATION #", + Texts(TranslationBase.of(context).identificationNumber, +// "IDENTIFICATION #", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, @@ -143,8 +143,8 @@ class _LakumBannerWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - Texts( - "MEMBER SINCE", + Texts(TranslationBase.of(context).MEMBERSINCE, +// "MEMBER SINCE", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, @@ -168,8 +168,8 @@ class _LakumBannerWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - "MOBILE #", + Texts(TranslationBase.of(context).lakumMobile, +// "MOBILE #", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, diff --git a/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart b/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart index 6e4e2309..ad53efd0 100644 --- a/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart +++ b/lib/pages/pharmacies/widgets/lakum-point-table-row-widget.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart'; -import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; class LakumPointTableRowWidget extends StatefulWidget { diff --git a/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart index bddd2e3b..b2baa788 100644 --- a/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart +++ b/lib/pages/pharmacies/widgets/lakum_point_table_row_widget.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/points-expandable-notifier.dart'; -import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; class LakumPointTableRowWidget extends StatefulWidget { diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 4e4a0cc9..8b3f8502 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -56,7 +56,6 @@ class _OrderPageState extends State @override Widget build(BuildContext context) { - print("customerID" + widget.customerID); return BaseView( onModelReady: (model) => model.getOrder(widget.customerID, pageID), builder: (_, model, wi) => AppScaffold( @@ -115,7 +114,7 @@ class _OrderPageState extends State } return Container( width: MediaQuery.of(context).size.width, - child: model.orders.length != 0 + child: deliveredOrderList.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -382,7 +381,7 @@ class _OrderPageState extends State } return Container( width: MediaQuery.of(context).size.width, - child: model.orders.length != 0 + child: processingOrderList.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -824,7 +823,7 @@ class _OrderPageState extends State } } return Container( - child: model.orders.length != 0 + child: pendingOrderList.length != 0 ? SingleChildScrollView( child: Column( children: [ @@ -1093,7 +1092,7 @@ class _OrderPageState extends State } } return Container( - child: model.orders.length != 0 + child: cancelledOrderList.length != 0 ? SingleChildScrollView( child: Column( children: [ diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index aadb5a90..ee360bb1 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -6,9 +6,9 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -72,8 +72,7 @@ class _OrderDetailsPageState extends State { onModelReady: (model) { model.getOrderDetails(widget.orderModel.id).then((value) { setState(() { - isActiveDelivery = (value.orderStatusId == 995 && - (value.driverID != null && value.driverID.isNotEmpty)); + isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty)); }); }); }, @@ -111,39 +110,35 @@ class _OrderDetailsPageState extends State { ), ), Container( - margin: EdgeInsets.only(top: 15.0, right: 10.0), - padding: EdgeInsets.only(left: 11.0, right: 11.0), - decoration: BoxDecoration( - border: Border.all( + margin: EdgeInsets.only(top: 15.0, right: 10.0), + padding: EdgeInsets.only(left: 11.0, right: 11.0), + decoration: BoxDecoration( + border: Border.all( + color: getStatusBackgroundColor(), + style: BorderStyle.solid, + width: 5.0, + ), color: getStatusBackgroundColor(), - style: BorderStyle.solid, - width: 5.0, - ), - color: getStatusBackgroundColor(), - borderRadius: BorderRadius.circular(30.0)), - child: model.orderListModel[0].orderStatusId == 30 || - model.orderListModel[0].orderStatusId == 997 || - model.orderListModel[0].orderStatusId == 994 + borderRadius: BorderRadius.circular(30.0)), + child: model.orderListModel[0].orderStatusId == 30 || model.orderListModel[0].orderStatusId == 997 || model.orderListModel[0].orderStatusId == 994 // deliveredOrderList[index].orderStatusId == 30 - ? Text( + ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), - TranslationBase.of(context).deliveredOrder, - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - : Text( - languageID == "ar" - ? model.orderListModel[0].orderStatusn.toString() - : model.orderListModel[0].orderStatus.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ) + TranslationBase.of(context).deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(), + style: TextStyle( + color: Colors.white, + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ) // Text( // languageID == "ar" // ? model.orderListModel[0].orderStatusn @@ -155,64 +150,50 @@ class _OrderDetailsPageState extends State { // fontWeight: FontWeight.bold, // ), // ), - ), + ), ], ), Container( margin: EdgeInsets.only(left: 10.0, top: 13.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}", - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ]), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + "${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}", + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orderListModel[0].shippingAddress.address1 - .toString() - , - style: TextStyle( - fontSize: 10.0, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ), - ]), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + model.orderListModel[0].shippingAddress.address1.toString(), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), ), Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orderListModel[0].shippingAddress.address2 - .toString() - + - ' ' + - model.orderListModel[0].shippingAddress - .country - .toString() + - ' ' + - model.orderListModel[0].shippingAddress - .zipPostalCode - .toString(), - style: TextStyle( - fontSize: 10.0, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ), - ]), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + model.orderListModel[0].shippingAddress.address2.toString() + + ' ' + + model.orderListModel[0].shippingAddress.country.toString() + + ' ' + + model.orderListModel[0].shippingAddress.zipPostalCode.toString(), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), ), Container( child: Row( @@ -227,9 +208,7 @@ class _OrderDetailsPageState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), child: Text( - model.orderListModel[0].shippingAddress - .phoneNumber - .toString(), + model.orderListModel[0].shippingAddress.phoneNumber.toString(), style: TextStyle( fontSize: 15.0, ), @@ -267,9 +246,7 @@ class _OrderDetailsPageState extends State { ), Container( child: flutterImage.Image.asset( - model.orderListModel[0] - .shippingRateComputationMethodSystemName != - "Shipping.Aramex" + model.orderListModel[0].shippingRateComputationMethodSystemName != "Shipping.Aramex" ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, @@ -320,8 +297,7 @@ class _OrderDetailsPageState extends State { Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text( - model.orderListModel[0].paymentName - .toString(), + model.orderListModel[0].paymentName.toString(), style: TextStyle( fontSize: 13.0, fontWeight: FontWeight.bold, @@ -368,9 +344,9 @@ class _OrderDetailsPageState extends State { totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", qyt: model.orderListModel[0].orderItems[index].quantity.toString(), isOrderDetails: true, - imgs: model.orderListModel[0].orderItems[index].product.images != null && - model.orderListModel[0].orderItems[index].product.images.length != 0 - ? model.orderListModel[0].orderItems[index].product.images[0].src.toString() : null, + imgs: model.orderListModel[0].orderItems[index].product.images != null && model.orderListModel[0].orderItems[index].product.images.length != 0 + ? model.orderListModel[0].orderItems[index].product.images[0].src.toString() + : null, status: model.orderListModel[0].orderStatusId, product: model.orderListModel[0].orderItems[index].product, ), @@ -421,8 +397,7 @@ class _OrderDetailsPageState extends State { ), ), Text( - model.orderListModel[0].orderSubtotalExclTax - .toString(), + model.orderListModel[0].orderSubtotalExclTax.toString(), style: TextStyle( fontSize: 13.0, ), @@ -460,8 +435,7 @@ class _OrderDetailsPageState extends State { ), ), Text( - model.orderListModel[0].orderShippingExclTax - .toString(), + model.orderListModel[0].orderShippingExclTax.toString(), style: TextStyle( fontSize: 13.0, ), @@ -555,23 +529,16 @@ class _OrderDetailsPageState extends State { print(model.orderListModel.toString()); print("calc = ${5.9 * 3}"); // TODO MOSA - openPayment( - model.orderListModel[0], model.user); + openPayment(model.orderListModel[0], model.user); }, child: Container( -// margin: EdgeInsets.only(top: 20.0), + padding: EdgeInsets.only(left: 10.0, right: 10.0), height: 50.0, color: Colors.transparent, child: Container( - padding: EdgeInsets.only( - left: 130.0, right: 130.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0), - color: Colors.green, - borderRadius: BorderRadius.circular(5.0)), + padding: EdgeInsets.only(left: 130.0, right: 130.0), + decoration: + BoxDecoration(border: Border.all(color: Colors.green, style: BorderStyle.solid, width: 4.0), color: Colors.green, borderRadius: BorderRadius.circular(5.0)), child: Center( child: Text( TranslationBase.of(context).payOnline, @@ -589,8 +556,7 @@ class _OrderDetailsPageState extends State { isCancel ? InkWell( onTap: () { - presentConfirmDialog( - model, widget.orderModel.id); + presentConfirmDialog(model, widget.orderModel.id); // model.orderListModel[0].id//(widget.orderModel.id)); // }, @@ -601,10 +567,7 @@ class _OrderDetailsPageState extends State { child: Center( child: Text( TranslationBase.of(context).cancelOrder, - style: TextStyle( - color: Colors.red[900], - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline), + style: TextStyle(color: Colors.red[900], fontWeight: FontWeight.bold, decoration: TextDecoration.underline), ), ), ), @@ -623,12 +586,8 @@ class _OrderDetailsPageState extends State { color: Colors.transparent, child: Center( child: Text( - TranslationBase.of(context) - .trackDeliveryDriver, - style: TextStyle( - color: Colors.green[900], - fontWeight: FontWeight.normal, - decoration: TextDecoration.none), + TranslationBase.of(context).trackDeliveryDriver, + style: TextStyle(color: Colors.green[900], fontWeight: FontWeight.normal, decoration: TextDecoration.none), ), ), ), @@ -646,20 +605,13 @@ class _OrderDetailsPageState extends State { Color getStatusBackgroundColor() { print(widget.orderModel.orderStatusId); // if(orderStatus == 'delivered') - if (widget.orderModel.orderStatusId == 30 || - widget.orderModel.orderStatusId == 997 || - widget.orderModel.orderStatusId == 994) + if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) return Colors.blue[700]; - else if (widget.orderModel.orderStatusId == 20 || - widget.orderModel.orderStatusId == 995 || - widget.orderModel.orderStatusId == 998 || - widget.orderModel.orderStatusId == 999) + else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) return Colors.green; else if (widget.orderModel.orderStatusId == 10) return Colors.orange[300]; - else if (widget.orderModel.orderStatusId == 40 || - widget.orderModel.orderStatusId == 996 || - widget.orderModel.orderStatusId == 200) return Colors.red[900]; + else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]; } getCancelOrder(dataIsCancel) { @@ -693,8 +645,7 @@ class _OrderDetailsPageState extends State { confirmMessage: TranslationBase.of(context).confirmCancellation, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => - cancelFunction.getCanceledOrder(id, context).then((value) { + okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value) { print(":D"); print(value); // Navigator.pop(context); @@ -730,20 +681,10 @@ class _OrderDetailsPageState extends State { OrderDetailModel order, AuthenticatedUser authenticatedUser, ) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); - browser.openPharmacyPaymentBrowser( - order, - order.orderTotal, - 'ePharmacy Order', - order.id, - order.billingAddress.email, - order.customValuesXml, - "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", - authenticatedUser.patientID, - authenticatedUser, - browser); + browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml, + "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser); } onBrowserLoadStart(String url) { @@ -770,14 +711,11 @@ class _OrderDetailsPageState extends State { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); if (isPaymentMade) { - AppToast.showSuccessToast( - message: "شكراً\nPayment status for your order is Paid"); + 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"); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); } } } diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart index 7f58fa21..bb680864 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -6,11 +6,9 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; +import 'package:flutter/src/widgets/image.dart' as flutterImage; import 'package:flutter_svg/svg.dart'; -import 'package:intl/intl.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:flutter/src/widgets/image.dart' as flutterImage; class ProductReviewPage extends StatefulWidget { final PharmacyProduct product; @@ -203,7 +201,7 @@ class _ProductReviewPageState extends State { ? () { model .makeReview( - widget.product, ratingValue, reviewText) + widget.product, ratingValue, reviewText, context) .then((value) { setState(() { finishReview = true; diff --git a/lib/pages/pharmacy/order/TrackDriver.dart b/lib/pages/pharmacy/order/TrackDriver.dart index 587ba9a6..40114c03 100644 --- a/lib/pages/pharmacy/order/TrackDriver.dart +++ b/lib/pages/pharmacy/order/TrackDriver.dart @@ -5,7 +5,6 @@ import 'dart:ui' as ui; import 'package:async/async.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -17,10 +16,8 @@ import 'package:flutter_animarker/lat_lng_interpolation.dart'; import 'package:flutter_animarker/models/lat_lng_delta.dart'; import 'package:flutter_animarker/models/lat_lng_info.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:location/location.dart'; -import 'package:flutter_animarker/streams/lat_lng_stream.dart'; class TrackDriver extends StatefulWidget { final OrderDetailModel order; diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 1665cb78..514ea1a5 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -1,16 +1,16 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; class AddAddressPage extends StatefulWidget { - final Addresses editedAddress; + final AddressInfo editedAddress; final Function(PickResult) onPick; AddAddressPage(this.editedAddress, this.onPick); @@ -26,9 +26,7 @@ class _AddAddressPageState extends State { @override void initState() { super.initState(); - if (widget.editedAddress != null && - widget.editedAddress.latLong != null && - widget.editedAddress.latLong != "") { + if (widget.editedAddress != null && widget.editedAddress.latLong != null && widget.editedAddress.latLong != "") { List latLng = widget.editedAddress.latLong.split(","); _latitude = double.parse(latLng[0]); _longitude = double.parse(latLng[1]); @@ -59,9 +57,7 @@ class _AddAddressPageState extends State { @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); - final height = mediaQuery.size.height - - 60 - - mediaQuery.padding.top; + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; return BaseView( builder: (_, model, wi) => AppScaffold( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 8670f0d2..21bb77eb 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -1,7 +1,13 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.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/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; @@ -9,17 +15,22 @@ 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:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; +///TODO Elham* split this to tow files class PharmacyAddressesPage extends StatefulWidget { + final OrderPreviewViewModel orderPreviewViewModel; + final Function changeMainState; + + final bool isUpdate; + + const PharmacyAddressesPage({Key key, this.orderPreviewViewModel, this.isUpdate = false, this.changeMainState}) : super(key: key); + @override _PharmacyAddressesState createState() => _PharmacyAddressesState(); } class _PharmacyAddressesState extends State { - void navigateToAddressPage( - BuildContext ctx, PharmacyAddressesViewModel model, Addresses address) { + void navigateToAddressPage(BuildContext ctx, PharmacyAddressesViewModel model, AddressInfo address) { Navigator.push( ctx, FadePage( @@ -35,7 +46,7 @@ class _PharmacyAddressesState extends State { return BaseView( onModelReady: (model) => model.getAddressesList(), builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).changeAddress, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).changeAddress : TranslationBase.of(context).addAddress, isShowAppBar: true, isPharmacy: true, baseViewModel: model, @@ -78,8 +89,9 @@ class _PharmacyAddressesState extends State { }, ), ), - SizedBox(height: height * 0.10,) - + SizedBox( + height: height * 0.10, + ) ], ), ), @@ -107,11 +119,18 @@ class _PharmacyAddressesState extends State { backgroundColor: Color(0xFF5AB145), fontSize: 14, vPadding: 8, - handler: () { - model.saveSelectedAddressLocally( - model.addresses[model.selectedAddressIndex]); - Navigator.pop( - context, model.addresses[model.selectedAddressIndex]); + handler: () async { + //TODO Elham* + widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson()); + + GifLoaderDialogUtils.showMyDialog(context); + + await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); + await widget.orderPreviewViewModel.getShoppingCart(); + // widget.changeMainState(); + GifLoaderDialogUtils.hideDialog(context); + model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); + _navigateToPaymentOption(model); }, ), ), @@ -121,17 +140,42 @@ class _PharmacyAddressesState extends State { ), ); } + + _navigateToPaymentOption(model) { + if (widget.isUpdate) { + print("sfsf"); + + widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson()); + widget.changeMainState(); + Navigator.pop(context); + + return; + } + Navigator.push( + context, + FadePage( + page: PaymentMethodSelectPage( + model: widget.orderPreviewViewModel, + ))).then((result) => { + setState(() { + if (result != null) { + var paymentOption = result; + widget.orderPreviewViewModel.paymentCheckoutData.paymentOption = paymentOption; + } + // widget.changeMainState(); + }) + }); + } } class AddressItemWidget extends StatelessWidget { final PharmacyAddressesViewModel model; - final Addresses address; + final AddressInfo address; final Function selectAddress; final bool isSelected; - final Function(Addresses) onTabEditAddress; + final Function(AddressInfo) onTabEditAddress; - AddressItemWidget(this.model, this.address, this.selectAddress, - this.isSelected, this.onTabEditAddress); + AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress); @override Widget build(BuildContext context) { @@ -157,18 +201,13 @@ class AddressItemWidget extends StatelessWidget { decoration: new BoxDecoration( color: !isSelected ? Colors.white : Colors.green, shape: BoxShape.circle, - border: Border.all( - color: Colors.grey, - style: BorderStyle.solid, - width: 1.0), + border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0), ), child: Padding( padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, - color: isSelected - ? Colors.white - : Colors.transparent, + color: isSelected ? Colors.white : Colors.transparent, size: 25, ), ), @@ -181,8 +220,7 @@ class AddressItemWidget extends StatelessWidget { Expanded( child: Container( child: Container( - margin: - EdgeInsets.symmetric(vertical: 12, horizontal: 12), + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -245,8 +283,7 @@ class AddressItemWidget extends StatelessWidget { ), ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 8), + padding: const EdgeInsets.symmetric(horizontal: 8), child: SizedBox( child: Container( width: 1, @@ -264,21 +301,13 @@ class AddressItemWidget extends StatelessWidget { ConfirmDialog dialog = new ConfirmDialog( context: context, title: "Are you sure want to delete", - confirmMessage: - "${address.address1} ${address.address2}", - okText: - TranslationBase.of(context).delete, - cancelText: TranslationBase.of(context) - .cancel_nocaps, + confirmMessage: "${address.address1} ${address.address2}", + okText: TranslationBase.of(context).delete, + cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - model - .deleteAddresses(address) - .then((_) { - ConfirmDialog.closeAlertDialog( - context); - AppToast.showErrorToast( - message: - "Address has been deleted"); + model.deleteAddresses(address).then((_) { + ConfirmDialog.closeAlertDialog(context); + AppToast.showErrorToast(message: "Address has been deleted"); }) }, cancelFunction: () => {}); diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index dd4b908d..8362b2c8 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; @@ -17,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -89,7 +91,9 @@ class _ProfilePageState extends State { return BaseView( onModelReady: (model) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + GifLoaderDialogUtils.showMyDialog(context); model.getOrder(customerId, page_id); + GifLoaderDialogUtils.hideDialog(context); }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, @@ -126,12 +130,8 @@ class _ProfilePageState extends State { Column(children: [ Row(children: [ Text( - TranslationBase.of(context) - .welcome, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.grey), + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), ), ]), SizedBox( @@ -139,16 +139,8 @@ class _ProfilePageState extends State { ), Row(children: [ Text( - languageID == "ar" - ? user.firstNameN.toString() + - " " + - user.lastNameN.toString() - : user.firstName.toString() + - " " + - user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold), + languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), ), ]), ]), @@ -175,15 +167,10 @@ class _ProfilePageState extends State { child: InkWell( onTap: () { if (customerId == null) { - AppToast.showErrorToast( - message: "Customer not found"); + AppToast.showErrorToast(message: "Customer not found"); return; } - Navigator.push( - context, - FadePage( - page: OrderPage( - customerID: customerId))); + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId))); }, child: Column( children: [ @@ -210,8 +197,10 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: LakumMainPage())); + if (customerId == null || customerId == '') + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + else + Navigator.push(context, FadePage(page: LakumMainPage())); }, child: Column( children: [ diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index 8a965b6e..9ed1070f 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -80,7 +80,8 @@ class _PharmacyCategorisePageState extends State { page: model.categorise[index].id != '12' ? ParentCategorisePage( id: model.categorise[index].id, - titleName: model.categorise[index].name, + titleName: projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, + // titleName: model.categorise[index].name, ) : FinalProductsPage( id: model.categorise[index].id, diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index d1d3388f..94ee801a 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -1,28 +1,28 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.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:hexcolor/hexcolor.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; class RateAppointmentClinic extends StatefulWidget { final AppointmentDetails appointmentDetails; final String doctorNote; final int doctorRate; - RateAppointmentClinic( - {this.appointmentDetails, this.doctorRate, this.doctorNote}); + RateAppointmentClinic({this.appointmentDetails, this.doctorRate, this.doctorNote}); @override _RateAppointmentClinicState createState() => _RateAppointmentClinicState(); @@ -35,194 +35,162 @@ class _RateAppointmentClinicState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, - body: Scaffold( - backgroundColor: Colors.grey[200], - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text('Rate'), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, - ), - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - body: FractionallySizedBox( - widthFactor: 1, - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(12), - child: Column( - children: [ - SizedBox( - height: 25, - ), - Texts( - TranslationBase.of(context).lastAppointment, - bold: true, - color: Colors.black, - ), - SizedBox( - height: 25, + appBarTitle: TranslationBase.of(context).rateAppointment, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).lastAppointment, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox( + height: 25, + ), + Container( + decoration: cardRadius(10), + child: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + model.appointmentDetails.projectName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Text( + model.appointmentDetails.startTime.toString().substring(0, 5), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + url: 'https://hmgwebservices.com/Images/Hospitals/' + model.appointmentDetails.projectID.toString() + '.jpg', + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ":", model.appointmentDetails.projectName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).date + ":", DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.appointmentDetails.appointmentDate)), + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ], ), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - ), + ), + ), + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(10), + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( - children: [ - SizedBox( - height: 8, - ), - LargeAvatar( - url: - 'https://hmgwebservices.com/Images/Hospitals/' + - model.appointmentDetails.projectID - .toString() + - '.jpg', - name: model.appointmentDetails.clinicName, - width: 110, - height: 110, - ), - SizedBox( - height: 22, - ), - Texts( - model.appointmentDetails.projectName, - fontSize: 22, - fontWeight: FontWeight.bold, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).rateClinic, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), SizedBox( - height: 4, - ), - Texts( - DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - model.appointmentDetails.appointmentDate)), + height: 12, ), - SizedBox( - height: 8, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => AnimatedSwitcher( + duration: Duration(milliseconds: 300), + switchInCurve: Curves.elasticOut, + switchOutCurve: Curves.elasticIn, + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(child: child, scale: animation); + }, + child: rating == (index + 1) + ? Container( + margin: EdgeInsets.only(left: 3.0, right: 3.0), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)), + key: ValueKey(rating), + child: IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/' + (index + 1).toString() + '.svg'), + ), + ) + : Container( + key: ValueKey(rating), + child: IconButton( + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/' + (index + 1).toString() + '.svg'), + ), + ), + ), + ) + ], ), - Texts(model.appointmentDetails.startTime), - SizedBox( - height: 8, - ) ], ), ), - SizedBox( - height: 12, - ), - Center( - child: Texts( - TranslationBase.of(context).rateClinic, - textAlign: TextAlign.center, - )), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ...List.generate( - 5, - (index) => AnimatedSwitcher( - duration: Duration(milliseconds: 1000), - switchInCurve: Curves.elasticOut, - switchOutCurve: Curves.elasticIn, - transitionBuilder: - (Widget child, Animation animation) { - return ScaleTransition( - child: child, scale: animation); - }, - child: Container( - key: ValueKey(rating), - child: IconButton( - //iconSize: 45.0, - onPressed: () { - setState(() { - rating = index + 1; - }); - }, - iconSize: rating == (index + 1) ? 60 : 40, - // Theme.of(context).hintColor, - icon: Image.asset('assets/images/' + - (index + 1).toString() + - '.png')), - ), - ), - ) - ], - ), - SizedBox(height: 12), - SizedBox( - height: 12, - ), - ], - ), - ), - ), - ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.15, - width: double.infinity, - color: Colors.grey[200], - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - if (rating > 0) { - model - .sendAppointmentRate( - rating, - widget.appointmentDetails.appointmentNo, - widget.appointmentDetails.projectID, - widget.appointmentDetails.doctorID, - widget.appointmentDetails.clinicID, - note) - .then( - (value) => { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ) - }, - ); - } else { - AppToast.showErrorToast( - message: 'please rate the clinic'); - } - }, - label: TranslationBase.of(context).submit, - disabled: (model.state == ViewState.Busy || rating == 0), - // loading: model.state == ViewState.BusyLocal, - textColor: Theme.of(context).backgroundColor), + ), ), + SizedBox(height: 12), SizedBox( height: 12, ), - InkWell( - onTap: () { + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).later, + () { Navigator.pushReplacement( context, FadePage( @@ -230,15 +198,50 @@ class _RateAppointmentClinicState extends State { ), ); }, - child: Texts( - TranslationBase.of(context).later, - decoration: TextDecoration.underline, - color: HexColor('#151DFE'), - fontSize: 18, - ), - ) - ], - ), + color: CustomColors.accentColor, + textColor: Colors.white, + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).submit, + rating <= 0 + ? null + : () { + model + .sendAppointmentRate( + rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note) + .then( + (value) => { + model + .sendDoctorRate( + widget.doctorRate, + widget.appointmentDetails.appointmentNo, + widget.appointmentDetails.projectID, + widget.appointmentDetails.doctorID, + widget.appointmentDetails.clinicID, + note, + widget.appointmentDetails.appointmentDate, + widget.appointmentDetails.doctorName, + widget.appointmentDetails.projectName, + widget.appointmentDetails.clinicName) + .then((value) { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + }), + }, + ); + }, + color: Color(0xff359846), + disabledColor: Colors.grey, + ), + ), + ], ), ), ), diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 71aacae2..55e3fc31 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -1,21 +1,18 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_clinic.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/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.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:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class RateAppointmentDoctor extends StatefulWidget { @override @@ -31,214 +28,186 @@ class _RateAppointmentDoctorState extends State { Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, - body: Scaffold( - backgroundColor: Colors.grey[200], - appBar: AppBar( - elevation: 0, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(TranslationBase.of(context).rate), - leading: Builder( - builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.menu), - color: Colors.white, - onPressed: () => Scaffold.of(context).openDrawer(), - ); - }, - ), - centerTitle: true, - ), - drawer: SafeArea(child: AppDrawer()), - body: FractionallySizedBox( - widthFactor: 1, - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(12), - child: Column( - children: [ - SizedBox( - height: 25, //5598 - ), - Texts( - TranslationBase.of(context).lastVisit, - bold: true, - color: Colors.black, - ), - SizedBox( - height: 25, - ), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - border: Border.all(color: Colors.white, width: 0.5), - ), + appBarTitle: TranslationBase.of(context).rateDoctor, + body: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).lastVisit, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), + ), + SizedBox( + height: 25, + ), + Container( + child: DoctorView( + doctor: getDoctorObject(model), + isLiveCareAppointment: false, + isShowFlag: false, + ), + ), + SizedBox( + height: 12, + ), + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(10), + child: Padding( + padding: const EdgeInsets.all(12.0), child: Column( - children: [ - SizedBox( - height: 8, - ), - LargeAvatar( - name: model.appointmentDetails.doctorName, - url: model.appointmentDetails.doctorImageURL, - width: 110, - height: 110, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).tapTitle, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16), ), SizedBox( - height: 22, - ), - Texts( - TranslationBase.of(context).dr + " " + model.appointmentDetails.doctorName, - bold: true, - ), - SizedBox( - height: 4, + height: 12, ), - Texts( - model.appointmentDetails.clinicName != null ? model.appointmentDetails.clinicName : "", - bold: true, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...List.generate( + 5, + (index) => AnimatedSwitcher( + duration: Duration(milliseconds: 1000), + switchInCurve: Curves.elasticOut, + switchOutCurve: Curves.elasticIn, + transitionBuilder: (Widget child, + Animation animation) { + return ScaleTransition( + child: child, scale: animation); + }, + child: Container( + key: ValueKey(rating), + child: IconButton( + iconSize: 45.0, + onPressed: () { + setState(() { + rating = index + 1; + }); + }, + color: rating >= (index + 1) + ? Color.fromRGBO(255, 186, 0, 1.0) + : Colors.grey[400], + icon: Icon(rating >= (index + 1) + ? Icons.star + : Icons.star)), + ), + ), + ) + ], ), - SizedBox( - height: 8, - ) ], ), ), - SizedBox( - height: 12, - ), - Center( - child: Texts( - TranslationBase.of(context).tapTitle, - textAlign: TextAlign.center, - )), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ...List.generate( - 5, - (index) => AnimatedSwitcher( - duration: Duration(milliseconds: 1000), - switchInCurve: Curves.elasticOut, - switchOutCurve: Curves.elasticIn, - transitionBuilder: - (Widget child, Animation animation) { - return ScaleTransition( - child: child, scale: animation); - }, - child: Container( - key: ValueKey(rating), - child: IconButton( - iconSize: 45.0, - onPressed: () { - setState(() { - rating = index + 1; - }); - }, - color: rating >= (index + 1) - ? Color.fromRGBO(255, 186, 0, 1.0) - : Colors.grey[400], - // Theme.of(context).hintColor, - icon: Icon(rating >= (index + 1) - ? EvaIcons.star - : EvaIcons.star)), - ), - ), - ) - ], - ), - SizedBox( - height: 12, - ), - Form( - key: formKey, - child: TextFields( - hintText: TranslationBase.of(context).notes, - minLines: 4, - maxLines: 4, - // validator: (value) { - // if (value.isEmpty) - // return 'Please enter your note'; - // else if (rating == 0) return 'Rating cannot be \"0\"'; - // return null; - // }, - onChanged: (value) { - setState(() { - note = value; - }); - }, + ), + ), + SizedBox( + height: 12, + ), + Container( + decoration: cardRadius(10), + child: Padding( + padding: EdgeInsets.all(8.0), + child: TextField( + maxLines: 5, + decoration: InputDecoration.collapsed( + hintText: TranslationBase.of(context).notes, + hintStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + height: 23 / 16)), + onChanged: (value) { + setState(() { + note = value; + }); + }, + ))), + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).later, + () { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), ), - ), - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - onTap: () async { - final form = formKey.currentState; - if (form.validate() && rating>0 ) { - form.save(); - Navigator.push( - context, - FadePage( - page: RateAppointmentClinic( - appointmentDetails: - model.appointmentDetails, - doctorNote: note, - doctorRate: rating, - ), - ), - ); - } - }, - label: TranslationBase.of(context).next, - disabled: (model.state == ViewState.BusyLocal || rating==0), - loading: model.state == ViewState.BusyLocal, - textColor: Theme.of(context).backgroundColor), - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ); - }, - child: Texts( - TranslationBase.of(context).later, - decoration: TextDecoration.underline, - color: HexColor('#151DFE'), - fontSize: 18, + ); + }, + color: CustomColors.accentColor, + textColor: Colors.white, + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).next, + rating <= 0 + ? null + : () { + Navigator.push( + context, + FadePage( + page: RateAppointmentClinic( + appointmentDetails: model.appointmentDetails, + doctorNote: note, + doctorRate: rating, + ), ), - ) - ], - ), - ) - ], + ); + }, + // iconData: Icons.notifications_active, + color: Color(0xff359846), + disabledColor: Colors.grey, ), ), - ), + ], ), ), ), ); } + + DoctorList getDoctorObject(AppointmentRateViewModel model) { + DoctorList doctor = new DoctorList(); + + doctor.name = model.appointmentDetails.doctorName; + doctor.doctorImageURL = model.appointmentDetails.doctorImageURL; + doctor.clinicName = model.appointmentDetails.clinicName; + doctor.projectName = model.appointmentDetails.projectName; + doctor.actualDoctorRate = 5; + + return doctor; + } } diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 42d3e61b..8ec9f014 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -1,11 +1,11 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +// import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -13,6 +13,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; import 'base/base_view.dart'; @@ -28,6 +30,7 @@ class _SearchProductsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.clearSearchList(), builder: (BuildContext context, PharmacyCategoriseViewModel model, @@ -58,6 +61,22 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'([A-Za-z0-9 a space])')) + ], + validator: (value) { + RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + } else if (!regExp.hasMatch(value)) { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .noArabicLetters); + } + return null; + }, onSaved: (value) { //searchMedicine(model, context); }, @@ -67,13 +86,13 @@ class _SearchProductsPageState extends State { msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { -// return 'please Enter Product Name'; - return TranslationBase.of(context).pleaseEnterProductName; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +//// return 'please Enter Product Name'; +// return TranslationBase.of(context).pleaseEnterProductName; +// } +// return null; +// }, ), ), ), @@ -204,19 +223,29 @@ class _SearchProductsPageState extends State { Radius.circular( 6)), ), - child: Texts( - model.searchList[index] - .rxMessage != - null - ? model - .searchList[index] - .rxMessage - : "", + child: model.searchList[index].rxMessage != null + ? Texts( + projectProvider.isArabic + ? model.searchList[index].rxMessagen + : model.searchList[index].rxMessage, color: Colors.white, regular: true, fontSize: 10, fontWeight: FontWeight.w400, - ), + ): Texts(""), +// Texts( +// model.searchList[index] +// .rxMessage != +// null +// ? model +// .searchList[index] +// .rxMessage +// : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), ), ], ), @@ -229,9 +258,11 @@ class _SearchProductsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - model - .searchList[index].name, + Texts(projectProvider.isArabic + ? model.searchList[index].namen + :model.searchList[index].name, + + // model.searchList[index].name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, diff --git a/lib/pages/settings/InfoPage.dart b/lib/pages/settings/InfoPage.dart index cb7a8fc6..04cc670e 100644 --- a/lib/pages/settings/InfoPage.dart +++ b/lib/pages/settings/InfoPage.dart @@ -1,14 +1,10 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; class AboutApp extends StatelessWidget { @override Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).aboutApp, - isShowDecPage: false, - body: Container()); + return AppScaffold(isShowAppBar: true, appBarTitle: TranslationBase.of(context).aboutApp, isShowDecPage: false, body: Container()); } } diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index eff9537a..f61650e5 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,12 +1,11 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; @@ -18,8 +17,7 @@ class GeneralSettings extends StatefulWidget { _GeneralSettings createState() => _GeneralSettings(); } -class _GeneralSettings extends State - with TickerProviderStateMixin { +class _GeneralSettings extends State with TickerProviderStateMixin { var themeNotifier; int blindValue = 0; bool vibration = false; @@ -30,6 +28,7 @@ class _GeneralSettings extends State var permission = new PermissionService(); LocationPermission locationPermission; var mediaQueryData; + @override void initState() { this.getValues(); @@ -40,196 +39,218 @@ class _GeneralSettings extends State mediaQueryData = MediaQuery.of(context); themeNotifier = Provider.of(context); return Container( - child: ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).modes, - fontWeight: FontWeight.bold, - ), - ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).vibration), - Switch( - value: vibration, - onChanged: (value) { - setState(() { - vibration = value; - }); - setVibration(value); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).accessibility), - Switch( - value: accsibility, - onChanged: (value) { - setState(() { - accsibility = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).blindMode, - fontWeight: FontWeight.bold, - ), - ), - new Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(8.0), - child: new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).offTheme, - style: new TextStyle(fontSize: 16.0), - ), - Radio( - value: 0, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ), - ], + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).modes, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Row( + children: [ + Checkbox( + value: vibration, + onChanged: (value) { + setState(() { + vibration = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).vibration, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).invertTheme, - style: new TextStyle( - fontSize: 16.0, - ), - ), - new Radio( - value: 1, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ) - ], + ), + ], + ), + Row( + children: [ + Checkbox( + value: accsibility, + onChanged: (value) { + setState(() { + accsibility = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).accessibility, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).dimTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + mHeight(16), + mHeight(12), + Text( + TranslationBase.of(context).blindMode, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Column( + children: [ + Row( + children: [ + new Radio( + value: 0, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).offTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 2, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).invertTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).bwTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + Row( + children: [ + Radio( + value: 2, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).dimTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 3, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).bwTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], + ), + ], + ), + ], + ), + mHeight(12), + mHeight(12), + Text( + TranslationBase.of(context).permissions, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Row( + children: [ + Checkbox( + value: camera, + onChanged: (value) { + setState(() { + camera = value; + }); + this.permission.openSettings(); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).cameraPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: location, + onChanged: (value) { + if (value == true) { + Navigator.pop(context); + this.setLocationPermission(); + } else { + Geolocator.openLocationSettings(); + } + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).locationPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ) - ])), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).permissions, - fontWeight: FontWeight.bold, + ), + ], + ), + mHeight(16), + ], + ), ), ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).cameraPermission), - Switch( - value: camera, - onChanged: (value) { - setState(() { - camera = value; - }); - this.permission.openSettings(); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).locationPermission), - Switch( - value: location, - onChanged: (value) { - if (value == true) { - Navigator.pop(context); - this.setLocationPermission(); - } else { - Geolocator.openLocationSettings(); - } - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )) - ])); + ); } setLocationPermission() async { @@ -294,11 +315,8 @@ class _GeneralSettings extends State getValues() async { if (permission.isThemeEnabled() != null) { - blindValue = - permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); - vibration = permission.isVibrationEnabled() == null - ? false - : permission.isVibrationEnabled(); + blindValue = permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() == null ? false : permission.isVibrationEnabled(); // accsibility = mediaQueryData.accessibleNavigation; //setTheme(blindValue); } @@ -312,23 +330,11 @@ class _GeneralSettings extends State getTheme(value) async { if (value == 1) { - return invertThemes( - fontName: - Provider.of(context, listen: false).isArabic - ? 'Cairo' - : 'WorkSans'); + return invertThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else if (value == 3) { - return bwThemes( - fontName: - Provider.of(context, listen: false).isArabic - ? 'Cairo' - : 'WorkSans'); + return bwThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else { - return defaultTheme( - fontName: - Provider.of(context, listen: false).isArabic - ? 'Cairo' - : 'WorkSans'); + return defaultTheme(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index d877514c..7f1f6a93 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -1,16 +1,16 @@ -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'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.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_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:provider/provider.dart'; class ProfileSettings extends StatefulWidget { @@ -18,8 +18,7 @@ class ProfileSettings extends StatefulWidget { _ProfileSettings createState() => _ProfileSettings(); } -class _ProfileSettings extends State - with TickerProviderStateMixin { +class _ProfileSettings extends State with TickerProviderStateMixin { bool smsAlert = true; bool emailAlert = true; int language = 1; @@ -27,6 +26,7 @@ class _ProfileSettings extends State TextEditingController emergencyContact = new TextEditingController(); TextEditingController emailController = new TextEditingController(); TextEditingController emergencyContactName = new TextEditingController(); + @override void initState() { Future.delayed(new Duration(seconds: 0), () { @@ -39,199 +39,299 @@ class _ProfileSettings extends State Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => {}, - builder: (_, model, wi) => Container( - child: model.user != null - ? ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - ), - AppText( - model.user.patientID.toString(), - color: Colors.black, - ), - ], + onModelReady: (model) => {}, + builder: (_, model, wi) => Container( + child: model.user != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: cardRadius(8), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).fileNo + ": ", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + model.user.patientID.toString(), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + ], + ), + ), + ), + mHeight(12), + Text( + TranslationBase.of(context).languageSetting, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).selectLanguage, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).english, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 1, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).arabic, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + ], + ), + mHeight(12), + Text( + TranslationBase.of(context).alert, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).recAlert, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: emailAlert, + onChanged: (value) { + setState(() { + emailAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).emailAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: smsAlert, + onChanged: (value) { + setState(() { + smsAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).smsAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + mHeight(16), + Text( + TranslationBase.of(context).contactInfo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(12), + inputWidget(TranslationBase.of(context).email, "", emailController), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyName, "", emergencyContactName), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyContact, "", emergencyContact), + mHeight(8), + ], + ), ), ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], + ), + Container( + width: double.infinity, + child: Card( + margin: EdgeInsets.zero, + elevation: 0, + child: Padding( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 16), + child: DefaultButton( + TranslationBase.of(context).save, + () { + saveSettings(); + }, + ), ), ), - Padding( - child: AppText( - TranslationBase.of(context).languageSetting, - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), - ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).english), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).arabic), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).alert), - padding: EdgeInsets.all(10), + ), + ], + ) + : Center( + child: AppText(TranslationBase.of(context).loginToUseService), + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).emailAlert), - Switch( - value: emailAlert, - onChanged: (value) { - setState(() { - emailAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).smsAlert), - Switch( - value: smsAlert, - onChanged: (value) { - setState(() { - smsAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).contactInfo), - padding: EdgeInsets.all(10), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + // onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).email), - TextField( - controller: emailController, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).emergencyName), - TextField( - controller: emergencyContactName, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).emergencyContact), - TextField( - controller: emergencyContact, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).save, - () { - saveSettings(); - }, - )), - ], - )) - ]) - : Center( - child: - AppText(TranslationBase.of(context).loginToUseService), - ))); + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } getSettings(context) { GifLoaderDialogUtils.showMyDialog(context); - authService.getSettings().then((result) => { - GifLoaderDialogUtils.hideDialog(context), - setValue(result["PateintInfoForUpdateList"][0]) - }); + authService.getSettings().then((result) => {GifLoaderDialogUtils.hideDialog(context), setValue(result["PateintInfoForUpdateList"][0])}); } setValue(value) { @@ -254,10 +354,6 @@ class _ProfileSettings extends State request["IsEmailAlertRequired"] = this.emailAlert; request["IsSMSAlertRequired"] = this.smsAlert; request["PreferredLanguage"] = this.language.toString(); - authService.saveSettings(request).then((result) => { - AppToast.showSuccessToast( - message: TranslationBase.of(context).profileUpdate), - GifLoaderDialogUtils.hideDialog(context) - }); + authService.saveSettings(request).then((result) => {AppToast.showSuccessToast(message: TranslationBase.of(context).profileUpdate), GifLoaderDialogUtils.hideDialog(context)}); } } diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index abfd022e..32e4cf66 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/pages/settings/profile_setting.dart'; import 'package:diplomaticquarterapp/pages/settings/general_setting.dart'; +import 'package:diplomaticquarterapp/pages/settings/profile_setting.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:flutter/material.dart'; @@ -9,6 +11,7 @@ class Settings extends StatefulWidget { final int type; Settings({this.type = 0}); + @override _Settings createState() => _Settings(); } @@ -18,8 +21,7 @@ class _Settings extends State with TickerProviderStateMixin { @override void initState() { - _tabController = - new TabController(length: 2, vsync: this, initialIndex: widget.type); + _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); if (widget.type == 1) { _tabController.animateTo(1); @@ -31,45 +33,45 @@ class _Settings extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { AppGlobal.context = context; - return Scaffold( - appBar: AppBar( - actions: [ - IconButton( - icon: Icon(Icons.info, color: Colors.white), - onPressed: () { - //openInfoPage() - }, - ) - ], - bottom: TabBar( - // isScrollable: true, + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).settings, + backgroundColor: Color(0xFFF7F7F7), + body: Column( + children: [ + TabBar( + // isScrollable: true, - indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, - // indicatorSize: TabBarIndicatorSize.tab, + indicatorWeight: 3.0, + //indicatorSize: TabBarIndicatorSize.label, + // indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Theme.of(context).primaryColor, - // labelColor: Theme.of(context).primaryColor, - tabs: [ - Tab(text: TranslationBase.of(context).general), - Tab( - text: TranslationBase.of(context).profile, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).settings, - style: TextStyle(color: Colors.white)), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), + indicatorColor: CustomColors.accentColor, + labelColor: Colors.black, + unselectedLabelColor: CustomColors.grey, + // labelColor: Theme.of(context).primaryColor, + tabs: [ + Tab(text: TranslationBase.of(context).general), + Tab( + text: TranslationBase.of(context).profile, + ) + ], + controller: _tabController, + ), + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + GeneralSettings(), + ProfileSettings(), + ], + controller: _tabController), + ), + ], ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [GeneralSettings(), ProfileSettings()], - controller: _tabController), ); } } diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 6c41f550..b7c5d244 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -2,20 +2,23 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; import 'final_products_page.dart'; @@ -26,7 +29,7 @@ class SubCategorisePage extends StatefulWidget { String parentId; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); SubCategorisePage({this.id, this.parentId, this.title}); @@ -54,12 +57,16 @@ class _SubCategorisePageState extends State { ); List entityList = List(); List entityListBrands = List(); + @override Widget build(BuildContext context) { TextEditingController minField = TextEditingController(); TextEditingController maxField = TextEditingController(); + ProjectViewModel projectViewModel = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getSubCategorise(i: id), + allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( @@ -68,1068 +75,1193 @@ class _SubCategorisePageState extends State { isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, - baseViewModel: model, - body: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - parentId == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : parentId == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : parentId == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : parentId == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : parentId == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : parentId == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : parentId == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : parentId == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : parentId == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : parentId == - '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.subCategorise.length > 8) - Column( - children: [ - InkWell( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Container( - child: Texts(TranslationBase.of(context) - .viewCategorise), + //baseViewModel: model, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + parentId == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : parentId == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : parentId == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : parentId == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : parentId == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : parentId == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : parentId == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : parentId == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : parentId == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : parentId == + '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.subCategorise.length > 8) + Column( + children: [ + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts(TranslationBase.of(context) + .viewCategorise), + ), ), - ), - Icon(Icons.arrow_forward) - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - height: - MediaQuery.of(context).size.height * - 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: - model.subCategorise.length, - itemBuilder: (BuildContext context, - int index) { - return Container( - child: Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts(model - .subCategorise[ - index] - .name), - Divider( - thickness: 0.6, - color: Colors.black12, - ) - ], - ), - onTap: () { - Navigator.push( - context, - FadePage( - page: - FinalProductsPage( - id: model - .subCategorise[ - index] - .id, + Icon(Icons.arrow_forward) + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + height: + MediaQuery.of(context).size.height * + 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: + model.subCategorise.length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Padding( + padding: + EdgeInsets.all(8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + projectViewModel + .isArabic + ? model + .subCategorise[ + index] + .namen + : model + .subCategorise[ + index] + .name, +// model.subCategorise[index].name ), - ), - ); - }, + Divider( + thickness: 0.6, + color: + Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: + FinalProductsPage( + id: model + .subCategorise[ + index] + .id, + ), + ), + ); + }, + ), ), - ), - ); - }), - ), - ); - }, - ); - }, - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - ], - ), + ); + }), + ), + ); + }, + ); + }, + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + ], + ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.subCategorise.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.subCategorise.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: + EdgeInsets.symmetric(horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.17, + height: MediaQuery.of(context) + .size + .height * + 0.10, child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, + child: Texts( + projectViewModel.isArabic + ? model + .subCategorise[index] + .namen + : model + .subCategorise[index] + .name, + // model.subCategorise[index].name, + fontSize: 14, + fontWeight: FontWeight.w600, + maxLines: 2, ), ), ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.17, - height: MediaQuery.of(context) - .size - .height * - 0.10, - child: Center( - child: Texts( - model.subCategorise[index].name, - fontSize: 14, - fontWeight: FontWeight.w600, - maxLines: 2, + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: FinalProductsPage( + id: model + .subCategorise[index].id, ), ), - ), - ], + ); + }, ), - onTap: () { - Navigator.push( - context, - FadePage( - page: FinalProductsPage( - id: model.subCategorise[index].id, - ), - ), - ); - }, - ), - ); - }), + ); + }), + ), ), ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon(Icons.wrap_text), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon(Icons.wrap_text), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of(context).refine, // 'Refine', - fontWeight: FontWeight.w600, - ), - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - color: Colors.white, - height: MediaQuery.of(context) - .size - .height * - 1.95, - child: Column( - children: [ - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of( - context) - .refine, -// 'Refine', - fontWeight: - FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( + fontWeight: FontWeight.w600, + ), + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + color: Colors.white, + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( TranslationBase.of( context) - .closeIt, -// 'Close', - color: Colors.red, + .refine, +// 'Refine', fontWeight: FontWeight.w600, - fontSize: 15.0, ), - onTap: () { - Navigator.pop( - context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( - children: [ - ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .categorise), - children: [ - ProcedureListWidget( - model: model, - masterList: model - .subCategorise, - removeHistory: - (item) { - setState(() { - entityList - .remove( - item); - }); - }, - addHistory: - (history) { - setState(() { - entityList.add( - history); - }); - }, - addSelectedHistories: - () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: - (master) => - isEntityListSelected( - master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .brands), - children: [ - ProcedureListWidget( - model: model, - masterList: model - .brandsList, - removeHistory: - (item) { - setState(() { - entityListBrands - .remove( - item); - }); - }, - addHistory: - (history) { - setState(() { - entityListBrands - .add( - history); - }); - }, - addSelectedHistories: - () { - //TODO build your fun herr - // widget.addSelectedHistories(); + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + TranslationBase.of( + context) + .closeIt, +// 'Close', + color: Colors.red, + fontWeight: + FontWeight + .w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); }, - isEntityListSelected: - (master) => - isEntityListSelectedBrands( - master), - ) + ), ], ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .price), - children: [ - Container( - color: Color( - 0xffEEEEEE), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Min'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .categorise), + children: [ + ProcedureListWidget( + model: model, + masterList: model + .subCategorise, + removeHistory: + (item) { + setState(() { + entityList + .remove( + item); + }); + }, + addHistory: + (history) { + setState(() { + entityList.add( + history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .brands), + children: [ + ProcedureListWidget( + model: model, + masterList: model + .brandsList, + removeHistory: + (item) { + setState(() { + entityListBrands + .remove( + item); + }); + }, + addHistory: + (history) { + setState(() { + entityListBrands + .add( + history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelectedBrands( + master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .price), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts(TranslationBase.of( + context) + .min), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), + ), + controller: + minField, ), - controller: - minField, ), - ), - ], - ), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Max'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + ], + ), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts(TranslationBase.of( + context) + .max), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), + ), + controller: + maxField, ), - controller: - maxField, ), - ), - ], - ), - ], - ), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, - ), - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, - children: [ - Expanded( - child: Container( - width: 100, - child: Button( - label: TranslationBase.of( - context) - .reset, + ], + ), + ], + ), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Expanded( + child: + Container( + width: 100, + child: Button( + label: TranslationBase.of( + context) + .reset, // 'Reset', - backgroundColor: - Colors - .red, + backgroundColor: + Colors + .red, + ), ), ), - ), - SizedBox( - width: 30, - ), - Container( - width: 200, - child: Button( - onTap: - () async { - String - categoriesId = - ""; - for (CategoriseParentModel category - in entityList) { - if (categoriesId == - "") { - categoriesId = - category - .id; - } else { - categoriesId = - "$categoriesId,${category.id}"; + SizedBox( + width: 30, + ), + Container( + width: 200, + child: Button( + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = + category.id; + } else { + categoriesId = + "$categoriesId,${category.id}"; + } } - } - String - brandIds = - ""; - for (CategoriseParentModel brand - in entityListBrands) { - if (brandIds == - "") { - brandIds = - brand - .id; - } else { - brandIds = - "$brandIds,${brand.id}"; + String + brandIds = + ""; + + for (CategoriseParentModel brand + in entityListBrands) { + if (brandIds == + "") { + brandIds = + brand.id; + } else { + brandIds = + "$brandIds,${brand.id}"; + } } - } - GifLoaderDialogUtils - .showMyDialog( - context); + GifLoaderDialogUtils + .showMyDialog( + context); - await model.getFilteredSubProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), - categoryId: - categoriesId, - brandId: - brandIds); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.pop( - context); - }, - label: TranslationBase.of( - context) - .apply, + await model.getFilteredSubProducts( + min: minField + .text + .toString(), + max: maxField + .text + .toString(), + categoryId: + categoriesId, + brandId: + brandIds); + GifLoaderDialogUtils + .hideDialog( + context); + Navigator.pop( + context); + }, + label: TranslationBase.of( + context) + .apply, // 'Apply', - backgroundColor: - Colors - .green, + backgroundColor: + Colors + .green, + ), ), - ), - ], + ], + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, - //width: 0.3, - // indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); + ); + }); }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, + //width: 0.3, + // indent: 0.0, + ), ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - model.subProducts.isNotEmpty - ? styleOne == true - ? Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.15, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: CustomColors.green, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: CustomColors.green, + size: 29.0, + ); + } + }); + }, ), - itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.subProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: - Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Stack( - children: [ - Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + model.subProducts.isNotEmpty + ? styleOne == true + ? Container( + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.15, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.subProducts.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: Card( + color: model.subProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: + Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + margin: + EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .subProducts[ + index] + .images + .isNotEmpty + ? model + .subProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model .subProducts[ index] - .images - .isNotEmpty - ? model + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: model .subProducts[ index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), - ), - Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: Texts( - model + .rxMessage != + null + ? Texts( + projectProvider + .isArabic + ? model .subProducts[ index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), - ), - ], - ), - Container( - margin: - EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts( - model - .subProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w400, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.subProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .subProducts[ - index] - .approvedRatingSum > - 0 - ? (model.subProducts[index].approvedRatingSum.toDouble() / - model.subProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), - Texts( - "(${model.subProducts[index].approvedTotalReviews})", + .rxMessagen + : model + .subProducts[ + index] + .rxMessage, + color: Colors + .white, regular: true, fontSize: 10, fontWeight: FontWeight .w400, ) - ], - ), - ], + : Texts(""), +// Texts( +// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), ), + ], + ), + Container( + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - ], - ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + projectViewModel + .isArabic + ? model + .subProducts[ + index] + .namen + : model + .subProducts[ + index] + .name, +// model.subProducts[index].name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ +// StarRating( +// totalAverage: model.subProducts[index].approvedRatingSum > 0 +// ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model + .subProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], + ), + ), + ], ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.subProducts[ - index]), - )), - }, - )); - }, - ), - ) - : Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.122, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.subProducts[index]), + )), + }, + ); + }, + ), + ) + : Container( + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.122, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.subProducts.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: 10.0, + ), ), ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model + Container( + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: Alignment + .center, + child: model .subProducts[ index] .images .isNotEmpty - ? model - .subProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, - height: 80, - ), - ), - ], - ), - Column( - children: [ - Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + ? Image.network( + model + .subProducts[ + index] + .images[ + 0] + .thumb, + fit: BoxFit + .contain, + height: 70, + ) + : Text(TranslationBase.of( + context) + .noImage), ), - child: Texts( - model + ], + ), + Column( + children: [ + Container( + width: model .subProducts[ index] .rxMessage != null + ? MediaQuery.of( + context) + .size + .width / + 5.3 + : 0, + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: model + .subProducts[ + index] + .rxMessage != + null + ? Texts( + projectProvider + .isArabic + ? model + .subProducts[ + index] + .rxMessagen + : model + .subProducts[index] + .rxMessage, + color: Colors + .white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w400, + ) + : Texts(""), +// Texts( +// model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), + ), + ], + ), + ], + ), + Container( + height: 130.0, + margin: + EdgeInsets.symmetric( + horizontal: 0, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.65, + child: Texts( + projectViewModel + .isArabic ? model .subProducts[ index] - .rxMessage - : "", - color: Colors.white, + .namen + : model + .subProducts[ + index] + .name, + // model.subProducts[index].name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight.w400, + FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, ), ), + Row( + children: [ +// StarRating( +// totalAverage: model.subProducts[index].approvedRatingSum > 0 +// ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() +// : 0, +// forceStars: true), + RatingBar.readOnly( + initialRating: model + .subProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), ], ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - model - .subProducts[ - index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.subProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model + widget.authenticatedUserObject + .isLogin + ? Container( + child: IconButton( + icon: Icon( + Icons + .shopping_cart, + size: 18, + color: + CustomColors + .green, + ), + onPressed: + () async { + if (model + .subProducts[ + index] + .rxMessage == + null) { + GifLoaderDialogUtils + .showMyDialog( + context); + await addToCartFunction( + 1, + model .subProducts[ index] - .approvedRatingSum > - 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model - .subProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.subProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - widget.authenticatedUserObject.isLogin? - Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - if(model.subProducts[index].rxMessage == null){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.subProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage()));} - else{ - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - - } - - ), - ):Container(), - ], + .id); + GifLoaderDialogUtils + .hideDialog( + context); + Utils + .navigateToCartPage(); + } else { + AppToast.showErrorToast( + message: TranslationBase.of( + context) + .needPrescription); + } + }), + ) + : Container(), + ], + ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.subProducts[ + index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + child: Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.subProducts[index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', - style: TextStyle(fontSize: 30), ), - ) - ], + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).noData, + style: TextStyle(fontSize: 30), + ), + ) + ], + ), ), ), - ), - ) - ], + ) + ], + ), ), ), ), @@ -1153,8 +1285,9 @@ class _SubCategorisePageState extends State { } return false; } + addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID); + await x.addToCartData(quantity, itemID, context); } } diff --git a/lib/pages/symptom-checker/info.dart b/lib/pages/symptom-checker/info.dart index 7906ba1a..d066bc8f 100644 --- a/lib/pages/symptom-checker/info.dart +++ b/lib/pages/symptom-checker/info.dart @@ -1,12 +1,10 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/routes.dart'; class SymptomInfo extends StatefulWidget { @override diff --git a/lib/pages/symptom-checker/select-gender.dart b/lib/pages/symptom-checker/select-gender.dart index 0b8be29d..c0ca1712 100644 --- a/lib/pages/symptom-checker/select-gender.dart +++ b/lib/pages/symptom-checker/select-gender.dart @@ -1,13 +1,11 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/routes.dart'; -import 'package:flutter_xlider/flutter_xlider.dart'; +// import 'package:flutter_xlider/flutter_xlider.dart'; class SelectGender extends StatefulWidget { @override @@ -84,18 +82,18 @@ class _SelectGender extends State { SizedBox( height: 30, ), - FlutterSlider( - values: [slider], - max: 90, - min: 14, - onDragCompleted: (handlerIndex, lowerValue, upperValue) { - print(lowerValue); - print(upperValue); - setState(() { - slider = upperValue; - }); - }, - ), + // FlutterSlider( + // values: [slider], + // max: 90, + // min: 14, + // onDragCompleted: (handlerIndex, lowerValue, upperValue) { + // print(lowerValue); + // print(upperValue); + // setState(() { + // slider = upperValue; + // }); + // }, + // ), ], ), Expanded( diff --git a/lib/pages/vaccine/my_vaccines_item_screen.dart b/lib/pages/vaccine/my_vaccines_item_screen.dart index 33ef5975..56e23677 100644 --- a/lib/pages/vaccine/my_vaccines_item_screen.dart +++ b/lib/pages/vaccine/my_vaccines_item_screen.dart @@ -1,19 +1,15 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import '../base/base_view.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:popup_box/popup_box.dart'; class MyVaccinesItemPage extends StatefulWidget { @override @@ -64,7 +60,7 @@ class _MyVaccinesItemPageState extends State { child: Texts( model.vaccinationItemList[index].dESCRIPTION)), Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios + ? Icons.arrow_forward : Icons.arrow_back_ios) ], ), diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 4b71b0b7..1030c709 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -1,20 +1,19 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../base/base_view.dart'; -import 'my_vaccines_item_screen.dart'; //TODO fix by jammal we have a static data class MyVaccines extends StatefulWidget { @@ -30,175 +29,87 @@ class _MyVaccinesState extends State { onModelReady: (model) => model.getVaccine(), builder: (BuildContext context, VaccineViewModel model, Widget child) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).myVaccines, description: TranslationBase.of(context).infoVaccines, imagesInfo: [ - ImagesInfo( - imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png') + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png'), ], body: Container( - margin: EdgeInsets.only( - left: SizeConfig.screenWidth * 0.004, - right: SizeConfig.screenWidth * 0.004, - top: SizeConfig.screenWidth * 0.04, - ), + margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - RoundedContainer( - backgroundColor: Colors.white, - child: ExpansionTile( - title: Container( - height: 65.0, - child: Text('2018'), + AppExpandableNotifier( + isExpand: true, + title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate).year.toString() : "", + bodyWidget: Container( + child: ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (BuildContext context, int index) { + return DoctorCard( + onTap: null, + isInOutPatient: true, + isShowInOutPatient: false, + name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName, + billNo: "", + vaccineName: model.vaccineList[index].vaccineName, + profileUrl: model.vaccineList[index].doctorImageURL, + subName: model.vaccineList[index].projectName, + isLiveCareAppointment: false, + date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate), + isSortByClinic: true, + ); + }, ), - children: [ - Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, - itemBuilder: (BuildContext context, int index) { - return Column( - children: [ - RoundedContainer( - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0), - child: Image.network( - model.vaccineList[index].doctorImageURL, - height: SizeConfig.imageSizeMultiplier * 23, - width: SizeConfig.imageSizeMultiplier * 20, - fit: BoxFit.fill, - ), - ), - ], - ), - flex: 2, - ), - Expanded( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.vaccineList[index].doctorTitle + model.vaccineList[index].doctorName, - style: TextStyle( - fontWeight: FontWeight.w900, - fontSize: 16.6, - ), - ), - SizedBox(height: 7.0), - Text( - model.vaccineList[index].projectName, - style: TextStyle( - fontSize: 17.0, - letterSpacing: 0.5, - ), - ), - SizedBox(height: 7.0), - Text( - model.vaccineList[index].vaccineName, - style: TextStyle( - fontSize: 17.0, - ), - ), - SizedBox(height: 7.0), - Text( - 'Date Taken ' + convertDateFormat(model.vaccineList[index].invoiceDate), - style: TextStyle(fontSize: 17.0), - ), - ], - ), - ), - flex: 5, - ), - ], - ), - ], - ), - ), - ], - ); - }), - ) - ], ), ), // SpaceBetweenTexts(space: 165.0), ], ), ), - bottomSheet: model.state == ViewState.Busy - ? Container( - height: 0, - ) - : model.vaccineList.length > 0 - ? Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(12), - height: MediaQuery.of(context).size.height * 0.25, - width: double.infinity, - child: Column( - children: [ - Divider( - height: 2, - thickness: 1, - ), - SizedBox( - height: 6, - ), - Container( - width: double.infinity, - // height: 80.0, - child: Button( - disabled: true, - label: TranslationBase.of(context).checkVaccineAvailability, - backgroundColor: Color(0xff9EA3A4), - onTap: () => Navigator.push(context, FadePage(page: MyVaccinesItemPage())), - ), - ), - if (projectViewModel.havePrivilege(27)) - Container( - width: double.infinity, - // height: 80.0, - child: SecondaryButton( - label: TranslationBase.of(context).sendEmail, - color: Color(0xffF62426), - textColor: Colors.white, - disabled: model.vaccineList.length == 0, - loading: model.state == ViewState.BusyLocal, - onTap: () async { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ), - ], - ), - ) - : Container( - height: 0, - ), + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).availability, + () { + // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); + }, + color: Color(0xffEAEAEA), + textColor: Color(0xff000000), + ), + ), + SizedBox(width: 8), + Expanded( + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); + }, + ), + ); + }, + ), + ), + ], + ), + ), ), ); } - - convertDateFormat(String Date) { - const start = "/Date("; - const end = "+0300)"; - - final startIndex = Date.indexOf(start); - final endIndex = Date.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(Date.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0'); - - return newDate.toString(); - } } diff --git a/lib/pages/webRTC/OpenTok/OpenTok.dart b/lib/pages/webRTC/OpenTok/OpenTok.dart new file mode 100644 index 00000000..7abcfca5 --- /dev/null +++ b/lib/pages/webRTC/OpenTok/OpenTok.dart @@ -0,0 +1,180 @@ +import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; + +import 'OpenTokPlatformBridge.dart'; + + +class OpenTokConnectCallPage extends StatefulWidget{ + final String sessionId; + final String token; + final String apiKey; + OpenTokConnectCallPage({@required this.sessionId, @required this.token, @required this.apiKey}); + + @override + State createState() => OpenTokState(); + +} + +class OpenTokState extends State{ + OpenTokPlatformBridge openTokPlatform; + OpenTokSDKState sdkState = OpenTokSDKState.LOGGED_OUT; + + initOpenTok(){ + openTokPlatform = OpenTokPlatformBridge.init( + apiKey: widget.apiKey, + sessionID: widget.sessionId, + token: widget.token, + onStateChange: (state) { + setState(() => sdkState = state); + } + ); + } + + @override + void initState() { + initOpenTok(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + extendBodyBehindAppBar: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + actions: [ + TextButton(onPressed: (){ + initOpenTok(); + }, child: Icon(Icons.connect_without_contact_outlined, color: Colors.green,)) + ], + ), + body: Column( + children: [ + Expanded( + child: Stack( + children: [ + if(sdkState == OpenTokSDKState.LOGGED_IN) + ...platformVideoViews(), + + + if(sdkState == OpenTokSDKState.LOGGED_OUT) + Center(child: Text("Logged Out"),), + + if(sdkState == OpenTokSDKState.ERROR) + Center(child: Text("Error opening session"),), + + if(sdkState == OpenTokSDKState.WAIT) + Center(child: CircularProgressIndicator(),), + + if(sdkState == OpenTokSDKState.ON_CALL) + Container(), + ], + ), + ), + Row( + children: [ + Expanded( + child: ElevatedButton( + child: Text('Mute Video') ,onPressed: () => openTokPlatform.toggleVideo() + ), + ), + SizedBox(width: 20,), + Expanded( + child: ElevatedButton( + child: Text('Mute Audio') ,onPressed: () => openTokPlatform.toggleAudio() + ), + ), + SizedBox(width: 20,), + Expanded( + child: ElevatedButton( + child: Text('Change Camera') ,onPressed: () => openTokPlatform.swapCamera() + ), + ), + ], + ) + ], + ), + ); + } + + bool remoteVideoOnFull = true; + List platformVideoViews(){ + return [ + SizedBox( + width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, + child: remoteVideoOnFull ? remotePlatformVideoView() : localPlatformVideoView() + ), + + DraggablePublisher( + onButtonBarHeight: ((double)async*{}(50)), + onButtonBarVisible: ((bool)async*{}(true)), + availableScreenSize: MediaQuery.of(context).size, + child: InkWell( + child: (remoteVideoOnFull ? localPlatformVideoView() : remotePlatformVideoView()), + onTap: (){ + print(''); + }, + ), + ) + ]; + } + + Widget localPlatformVideoView(){ + return PlatformViewLink( + viewType: 'local-video-container', // custom platform-view-type + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller, + gestureRecognizers: const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + + onCreatePlatformView: (PlatformViewCreationParams params) { + return PlatformViewsService.initSurfaceAndroidView( + id: params.id, + viewType: 'local-video-container', + // custom platform-view-type, + layoutDirection: TextDirection.ltr, + creationParams: {}, + creationParamsCodec: StandardMessageCodec(), + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + + Widget remotePlatformVideoView(){ + return PlatformViewLink( + viewType: 'remote-video-container', // custom platform-view-type + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller, + gestureRecognizers: const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return PlatformViewsService.initSurfaceAndroidView( + id: params.id, + viewType: 'remote-video-container', + // custom platform-view-type, + layoutDirection: TextDirection.ltr, + creationParams: {}, + creationParamsCodec: StandardMessageCodec(), + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + +} \ No newline at end of file diff --git a/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart b/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart new file mode 100644 index 00000000..bfdb8fb4 --- /dev/null +++ b/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart @@ -0,0 +1,86 @@ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:permission_handler/permission_handler.dart'; + +enum OpenTokSDKState{ LOGGED_OUT, LOGGED_IN, WAIT, ON_CALL, ERROR } +final _platformMethodChannel = const MethodChannel('OpenTok-Platform-Bridge'); + +class OpenTokPlatformBridge{ + + + OpenTokSDKState _sdkState = OpenTokSDKState.LOGGED_OUT; + bool _publishAudio = true; + bool _publishVideo = true; + + final void Function(OpenTokSDKState) onStateChange; + + OpenTokPlatformBridge.init({@required String sessionID, @required String token, @required String apiKey, this.onStateChange}){ + _initSession({'apiKey':apiKey, 'sessionId':sessionID, 'token':token, }); + _platformMethodChannel.setMethodCallHandler(incomingMethodHadler); + } + + Future incomingMethodHadler(MethodCall methodCall) async { + switch (methodCall.method) { + case 'updateState': + { + var arguments = 'OpenTokSDKState.${methodCall.arguments}'; + _sdkState = OpenTokSDKState.values.firstWhere((v) { + return v.toString() == arguments; + }); + onStateChange(_sdkState); + } + break; + default: + throw MissingPluginException('notImplemented'); + } + } + + + Future _initSession(Map openTokCredentials) async { + await requestPermissions(); + try { + await _platformMethodChannel.invokeMethod('initSession', openTokCredentials); + } on PlatformException catch (e) { + print(e); + } + } + + Future makeCall() async { + try { + await requestPermissions(); + + await _platformMethodChannel.invokeMethod('makeCall'); + } on PlatformException catch (e) { + print(e); + } + } + + Future requestPermissions() async { + await [Permission.microphone, Permission.camera].request(); + } + + Future swapCamera() async { + try { + await _platformMethodChannel.invokeMethod('swapCamera'); + } on PlatformException catch (e) {} + } + + Future toggleAudio() async { + _publishAudio = !_publishAudio; + dynamic params = {'publishAudio': _publishAudio}; + + try { + await _platformMethodChannel.invokeMethod('publishAudio', params); + } on PlatformException catch (e) {} + } + + Future toggleVideo() async { + _publishVideo = !_publishVideo; + dynamic params = {'publishVideo': _publishVideo}; + + try { + await _platformMethodChannel.invokeMethod('toggleVideo', params); + } on PlatformException catch (e) {} + } +} diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart new file mode 100644 index 00000000..4c8ac4f5 --- /dev/null +++ b/lib/pages/webRTC/call_page.dart @@ -0,0 +1,147 @@ +import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +class CallPage extends StatefulWidget { + @override + _CallPageState createState() => _CallPageState(); +} + +class _CallPageState extends State { + Signaling signaling = Signaling(); + RTCVideoRenderer _localRenderer = RTCVideoRenderer(); + RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); + String roomId; + TextEditingController textEditingController = TextEditingController(text: ''); + + @override + void initState() { + _localRenderer.initialize(); + _remoteRenderer.initialize(); + + signaling.onAddRemoteStream = ((stream) { + _remoteRenderer.srcObject = stream; + setState(() {}); + }); + + super.initState(); + } + + @override + void dispose() { + _localRenderer.dispose(); + _remoteRenderer.dispose(); + super.dispose(); + } + + void _getUserMedia() async { + final Map constraints = { + 'audio': 'false', + 'video': {'facingMode': 'user'}, + }; + + MediaStream stream = await navigator.mediaDevices.getUserMedia(constraints); + setState(() { + _localRenderer.srcObject = stream; + }); + } + + void initializeRenderers() async { + _localRenderer.initialize(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + appBarTitle: "WebRTC Calling", + body: Column( + children: [ + SizedBox(height: 8), + Wrap( + children: [ + ElevatedButton( + onPressed: () { + setState(() { + signaling.openUserMedia(_localRenderer, _remoteRenderer); + }); + }, + child: Text("Open camera & microphone"), + ), + SizedBox( + width: 8, + ), + ElevatedButton( + onPressed: () async { + roomId = await signaling.createRoom(_remoteRenderer); + textEditingController.text = roomId; + setState(() {}); + }, + child: Text("Create room"), + ), + SizedBox( + width: 8, + ), + ElevatedButton( + onPressed: () { + // Add roomId + signaling.joinRoom( + textEditingController.text, + _remoteRenderer, + ); + }, + child: Text("Join room"), + ), + SizedBox( + width: 8, + ), + ElevatedButton( + onPressed: () { + signaling.hangUp(_localRenderer); + }, + child: Text("Hangup"), + ) + ], + ), + SizedBox(height: 8), + Expanded( + child: Padding( + padding: const EdgeInsets.all(0.0), + child: Stack( + children: [ + Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), + Positioned( + top: 20.0, + right: 100.0, + left: 20.0, + bottom: 300.0, + child: RTCVideoView(_localRenderer, mirror: true), + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text("Join the following Room: "), + Flexible( + child: TextFormField( + controller: textEditingController, + ), + ) + ], + ), + ), + SizedBox(height: 8) + ], + ), + ); + } +} diff --git a/lib/pages/webRTC/signaling.dart b/lib/pages/webRTC/signaling.dart new file mode 100644 index 00000000..f987e285 --- /dev/null +++ b/lib/pages/webRTC/signaling.dart @@ -0,0 +1,242 @@ +import 'dart:convert'; + +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +typedef void StreamStateCallback(MediaStream stream); + +class Signaling { + Map configuration = { + 'iceServers': [ + { + 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] + } + ] + }; + + RTCPeerConnection peerConnection; + MediaStream localStream; + MediaStream remoteStream; + String roomId; + String currentRoomText; + StreamStateCallback onAddRemoteStream; + + Future createRoom(RTCVideoRenderer remoteRenderer) async { + FirebaseFirestore db = FirebaseFirestore.instance; + DocumentReference roomRef = db.collection('rooms').doc(); + + print('Create PeerConnection with configuration: $configuration'); + + peerConnection = await createPeerConnection(configuration); + + registerPeerConnectionListeners(); + + localStream.getTracks().forEach((track) { + peerConnection?.addTrack(track, localStream); + }); + + // Code for collecting ICE candidates below + var callerCandidatesCollection = roomRef.collection('callerCandidates'); + + peerConnection?.onIceCandidate = (RTCIceCandidate candidate) { + print('Got candidate: ${candidate.toMap()}'); + callerCandidatesCollection.add(candidate.toMap()); + }; + // Finish Code for collecting ICE candidate + + // Add code for creating a room + RTCSessionDescription offer = await peerConnection.createOffer(); + await peerConnection.setLocalDescription(offer); + print('Created offer: $offer'); + + Map roomWithOffer = {'offer': offer.toMap()}; + + await roomRef.set(roomWithOffer); + var roomId = roomRef.id; + print('New room created with SDK offer. Room ID: $roomId'); + currentRoomText = 'Current room is $roomId - You are the caller!'; + // Created a Room + + peerConnection?.onTrack = (RTCTrackEvent event) { + print('Got remote track: ${event.streams[0]}'); + + event.streams[0].getTracks().forEach((track) { + print('Add a track to the remoteStream $track'); + remoteStream?.addTrack(track); + }); + }; + + // Listening for remote session description below + roomRef.snapshots().listen((snapshot) async { + print('Got updated room: ${snapshot.data()}'); + + Map data = snapshot.data() as Map; + if (peerConnection?.getRemoteDescription() != null && data['answer'] != null) { + var answer = RTCSessionDescription( + data['answer']['sdp'], + data['answer']['type'], + ); + + print("Someone tried to connect"); + await peerConnection?.setRemoteDescription(answer); + } + }); + // Listening for remote session description above + + // Listen for remote Ice candidates below + roomRef.collection('calleeCandidates').snapshots().listen((snapshot) { + snapshot.docChanges.forEach((change) { + if (change.type == DocumentChangeType.added) { + Map data = change.doc.data() as Map; + print('Got new remote ICE candidate: ${jsonEncode(data)}'); + peerConnection.addCandidate( + RTCIceCandidate( + data['candidate'], + data['sdpMid'], + data['sdpMLineIndex'], + ), + ); + } + }); + }); + // Listen for remote ICE candidates above + + return roomId; + } + + Future joinRoom(String roomId, RTCVideoRenderer remoteVideo) async { + FirebaseFirestore db = FirebaseFirestore.instance; + DocumentReference roomRef = db.collection('rooms').doc('$roomId'); + var roomSnapshot = await roomRef.get(); + print('Got room ${roomSnapshot.exists}'); + + if (roomSnapshot.exists) { + print('Create PeerConnection with configuration: $configuration'); + peerConnection = await createPeerConnection(configuration); + + registerPeerConnectionListeners(); + + localStream.getTracks().forEach((track) { + peerConnection?.addTrack(track, localStream); + }); + + // Code for collecting ICE candidates below + var calleeCandidatesCollection = roomRef.collection('calleeCandidates'); + peerConnection.onIceCandidate = (RTCIceCandidate candidate) { + if (candidate == null) { + print('onIceCandidate: complete!'); + return; + } + print('onIceCandidate: ${candidate.toMap()}'); + calleeCandidatesCollection.add(candidate.toMap()); + }; + // Code for collecting ICE candidate above + + peerConnection?.onTrack = (RTCTrackEvent event) { + print('Got remote track: ${event.streams[0]}'); + event.streams[0].getTracks().forEach((track) { + print('Add a track to the remoteStream: $track'); + remoteStream?.addTrack(track); + }); + }; + + // Code for creating SDP answer below + var data = roomSnapshot.data() as Map; + print('Got offer $data'); + var offer = data['offer']; + await peerConnection?.setRemoteDescription( + RTCSessionDescription(offer['sdp'], offer['type']), + ); + var answer = await peerConnection.createAnswer(); + print('Created Answer $answer'); + + await peerConnection.setLocalDescription(answer); + + Map roomWithAnswer = { + 'answer': {'type': answer.type, 'sdp': answer.sdp} + }; + + await roomRef.update(roomWithAnswer); + // Finished creating SDP answer + + // Listening for remote ICE candidates below + // roomRef.collection('callerCandidates').snapshots().listen((snapshot) { + // snapshot.docChanges.forEach((document) { + // var data = document.doc.data() as Map; + // print(data); + // print('Got new remote ICE candidate: $data'); + // peerConnection.addCandidate( + // RTCIceCandidate( + // data['candidate'], + // data['sdpMid'], + // data['sdpMLineIndex'], + // ), + // ); + // }); + // }); + } + } + + Future openUserMedia( + RTCVideoRenderer localVideo, + RTCVideoRenderer remoteVideo, + ) async { + var stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': false}); + + localVideo.srcObject = stream; + localStream = stream; + + remoteVideo.srcObject = await createLocalMediaStream('key'); + } + + Future hangUp(RTCVideoRenderer localVideo) async { + List tracks = localVideo.srcObject.getTracks(); + tracks.forEach((track) { + track.stop(); + }); + + if (remoteStream != null) { + remoteStream.getTracks().forEach((track) => track.stop()); + } + if (peerConnection != null) peerConnection.close(); + + if (roomId != null) { + var db = FirebaseFirestore.instance; + var roomRef = db.collection('rooms').doc(roomId); + var calleeCandidates = await roomRef.collection('calleeCandidates').get(); + calleeCandidates.docs.forEach((document) => document.reference.delete()); + + var callerCandidates = await roomRef.collection('callerCandidates').get(); + callerCandidates.docs.forEach((document) => document.reference.delete()); + + await roomRef.delete(); + } + + localStream.dispose(); + remoteStream?.dispose(); + } + + void registerPeerConnectionListeners() { + peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { + print('ICE gathering state changed: $state'); + }; + + peerConnection?.onConnectionState = (RTCPeerConnectionState state) { + print('Connection state change: $state'); + }; + + peerConnection?.onSignalingState = (RTCSignalingState state) { + print('Signaling state change: $state'); + }; + + peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { + print('ICE connection state change: $state'); + }; + + peerConnection?.onAddStream = (MediaStream stream) { + print("Add remote stream"); + onAddRemoteStream?.call(stream); + remoteStream = stream; + }; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 4f1f2364..72599bb2 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -8,18 +8,19 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/forgot-password.dart'; -import 'package:diplomaticquarterapp/pages/login/register-info.dart'; -import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/login.dart'; +import 'package:diplomaticquarterapp/pages/login/register-info.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; import 'package:diplomaticquarterapp/splashPage.dart'; const String INIT_ROUTE = '/'; @@ -45,6 +46,8 @@ const String PACKAGES_OFFERS = 'packages-offers'; const String PACKAGES_OFFERS_CART = 'packages-offers-cart'; const String PACKAGES_ORDER_COMPLETED = 'packages-offers-cart'; const String TEST_PAGE = 'test-page'; +const String OPENTOK_CALL_PAGE = 'OPENTOK_CALL_PAGE'; +const String CART_ORDER_PAGE = 'cart-order-page'; const String HEALTH_WEATHER = 'health-weather'; const APP_UPDATE = 'app-update'; @@ -66,11 +69,16 @@ var routes = { SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), SETTINGS: (_) => Settings(), - PACKAGES_OFFERS: (_) => PackagesHomePage(), PACKAGES_OFFERS_CART: (_) => PackagesCartPage(), PACKAGES_ORDER_COMPLETED: (_) => PackageOrderCompletedPage(), TEST_PAGE: (_) => TestPage(), HEALTH_WEATHER: (_) => HealthWeatherIndicator(), APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), + CART_ORDER_PAGE: (_) => CartOrderPage(), + OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( + apiKey: '46209962', + sessionId: '1_MX40NjIwOTk2Mn5-MTYzNDY0ODM3NDY2Nn5PcnpnNGM0R1Q3ODZ6UXlFQ01lMDF5YWJ-fg', + token: + 'T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9Y2ZhZjMzZjA3MWFkMjkxN2JmYjEwZDkxYTRkOTdhN2NmNWE4YjMyYTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXpORFkwT0RNM05EWTJObjVQY25wbk5HTTBSMVEzT0RaNlVYbEZRMDFsTURGNVlXSi1mZyZjcmVhdGVfdGltZT0xNjM0NjQ4Mzc1Jm5vbmNlPTAuNzczMzcxNDUxMDgzMjQyMyZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjM0NzM0Nzc1JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9'), }; diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 888efd30..80039ece 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -15,7 +15,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; - class DoctorsListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); AppGlobal appGlobal = new AppGlobal(); @@ -28,25 +27,20 @@ class DoctorsListService extends BaseService { String deviceToken; String tokenID; - Future getDoctorsList( - int clinicID, int projectID, bool isNearest, BuildContext context, - {doctorId, doctorName, isContinueDentalPlan = false}) async { + Future getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -67,22 +61,19 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "SearchForVoiceCommand": - doctorId != null && doctorId.length > 0 ? true : false, + "SearchForVoiceCommand": doctorId != null && doctorId.length > 0 ? true : false, "DoctorIDsList": doctorId, "Latitude": lat != null ? lat.toString() : 0, "Longitude": long != null ? long.toString() : 0, "isDentalAllowedBackend": isContinueDentalPlan, "IsGetNearAppointment": isNearest, - if (isNearest) - "SelectedDate": DateUtil.convertDateToString(DateTime.now()), + if (isNearest) "SelectedDate": DateUtil.convertDateToString(DateTime.now()), "License": true }; dynamic localRes; - await baseAppClient.post(GET_DOCTORS_LIST_URL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -97,19 +88,16 @@ class DoctorsListService extends BaseService { double long; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -130,15 +118,14 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": lat, - "Longitude": long, + "Latitude": lat == null ? 0.0 : lat, + "Longitude": long == null ? 0.0 : long, "License": true }; dynamic localRes; - await baseAppClient.post(GET_DOCTORS_LIST_URL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -146,11 +133,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsProfile( - int docID, int clinicID, int projectID, context) async { + Future getDoctorsProfile(int docID, int clinicID, int projectID, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -173,8 +158,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DOCTOR_PROFILE, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_PROFILE, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -184,8 +168,7 @@ class DoctorsListService extends BaseService { Future getDoctorsRating(int docID, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -206,8 +189,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DOCTOR_RATING_NOTES, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_RATING_NOTES, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -215,20 +197,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorPrePostImages( - DoctorProfileList doctorProfile, context) async { + Future getDoctorPrePostImages(DoctorProfileList doctorProfile, context) async { Map request; - request = { - "PatientOutSA": authUser.outSA ?? 0, - "isDentalAllowedBackend": false, - "DoctorID": doctorProfile.doctorID, - "ClinicID": doctorProfile.clinicID, - "ProjectID": doctorProfile.projectID - }; + request = {"PatientOutSA": authUser.outSA ?? 0, "isDentalAllowedBackend": false, "DoctorID": doctorProfile.doctorID, "ClinicID": doctorProfile.clinicID, "ProjectID": doctorProfile.projectID}; var images = DoctorPrePostImages(); - await baseAppClient.post(GET_DOCTOR_PRE_POST_IMAGES, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_PRE_POST_IMAGES, onSuccess: (response, statusCode) async { var list = response['DoctorPrePostImagesList']; if (list is List && list.length > 0) { list.forEach((j) { @@ -245,8 +219,7 @@ class DoctorsListService extends BaseService { Future getDoctorsRatingDetails(int docID, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -267,8 +240,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DOCTOR_RATING_DETAILS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_RATING_DETAILS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -276,11 +248,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorFreeSlots( - int docID, int clinicID, int projectID, BuildContext context) async { + Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -295,7 +265,7 @@ class DoctorsListService extends BaseService { "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", - "PatientOutSA": authUser.outSA, + "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "SessionID": null, "isDentalAllowedBackend": false, "DeviceTypeID": 1 @@ -303,8 +273,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -312,11 +281,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorScheduledFreeSlots(int docID, int clinicID, - int projectID, int serviceID, BuildContext context) async { + Future getDoctorScheduledFreeSlots(int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -340,8 +307,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -349,19 +315,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertAppointment(int docID, int clinicID, int projectID, - String selectedTime, String selectedDate, BuildContext context, - [String procedureID]) async { + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context, [String procedureID]) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": false, @@ -389,15 +351,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -405,24 +365,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertLiveCareScheduleAppointment( - int docID, - int clinicID, - int projectID, - int serviceID, - String selectedTime, - String selectedDate, - BuildContext context) async { + Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": true, @@ -450,15 +401,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(INSERT_LIVECARE_SCHEDULE_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(INSERT_LIVECARE_SCHEDULE_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -466,18 +415,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientShare( - String appoID, int clinicID, int projectID, BuildContext context) async { + Future getPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -495,15 +441,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_SHARE, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_SHARE, onSuccess: (response, statusCode) async { localRes = response['OnlineCheckInAppointments'][0]; }, onFailure: (String error, int statusCode) { throw error; @@ -511,18 +455,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLiveCareAppointmentPatientShare( - String appoID, int clinicID, int projectID, BuildContext context) async { + Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -541,15 +482,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_SHARE_LIVECARE, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_SHARE_LIVECARE, onSuccess: (response, statusCode) async { localRes = response['OnlineCheckInAppointments'][0]; }, onFailure: (String error, int statusCode) { throw error; @@ -557,18 +496,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentHistory( - bool isActiveAppointment, BuildContext context) async { + Future getPatientAppointmentHistory(bool isActiveAppointment, BuildContext context, {bool isForCOC = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -583,15 +519,14 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, + "IsComingFromCOC": isForCOC, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -599,11 +534,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentCurfewHistory( - bool isActiveAppointment) async { + Future getPatientAppointmentCurfewHistory(bool isActiveAppointment) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -618,15 +551,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": 1231755, - "TokenID": "@dm!n", "PatientTypeID": 1, "PatientType": 1 }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_APPOINTMENT_CURFEW_HISTORY, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_APPOINTMENT_CURFEW_HISTORY, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -634,18 +565,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future confirmAppointment(int appoNo, int clinicID, int projectID, - bool isLiveCare, BuildContext context) async { + Future confirmAppointment(int appoNo, int clinicID, int projectID, bool isLiveCare, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -664,15 +592,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(CONFIRM_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CONFIRM_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -680,26 +606,22 @@ 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, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } deviceToken = await sharedPref.getString(PUSH_TOKEN); - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -727,8 +649,7 @@ class DoctorsListService extends BaseService { dynamic localRes; - await baseAppClient.post(INSERT_VIDA_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(INSERT_VIDA_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -736,18 +657,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future cancelAppointment( - AppoitmentAllHistoryResultList appo, BuildContext context) async { + Future cancelAppointment(AppoitmentAllHistoryResultList appo, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -771,15 +689,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(CANCEL_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CANCEL_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -787,18 +703,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future generateAppointmentQR( - PatientShareResponse patientShareResponse, BuildContext context) async { + Future generateAppointmentQR(PatientShareResponse patientShareResponse, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -816,15 +729,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GENERATE_QR_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GENERATE_QR_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -832,25 +743,15 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendAppointmentQREmail( - String to, - String appoDate, - String appoNo, - String docName, - String projName, - String QR, - String speciality, - BuildContext context) async { + Future sendAppointmentQREmail(String to, String appoDate, String appoNo, String docName, String projName, String QR, String speciality, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -871,15 +772,13 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(EMAIL_QR_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(EMAIL_QR_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -887,16 +786,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future checkPaymentStatus( - String transactionID, BuildContext context) async { + Future checkPaymentStatus(String transactionID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ClientRequestID": transactionID, @@ -910,13 +806,11 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(CHECK_PAYMENT_STATUS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CHECK_PAYMENT_STATUS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -924,19 +818,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future addAdvancedNumberRequest( - String advanceNumber, - String paymentReference, - dynamic appointmentID, - BuildContext context) async { + Future addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -952,13 +840,11 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(ADD_ADVANCE_NUMBER_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_ADVANCE_NUMBER_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -966,16 +852,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future addVIDARequest(String advanceNumber, String paymentReference, - dynamic apptData, BuildContext context) async { + Future addVIDARequest(String advanceNumber, String paymentReference, dynamic apptData, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -985,8 +868,7 @@ class DoctorsListService extends BaseService { "ServiceID": apptData.ServiceID, "ProjectID": apptData.ProjectID, "ClinicID": apptData.ClinicID, - "ClientRequestID": Utils.getAppointmentTransID( - apptData.ProjectID, apptData.ClinicID, apptData.AppointmentNo), + "ClientRequestID": Utils.getAppointmentTransID(apptData.ProjectID, apptData.ClinicID, apptData.AppointmentNo), "AppointmentDate": apptData.AppointmentDate, "DeviceType": Platform.isIOS ? "iOS" : "Android", "VersionID": req.VersionID, @@ -999,7 +881,6 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; @@ -1015,8 +896,7 @@ class DoctorsListService extends BaseService { // request.DeviceType = this.getDeviceType(); // request.VoipToken = this.platform.is('ios') ? this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false) : ""; dynamic localRes; - await baseAppClient.post(ADD_VIDA_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_VIDA_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1027,12 +907,10 @@ class DoctorsListService extends BaseService { Future isAllowedToAskDoctor(int docID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForAskYourDoctor": true, @@ -1050,14 +928,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(IS_ALLOW_ASK_DOCTOR, - onSuccess: (response, statusCode) async { + await baseAppClient.post(IS_ALLOW_ASK_DOCTOR, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1068,12 +944,10 @@ class DoctorsListService extends BaseService { Future getCallRequestType(BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, @@ -1086,14 +960,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_CALL_REQUEST_TYPE, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_CALL_REQUEST_TYPE, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1101,16 +973,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, - String requestType, BuildContext context) async { + Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1121,22 +990,14 @@ class DoctorsListService extends BaseService { "RequestTypeID": requestType, "PatientMobileNumber": authUser.mobileNumber, "IsMessageSent": false, - "RequestDate": - DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) - .split(" ")[0], - "RequestTime": - DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) - .split(" ")[1], + "RequestDate": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[0], + "RequestTime": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[1], "Remarks": "", "Status": 1, "CreatedBy": 102, - "CreatedOn": - DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) - .split(" ")[0], + "CreatedOn": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[0], "EditedBy": 102, - "EditedOn": - DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()) - .split(" ")[0], + "EditedOn": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[0], "VersionID": req.VersionID, "Channel": req.Channel, "LanguageID": languageID == 'ar' ? 1 : 2, @@ -1147,14 +1008,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(SEND_CALL_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(SEND_CALL_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1165,12 +1024,10 @@ class DoctorsListService extends BaseService { Future getPatientRadOrders(String appoNo, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1184,14 +1041,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_ORDERS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_ORDERS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1199,16 +1054,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientLabOrdersByAppoNo(dynamic appoNo, dynamic projID, - dynamic clinicID, BuildContext context) async { + Future getPatientLabOrdersByAppoNo(dynamic appoNo, dynamic projID, dynamic clinicID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1224,14 +1076,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_LAB_ORDERS_BY_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1239,16 +1089,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientPrescriptionReports( - AppoitmentAllHistoryResultList appo, BuildContext context) async { + Future getPatientPrescriptionReports(AppoitmentAllHistoryResultList appo, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appo.appointmentNo, @@ -1266,14 +1113,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1281,16 +1126,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendPrescriptionEmail(String appoDate, String setupId, - dynamic prescriptionReportEnhList, BuildContext context) async { + Future sendPrescriptionEmail(String appoDate, String setupId, dynamic prescriptionReportEnhList, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentDate": appoDate, @@ -1311,14 +1153,12 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1326,21 +1166,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future createAdvancePayment( - AppoitmentAllHistoryResultList appo, - String projectID, - double payedAmount, - String paymentReference, - String paymentMethodName, - BuildContext context) async { + Future 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)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ProjectID": projectID, @@ -1348,11 +1180,7 @@ class DoctorsListService extends BaseService { "AppointmentNo": appo != null ? appo.appointmentNo.toString() : "0", "PaymentMethodName": paymentMethodName, "PaymentAmount": payedAmount == 0 ? "0" : payedAmount.toString(), - "PaymentDate": payedAmount == 0 - ? "" - : "/Date(" + - DateTime.now().millisecondsSinceEpoch.toString() + - ")/", + "PaymentDate": payedAmount == 0 ? "" : "/Date(" + DateTime.now().millisecondsSinceEpoch.toString() + ")/", "PaymentReferenceNumber": payedAmount == 0 ? "" : paymentReference, "ProjectID": appo != null ? appo.projectID.toString() : projectID, "PatientID": authUser.patientID, @@ -1369,13 +1197,11 @@ class DoctorsListService extends BaseService { "SessionID": "YckwoXhUmWBsnHKEKig", "isDentalAllowedBackend": false, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(CREATE_ADVANCE_PAYMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CREATE_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1383,24 +1209,14 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future HIS_createAdvancePayment( - AppoitmentAllHistoryResultList appo, - String projectID, - double payedAmount, - String paymentReference, - String paymentMethodName, - dynamic patientType, - String patientName, - dynamic patientID, - BuildContext context) async { + Future HIS_createAdvancePayment(AppoitmentAllHistoryResultList appo, String projectID, double payedAmount, String paymentReference, String paymentMethodName, dynamic patientType, + String patientName, dynamic patientID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1425,13 +1241,11 @@ class DoctorsListService extends BaseService { "PatientOutSA": authUser.outSA, "SessionID": "YckwoXhUmWBsnHKEKig", "isDentalAllowedBackend": false, - "TokenID": "@dm!n", "PatientTypeID": patientType, "PatientType": patientType }; dynamic localRes; - await baseAppClient.post(HIS_CREATE_ADVANCE_PAYMENT, - onSuccess: (response, statusCode) async { + await baseAppClient.post(HIS_CREATE_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1439,16 +1253,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientHealthDataStats( - int medCategoryId, int medCategoryStsId, BuildContext context) async { + Future getPatientHealthDataStats(int medCategoryId, int medCategoryStsId, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "MedCategoryID": medCategoryId, @@ -1463,13 +1274,11 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, - "TokenID": "@dm!n", "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType }; dynamic localRes; - await baseAppClient.post(GET_PATIENT_HEALTH_STATS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_PATIENT_HEALTH_STATS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1477,8 +1286,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, - int projectId, BuildContext context) async { + Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, BuildContext context) async { Map request; request = { @@ -1487,8 +1295,7 @@ class DoctorsListService extends BaseService { "ProjectID": projectId, }; dynamic localRes; - await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -1503,13 +1310,26 @@ class DoctorsListService extends BaseService { "ProjectID": projectID, }; dynamic localRes; - await baseAppClient.post(HAS_DENTAL_PLAN, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(HAS_DENTAL_PLAN, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } + Future getLaserBodyPartsList(int laserCategoryID) async { + Map request; + + request = { + "LaserCategoryID": laserCategoryID, + }; + dynamic localRes; + await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index dcc5599b..3d759ce6 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.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'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart'; @@ -15,7 +16,7 @@ import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_re import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; - +import 'package:intl/intl.dart'; import '../../locator.dart'; // SharedPreferences sharedPref = new SharedPreferences(); @@ -24,29 +25,24 @@ enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } AppSharedPreferences sharedPref = new AppSharedPreferences(); AppGlobal appGlobal = new AppGlobal(); -const String INSERT_DEVICE_IMEI = - 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI'; -const String SELECT_DEVICE_IMEI = - 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI'; -const String CHECK_PATIENT_AUTH = - 'Services/Authentication.svc/REST/CheckPatientAuthentication'; +const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI'; +const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI'; +const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication'; const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo'; -const SEND_ACTIVATION_CODE = - 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType'; -const CHECK_ACTIVATION_CODE = - 'Services/Authentication.svc/REST/CheckActivationCode'; -const FORGOT_PASSWORD = - 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; -const CHECK_PATIENT_FOR_REGISTRATION = - "Services/Authentication.svc/REST/CheckPatientForRegisteration"; +const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType'; + +const SEND_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration'; +const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode'; +const CHECK_ACTIVATION_CODE_REGISTER = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration'; + +const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo'; +const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration"; const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo"; const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration'; -const LOGGED_IN_USER_URL = - 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; +const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; -const FORGOT_PATIENT_ID = - 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber'; +const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber'; const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate'; const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo'; @@ -55,8 +51,7 @@ class AuthProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); AuthProvider() { getUserAuthentication(); @@ -110,17 +105,14 @@ class AuthProvider with ChangeNotifier { var lastLogin = lstLogin; //await sharedPref.getInt( // LAST_LOGIN); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); //this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false); - var request = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var request = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); var newRequest = INSERTDeviceIMEIRequest(); var imei = await sharedPref.getString(PUSH_TOKEN); // if (!request.) { newRequest.iMEI = imei; //imei!=null ? imei : ''; - newRequest.firstName = - request.firstName ?? "" + " " + request.lastName ?? ""; - newRequest.firstNameN = - request.firstNameN ?? "" + " " + request.lastNameN ?? ""; + newRequest.firstName = request.firstName ?? "" + " " + request.lastName ?? ""; + newRequest.firstNameN = request.firstNameN ?? "" + " " + request.lastNameN ?? ""; newRequest.lastNameN = request.lastNameN ?? ""; newRequest.outSA = request.outSA == 1 ? true : false; newRequest.biometricEnabled = false; @@ -135,8 +127,7 @@ class AuthProvider with ChangeNotifier { newRequest.tokenID = await sharedPref.getString(TOKEN); // } - await new BaseAppClient().post(INSERT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -153,10 +144,8 @@ class AuthProvider with ChangeNotifier { dynamic localRes; Map request = {}; request['IMEI'] = imei; - await new BaseAppClient().post(SELECT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { - localRes = SelectDeviceIMEIRES.fromJson( - response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); + await new BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { + localRes = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); }, onFailure: (String error, int statusCode) { throw error; }, body: request); @@ -166,8 +155,7 @@ class AuthProvider with ChangeNotifier { } } - Future checkPatientAuthentication( - CheckPatientAuthenticationReq request) async { + Future checkPatientAuthentication(CheckPatientAuthenticationReq request) async { request.versionID = VERSION_ID; request.channel = CHANNEL; request.iPAdress = IP_ADDRESS; @@ -176,8 +164,7 @@ class AuthProvider with ChangeNotifier { request.patientOutSA = request.zipCode == '966' ? 0 : 1; try { dynamic localRes; - await new BaseAppClient().post(CHECK_PATIENT_AUTH, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(CHECK_PATIENT_AUTH, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -198,10 +185,10 @@ class AuthProvider with ChangeNotifier { request.deviceTypeID = DeviceTypeID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; request.isDentalAllowedBackend = false; - + // request.patientTypeID = request.patientType; + // request.patientType = request.patientType; dynamic localRes; - await new BaseAppClient().post(GET_MOBILE_INFO, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(GET_MOBILE_INFO, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -220,8 +207,27 @@ class AuthProvider with ChangeNotifier { request.isDentalAllowedBackend = false; dynamic localRes; - await new BaseAppClient().post(SEND_ACTIVATION_CODE, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(SEND_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) { + localRes = response; + authenticatedUser = CheckActivationCode.fromJson(localRes); + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request.toJson()); + return Future.value(localRes); + } + + Future sendActivationCodeRegister(request) async { + request.versionID = VERSION_ID; + request.channel = CHANNEL; + request.iPAdress = IP_ADDRESS; + request.generalid = GENERAL_ID; + request.languageID = LANGUAGE_ID; + request.deviceTypeID = DeviceTypeID; + request.patientOutSA = request.zipCode == '966' ? 0 : 1; + request.isDentalAllowedBackend = false; + + dynamic localRes; + await new BaseAppClient().post(SEND_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) { localRes = response; authenticatedUser = CheckActivationCode.fromJson(localRes); }, onFailure: (String error, int statusCode) { @@ -232,6 +238,7 @@ class AuthProvider with ChangeNotifier { Future checkActivationCode(request, [value]) async { var neRequest = CheckActivationCodeReq.fromJson(request); + neRequest.activationCode = value ?? "0000"; neRequest.isSilentLogin = value != null ? false : true; neRequest.versionID = VERSION_ID; @@ -243,21 +250,51 @@ class AuthProvider with ChangeNotifier { neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1; neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true; neRequest.isDentalAllowedBackend = false; - neRequest.deviceToken = null; - neRequest.forRegisteration = - neRequest.isRegister != null ? neRequest.isRegister : false; + // neRequest.deviceToken = null; + neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false; neRequest.isRegister = false; dynamic localRes; try { - await new BaseAppClient().post(CHECK_ACTIVATION_CODE, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) { localRes = response; //CheckActivationCode.fromJson(); }, onFailure: (String error, int statusCode) { localRes = error; return Future.value(error); // throw error; }, body: neRequest.toJson()); - sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); + return Future.value(localRes); + } catch (error) { + throw localRes; + } + } + + Future checkActivationCodeRegister(request, [value]) async { + var neRequest = CheckActivationCodeRegisterReq.fromJson(request); + + neRequest.activationCode = value ?? "0000"; + neRequest.isSilentLogin = value != null ? false : true; + neRequest.versionID = VERSION_ID; + neRequest.channel = CHANNEL; + neRequest.iPAdress = IP_ADDRESS; + neRequest.generalid = GENERAL_ID; + // neRequest.languageID = LANGUAGE_ID; + neRequest.deviceTypeID = DeviceTypeID; + neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1; + neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true; + neRequest.isDentalAllowedBackend = false; + // neRequest.deviceToken = null; + neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false; + neRequest.isRegister = false; + dynamic localRes; + try { + await new BaseAppClient().post(CHECK_ACTIVATION_CODE_REGISTER, onSuccess: (dynamic response, int statusCode) { + localRes = response; //CheckActivationCode.fromJson(); + }, onFailure: (String error, int statusCode) { + localRes = error; + return Future.value(error); + // throw error; + }, body: neRequest.toJson()); + // sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { throw localRes; @@ -270,8 +307,7 @@ class AuthProvider with ChangeNotifier { return authenticatedUser; } - Future checkPatientForRegisteration( - CheckPatientForRegistration request) async { + Future checkPatientForRegisteration(CheckPatientForRegistration request) async { request.versionID = VERSION_ID; request.channel = CHANNEL; request.iPAdress = IP_ADDRESS; @@ -282,8 +318,7 @@ class AuthProvider with ChangeNotifier { // request.tokenID = ''; dynamic localRes; try { - await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; @@ -306,8 +341,7 @@ class AuthProvider with ChangeNotifier { // request.tokenID = ''; dynamic localRes; try { - await new BaseAppClient().post(CHECK_USER_STATUS, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(CHECK_USER_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; @@ -326,14 +360,21 @@ class AuthProvider with ChangeNotifier { request['Generalid'] = GENERAL_ID; request['DeviceTypeID'] = DeviceTypeID; request['LanguageID'] = LANGUAGE_ID; + request['LogInTokenID'] = await sharedPref.getString(LOGIN_TOKEN_ID); + var nhic = await sharedPref.getObject(NHIC_DATA); var requestN = RegisterUserRequest.fromJson(request); requestN.patientOutSA = requestN.patientobject.patientOutSA; + final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); + final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); + requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format(dateFormat.parse(nhic['DateOfBirth'])); + requestN.zipCode = requestN.patientOutSA == 1 ? '971' : '966'; + requestN.healthId = requestN.patientobject.eHealthIDField; + requestN.isHijri = nhic['IsHijri'] ? 1 : 0; await sharedPref.remove(USER_PROFILE); - // request.tokenID = ''; + dynamic localRes; try { - await new BaseAppClient().post(REGISTER_USER, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; @@ -345,30 +386,26 @@ class AuthProvider with ChangeNotifier { } } - Future registeredAuthenticatedUser( - AuthenticatedUser user, deviceToken, lat, long) async { + Future registeredAuthenticatedUser(AuthenticatedUser user, deviceToken, lat, long) async { var request = new RegisteredAuthenticatedUserRequest(); request.deviceToken = deviceToken; - request.voipToken = - ""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false); + request.voipToken = ""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false); request.deviceType = DeviceTypeID.toString(); - request.patientMobileNumber = '0' + user.mobileNumber; + request.patientMobileNumber = user.mobileNumber[0] == '0' ? user.mobileNumber : '0' + user.mobileNumber; request.nationalID = user.patientIdentificationNo; request.gender = user.gender; request.patientID = user.patientID; request.patientOutSA = user.outSA; - request.loginType = await sharedPref.getInt(LAST_LOGIN) != null - ? await sharedPref.getInt(LAST_LOGIN) - : 1; + request.loginType = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : 1; request.mACAddress = '00:00:00:00:00:00'; request.latitude = lat; request.longitude = long; request.languageID = int.parse(user.preferredLanguage); - request.patientTypeID = 2; + request.patientTypeID = user.patientType; + request.patientType = user.patientType; dynamic localRes; try { - await new BaseAppClient().post(LOGGED_IN_USER_URL, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(LOGGED_IN_USER_URL, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { localRes = error; @@ -394,8 +431,7 @@ class AuthProvider with ChangeNotifier { dynamic localRes; - await new BaseAppClient().post(FORGOT_PATIENT_ID, - onSuccess: (response, statusCode) async { + await new BaseAppClient().post(FORGOT_PATIENT_ID, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -416,8 +452,7 @@ class AuthProvider with ChangeNotifier { dynamic localRes; try { - await new BaseAppClient().post(FORGOT_PASSWORD, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(FORGOT_PASSWORD, onSuccess: (dynamic response, int statusCode) { localRes = response; //CheckActivationCode.fromJson(); }, onFailure: (String error, int statusCode) { localRes = error; @@ -439,12 +474,10 @@ class AuthProvider with ChangeNotifier { request['generalid'] = GENERAL_ID; request['LanguageID'] = LANGUAGE_ID; request['DeviceTypeID'] = DeviceTypeID; - request["PatientTypeID"] = 1; - request["PatientType"] = 1; + dynamic localRes; try { - await new BaseAppClient().post(DASHBOARD, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(DASHBOARD, onSuccess: (dynamic response, int statusCode) { localRes = response; //CheckActivationCode.fromJson(); }, onFailure: (String error, int statusCode) { localRes = error; @@ -461,8 +494,7 @@ class AuthProvider with ChangeNotifier { getSettings() async { dynamic localRes; try { - await new BaseAppClient().post(PROFILE_SETTING, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(PROFILE_SETTING, onSuccess: (dynamic response, int statusCode) { localRes = response; //CheckActivationCode.fromJson(); }, onFailure: (String error, int statusCode) { localRes = error; @@ -479,8 +511,7 @@ class AuthProvider with ChangeNotifier { Future saveSettings(request) async { dynamic localRes; try { - await new BaseAppClient().post(SAVE_SETTING, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(SAVE_SETTING, onSuccess: (dynamic response, int statusCode) { localRes = response; //CheckActivationCode.fromJson(); }, onFailure: (String error, int statusCode) { localRes = error; diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 2b2d933f..d525dbb1 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -40,6 +40,7 @@ class ClinicListService extends BaseService { }, onFailure: (String error, int statusCode) { throw error; }, body: request); + sharedPref.setObject(CLINICS_LIST, localRes); return Future.value(localRes); } diff --git a/lib/services/covid-drivethru/covid-drivethru.dart b/lib/services/covid-drivethru/covid-drivethru.dart index 35e8fb2f..38c6b33a 100644 --- a/lib/services/covid-drivethru/covid-drivethru.dart +++ b/lib/services/covid-drivethru/covid-drivethru.dart @@ -18,31 +18,15 @@ class CovidDriveThruService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": authUser.outSA, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "License": true - }; + request = {}; dynamic localRes; - await baseAppClient.post(GET_COVID_DRIVETHRU_PROJECT_LIST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_COVID_DRIVETHRU_PROJECT_LIST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -54,35 +38,18 @@ class CovidDriveThruService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": authUser.outSA, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "License": true - }; + request = {}; dynamic localRes; - await baseAppClient.post(GET_COVID_DRIVETHRU_PROCEDURES_LIST, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_COVID_DRIVETHRU_PROCEDURES_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -90,37 +57,22 @@ class CovidDriveThruService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", "ProjectID": projectID, - "ProcedureId": procedureID, - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": authUser.outSA, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "License": true + "ProcedureId": procedureID }; dynamic localRes; - await baseAppClient.post(GET_COVID_DRIVETHRU_PAYMENT_INFO, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_COVID_DRIVETHRU_PAYMENT_INFO, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -128,36 +80,21 @@ class CovidDriveThruService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", "ProjectID": projectID, - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": authUser.outSA, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", - "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "License": true }; dynamic localRes; - await baseAppClient.post(GET_COVID_DRIVETHRU_FREE_SLOTS, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_COVID_DRIVETHRU_FREE_SLOTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 8238a35b..cc151c7b 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_requ import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; @@ -13,49 +12,40 @@ import 'package:flutter/cupertino.dart'; // SharedPreferences sharedPref = new SharedPreferences(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } + AppSharedPreferences sharedPref = new AppSharedPreferences(); -const String GET_SHARED_RECORD_BY_STATUS = - 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; -const String ADD_FAMILY_FILES = - 'Services/Patients.svc/REST/ShareFamilyFileService'; -const String SEND_FAMILY_FILE_ACTIVATION = - 'Services/Authentication.svc/REST/SendActivationCodeForFamilyFile'; -const String INSERT_PATIENT_FILE = - 'Services/Authentication.svc/REST/Insert_SharePatientFile'; -const String CHECK_ACTIVATION_CODE = - 'Services/Authentication.svc/REST/CheckActivationCodeForFamilyFile'; - -const String UPDATE_FILE_STATUS = - 'Services/Authentication.svc/REST/Update_FileStatus'; -const String REMOVE_FILE_STATUS = - 'Services/Authentication.svc/REST/ActiveDeactive_PatientFile'; - -const String ACTIVATION_CODE_URL = - "Services/Authentication.svc/REST/CheckActivationCode"; -const String SENT_REQUEST_URL = - 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; -const String RECEVIED_REQUEST_URL = - 'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId'; -const ACCEPT_REJECT_FAMILY = - 'Services/Authentication.svc/REST/Update_FileStatus'; -const DEACTIVATE_FAMILY = - 'Services/Authentication.svc/REST/DeactivateRequestByRensponse'; +const String GET_SHARED_RECORD_BY_STATUS = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; +const String ADD_FAMILY_FILES = 'Services/Patients.svc/REST/ShareFamilyFileService'; +const String SEND_FAMILY_FILE_ACTIVATION = 'Services/Authentication.svc/REST/SendActivationCodeForFamilyFile'; +const String INSERT_PATIENT_FILE = 'Services/Authentication.svc/REST/Insert_SharePatientFile'; +const String CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCodeForFamilyFile'; + +const String UPDATE_FILE_STATUS = 'Services/Authentication.svc/REST/Update_FileStatus'; +const String REMOVE_FILE_STATUS = 'Services/Authentication.svc/REST/ActiveDeactive_PatientFile'; + +const String ACTIVATION_CODE_URL = "Services/Authentication.svc/REST/CheckActivationCode"; +const String SENT_REQUEST_URL = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; +const String RECEVIED_REQUEST_URL = 'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId'; +const ACCEPT_REJECT_FAMILY = 'Services/Authentication.svc/REST/Update_FileStatus'; +const DEACTIVATE_FAMILY = 'Services/Authentication.svc/REST/DeactivateRequestByRensponse'; class FamilyFilesProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse; + Future getSharedRecordByStatus() async { + dynamic localRes; try { - dynamic localRes; var request = GetAllSharedRecordsByStatusReq(); var result = await sharedPref.getObject(MAIN_USER); request.status = 0; + request.patientID = result["PatientID"]; - await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, - onSuccess: (dynamic response, int statusCode) { + + await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -63,30 +53,26 @@ class FamilyFilesProvider with ChangeNotifier { }, body: request.toJson()); sharedPref.setObject(FAMILY_FILE, localRes); - return Future.value( - GetAllSharedRecordsByStatusResponse.fromJson(localRes)); + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(localRes)); } catch (error) { print(error); throw error; } } - Future getUserViewRequest( - responseID) async { + Future getUserViewRequest(responseID) async { try { dynamic localRes; Map request = {}; request['ResponseID'] = responseID; - await new BaseAppClient().post(RECEVIED_REQUEST_URL, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(RECEVIED_REQUEST_URL, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { return Future.error(error); }, body: request); if (localRes != null) { // sharedPref.setObject(FAMILY_FILE, localRes); - allSharedRecordsByStatusResponse = - GetAllSharedRecordsByStatusResponse.fromJson(localRes); + allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse.fromJson(localRes); return Future.value(allSharedRecordsByStatusResponse); } else return Future.error("No Data"); @@ -101,8 +87,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; Map request = {}; request['Status'] = 0; - await new BaseAppClient().post(SENT_REQUEST_URL, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(SENT_REQUEST_URL, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { return Future.value(error); @@ -110,8 +95,7 @@ class FamilyFilesProvider with ChangeNotifier { //throw error; }, body: request); //sharedPref.setObject(FAMILY_FILE, localRes); - return Future.value( - GetAllSharedRecordsByStatusResponse.fromJson(localRes)); + return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(localRes)); } catch (error) { print(error); throw error; @@ -123,8 +107,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; // var request = GetAllSharedRecordsByStatusReq(); //request.status = 0; - await new BaseAppClient().post(ADD_FAMILY_FILES, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(ADD_FAMILY_FILES, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -144,8 +127,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; // var request = GetAllSharedRecordsByStatusReq(); //request.status = 0; - await new BaseAppClient().post(INSERT_PATIENT_FILE, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(INSERT_PATIENT_FILE, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -158,8 +140,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future sendActivationCode( - cellNumber, zipCode, patientIdentificationID) async { + Future sendActivationCode(cellNumber, zipCode, patientIdentificationID, responseID) async { try { dynamic localRes; var request = SendActivationRequest(); @@ -170,8 +151,9 @@ class FamilyFilesProvider with ChangeNotifier { request.loginType = request.searchType = 1; request.oTPSendType = 1; request.isRegister = false; - await new BaseAppClient().post(SEND_FAMILY_FILE_ACTIVATION, - onSuccess: (dynamic response, int statusCode) { + request.responseID = responseID; + request.status = 2; + await new BaseAppClient().post(SEND_FAMILY_FILE_ACTIVATION, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -186,8 +168,7 @@ class FamilyFilesProvider with ChangeNotifier { } //TODO - Future checkActivationCode( - loginTokenID, activationCode, indentification, mobileNo) async { + Future checkActivationCode(loginTokenID, activationCode, indentification, mobileNo, requestID, responseID) async { try { dynamic localRes; Map request = {}; @@ -196,9 +177,12 @@ class FamilyFilesProvider with ChangeNotifier { request['PatientIdentificationID'] = indentification; request['LogInTokenID'] = loginTokenID; request['activationCode'] = activationCode; + request['PatientShareRequestID'] = requestID; + request['ResponseID'] = responseID; + request['Status'] = 3; + // this.authService.authenticateRequest(request); - await new BaseAppClient().post(CHECK_ACTIVATION_CODE, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -218,8 +202,7 @@ class FamilyFilesProvider with ChangeNotifier { Map request = {}; request['ID'] = id; request['Status'] = stauts; - await new BaseAppClient().post(UPDATE_FILE_STATUS, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(UPDATE_FILE_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -237,8 +220,7 @@ class FamilyFilesProvider with ChangeNotifier { try { dynamic localRes; - await new BaseAppClient().post(REMOVE_FILE_STATUS, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(REMOVE_FILE_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -252,34 +234,31 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, - {onSuccess, mainUser}) async { + Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, {onSuccess, mainUser}) async { Map request = {}; if (mainUser == true) { - var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); - //const request = new SwitchUserRequest(); - // request['LogInTokenID'] = ''; + var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER)); + request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; - request['PatientMobileNumber'] = - currentUser.mobileNumber; //['MobileNumber']; + request['LoginType'] = await sharedPref.getInt(LAST_LOGIN) ?? 1; + request['MobileNo'] = currentUser.mobileNumber[0].toString() == "0" ? currentUser.mobileNumber.toString() : '0' + currentUser.mobileNumber.toString(); + request['PatientMobileNumber'] = currentUser.mobileNumber; //['MobileNumber']; request['SearchType'] = 2; - request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; + // request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; request['PatientIdentificationID'] = ''; request['IsSilentLogin'] = true; + request['DeviceToken'] = await sharedPref.getString(PUSH_TOKEN); request['PatientID'] = currentUser.patientID; //['PatientID']; request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; } else { - var currentUser = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); //const request = new SwitchUserRequest(); // request['LogInTokenID'] = ''; request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; - request['PatientMobileNumber'] = - switchUser.mobileNumber; //['MobileNumber']; + request['PatientMobileNumber'] = switchUser.mobileNumber; //['MobileNumber']; request['SearchType'] = 2; request['SuperUser'] = switchUser.patientID; //currentUser.PatientID; request['PatientIdentificationID'] = ''; @@ -292,8 +271,7 @@ class FamilyFilesProvider with ChangeNotifier { try { dynamic localRes; - await new BaseAppClient().post(ACTIVATION_CODE_URL, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(ACTIVATION_CODE_URL, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -311,8 +289,7 @@ class FamilyFilesProvider with ChangeNotifier { try { dynamic localRes; - await new BaseAppClient().post(ACCEPT_REJECT_FAMILY, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(ACCEPT_REJECT_FAMILY, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); @@ -330,8 +307,7 @@ class FamilyFilesProvider with ChangeNotifier { try { dynamic localRes; - await new BaseAppClient().post(DEACTIVATE_FAMILY, - onSuccess: (dynamic response, int statusCode) { + await new BaseAppClient().post(DEACTIVATE_FAMILY, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { AppToast.showErrorToast(message: error); diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 285fa0bf..6553da40 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ApplePayInsertRequest.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -20,23 +21,11 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -44,8 +33,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_CLINICS, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_CLINICS, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -57,23 +45,11 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -81,12 +57,11 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -94,24 +69,12 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, "ServiceID": serviceID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -119,36 +82,30 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } Future getLivecareHistory(BuildContext context) async { Map request; + request = {}; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); // Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "TokenID": "", - "SessionID": "YckwoXhUmWBsnHKEKig" - }; +// request = {"LanguageID": languageID == 'ar' ? 1 : 2, "TokenID": "", "SessionID": "YckwoXhUmWBsnHKEKig"}; dynamic localRes; - await baseAppClient.post(GET_LIVECARE_HISTORY, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_HISTORY, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -156,28 +113,16 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getLivecareClinicTiming( - int serviceID, BuildContext context) async { + Future getLivecareClinicTiming(int serviceID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -185,8 +130,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_LIVECARE_CLINIC_TIMING, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_LIVECARE_CLINIC_TIMING, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -198,26 +142,13 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -225,8 +156,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ER_APPOINTMENT_FEES, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ER_APPOINTMENT_FEES, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -238,26 +168,13 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -265,8 +182,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ER_APPOINTMENT_TIME, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ER_APPOINTMENT_TIME, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -274,8 +190,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future addNewCallForPatientER( - int serviceID, String clientRequestID, BuildContext context) async { + Future addNewCallForPatientER(int serviceID, String clientRequestID, BuildContext context) async { Map request; String deviceToken; @@ -285,20 +200,11 @@ class LiveCareService extends BaseService { }); if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + 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 = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ErServiceID": serviceID, "ClientRequestID": clientRequestID, "DeviceToken": deviceToken, @@ -306,9 +212,6 @@ class LiveCareService extends BaseService { "Latitude": "24.708488", "Longitude": "46.665925", "DeviceType": Platform.isIOS ? 'iOS' : 'Android', - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -316,8 +219,7 @@ class LiveCareService extends BaseService { dynamic localRes; - await baseAppClient.post(ADD_NEW_CALL_FOR_PATIENT_ER, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_NEW_CALL_FOR_PATIENT_ER, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -334,16 +236,14 @@ class LiveCareService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } request = {"VCID": vc_id}; dynamic localRes; - await baseAppClient.post(CANCEL_LIVECARE_REQUEST, - onSuccess: (response, statusCode) async { + await baseAppClient.post(CANCEL_LIVECARE_REQUEST, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -351,25 +251,34 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future sendLiveCareInvoiceEmail(String appoNo, int projectID, - String emailAddress, BuildContext context) async { + Future applePayInsertRequest(ApplePayInsertRequest applePayInsertRequest, BuildContext context) async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + dynamic localRes; + + await baseAppClient.post(APPLE_PAY_INSERT_REQUEST, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: applePayInsertRequest.toJson()); + return Future.value(localRes); + } + + Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - request = { - "To": emailAddress, - "ProjectID": projectID, - "AppointmentNo": appoNo - }; + request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo}; dynamic localRes; - await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; diff --git a/lib/services/my_invoice_service/my_invoice_services.dart b/lib/services/my_invoice_service/my_invoice_services.dart index 69d3ea19..c7f957c0 100644 --- a/lib/services/my_invoice_service/my_invoice_services.dart +++ b/lib/services/my_invoice_service/my_invoice_services.dart @@ -99,7 +99,7 @@ class MyInvoicesService extends BaseService { "PatientID": authUser.patientID, "License": true, "AppointmentNo": appoNo, - "To": authUser.emailAddress, + "To": authProvider.authenticatedUserObject.user.emailAddress, "IsRegistered": true, "ProjectID": projectID, "PatientTypeID": authUser.patientIdentificationType, diff --git a/lib/services/pharmacy_services/cancelOrder_service.dart b/lib/services/pharmacy_services/cancelOrder_service.dart index 3804b19b..c19186d0 100644 --- a/lib/services/pharmacy_services/cancelOrder_service.dart +++ b/lib/services/pharmacy_services/cancelOrder_service.dart @@ -1,13 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; class CancelOrderService extends BaseService{ diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index 4178c50a..a897955a 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index 3f1ece78..b5632076 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -1,11 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; class OrderService extends BaseService{ diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index e1da6bd3..40d906f3 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -4,15 +4,16 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; class PharmacyAddressService extends BaseService { - List addresses = List(); + List addresses = List(); CountryData country; int selectedAddressIndex = 0; - Future> getAddresses() async { + Future> getAddresses() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); Map queryParams = {'fields': 'addresses'}; hasError = false; @@ -20,17 +21,15 @@ class PharmacyAddressService extends BaseService { try { var completer = Completer(); - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) async { addresses.clear(); - var savedAddress = - await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); + var savedAddress = await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); if (savedAddress != null) { selectedAddress = Addresses.fromJson(savedAddress); } int index = 0; response['customers'][0]['addresses'].forEach((item) { - Addresses address = Addresses.fromJson(item); + AddressInfo address = AddressInfo.fromJson(item); if (selectedAddress != null && selectedAddress.id == item["id"]) { selectedAddressIndex = index; } @@ -44,8 +43,7 @@ class PharmacyAddressService extends BaseService { }, queryParams: queryParams); await completer.future; - - } catch (error){ + } catch (error) { throw error; } @@ -55,12 +53,10 @@ class PharmacyAddressService extends BaseService { Future getCountries(String countryName) async { hasError = false; try { - await baseAppClient.getPharmacy("$PHARMACY_GET_COUNTRY", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$PHARMACY_GET_COUNTRY", onSuccess: (dynamic response, int statusCode) { // countries.clear(); response['countries'].forEach((item) { - if (CountryData.fromJson(item).name == countryName || - CountryData.fromJson(item).namen == countryName) { + if (CountryData.fromJson(item).name == countryName || CountryData.fromJson(item).namen == countryName) { country = CountryData.fromJson(item); } // countries.add(CountryData.fromJson(item)); @@ -74,19 +70,19 @@ class PharmacyAddressService extends BaseService { } } - Future addCustomerAddress(Addresses address) async { + Future addCustomerAddress(AddressInfo address) async { makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); } - Future editCustomerAddress(Addresses address) async { + Future editCustomerAddress(AddressInfo address) async { makeCustomerAddress(address, EDIT_CUSTOMER_ADDRESS); } - Future deleteCustomerAddress(Addresses address) async { + Future deleteCustomerAddress(AddressInfo address) async { makeCustomerAddress(address, DELETE_CUSTOMER_ADDRESS); } - Future makeCustomerAddress(Addresses address, String url) async { + Future makeCustomerAddress(AddressInfo address, String url) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; super.error = ""; @@ -102,7 +98,7 @@ class PharmacyAddressService extends BaseService { await baseAppClient.postPharmacy("$url", onSuccess: (response, statusCode) async { addresses.clear(); response['customers'][0]['addresses'].forEach((item) { - addresses.add(Addresses.fromJson(item)); + addresses.add(AddressInfo.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index b7b67b50..e3e0fb7f 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -1,124 +1,142 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; class ProductDetailService extends BaseService { bool isLogin = false; + num _stockQuantity; + + num get stockQuantity => _stockQuantity; + + String _stockAvailability; + String _stockAvailabilityn; + + String get stockAvailability => _stockAvailability; + String get stockAvailabilityn => _stockAvailabilityn; + + bool _isStockAvailable; + + bool get isStockAvailable => _isStockAvailable; + List _productDetailList = List(); + List get productDetailList => _productDetailList; List _productLocationList = List(); + List get productLocationList => _productLocationList; List _addToCartModel = List(); + List get addToCartModel => _addToCartModel; List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; List _productSpecification = List(); - List get productSpecification => _productSpecification; + List get productSpecification => _productSpecification; Future getProductReviews(productID) async { hasError = false; - await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+productID+"?fields=reviews", - onSuccess: (dynamic response, int statusCode) { - _productDetailList.clear(); - response['products'].forEach((item) { - _productDetailList.add(ProductDetail.fromJson(item)); - print(response); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL + productID + "?fields=reviews,stock_quantity,stock_availability,stock_availabilityn,IsStockAvailable", onSuccess: (dynamic response, int statusCode) { + _productDetailList.clear(); + response['products'].forEach((item) { + _productDetailList.add(ProductDetail.fromJson(item)); + print(response); + }); + _stockQuantity = response['products'][0]['stock_quantity']; + _stockAvailability = response['products'][0]['stock_availability']; + _stockAvailabilityn = response['products'][0]['stock_availabilityn']; + + // _isStockAvailable = response['products'][0]['IsStockAvailable']; + _isStockAvailable = _stockAvailability == "In stock" ? true : false; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - Future getProductAvailabiltyDetail() async { + Future getProductAvailabiltyDetail(String productSKU) async { hasError = false; Map request; request = { - "Channel": 3, - "DeviceTypeID": 2, - "IPAdress": "10.20.10.20", - "LanguageID": 2, - "PatientOutSA": 0, - "SKU": "6720020025", - "SessionID": null, - "VersionID": 5.6, - "generalid": "Cs2020@2016\$2958", - "isDentalAllowedBackend": false + // "Channel": 3, + // "DeviceTypeID": 2, + // "IPAdress": "10.20.10.20", + // "LanguageID": 2, + // "PatientOutSA": 0, + "SKU": productSKU, + // "SessionID": null, + // "VersionID": 5.6, + // "generalid": "Cs2020@2016\$2958", + // "isDentalAllowedBackend": false }; - await baseAppClient.post(GET_LOCATION, - onSuccess: (dynamic response, int statusCode) { - _productLocationList.clear(); - response['PharmList'].forEach((item) { - _productLocationList.add(LocationModel.fromJson(item)); - print(_productLocationList); - print(response); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: request); + await baseAppClient.post(GET_LOCATION, onSuccess: (dynamic response, int statusCode) { + _productLocationList.clear(); + response['PharmList'].forEach((item) { + _productLocationList.add(LocationModel.fromJson(item)); + print(_productLocationList); + print(response); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); } - Future addToCart(quantity, itemID) async { + Future addToCart(quantity, itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; request = { - "shopping_cart_item": - { - "quantity": quantity, - "shopping_cart_type": "1", - "product_id": itemID, - "customer_id": customerId, - "language_id": 1 - } + "shopping_cart_item": {"quantity": quantity, "shopping_cart_type": "1", "product_id": itemID, "customer_id": customerId, "language_id": 1} }; dynamic localRes; - - await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, - onSuccess: (dynamic response, int statusCode) { - _addToCartModel.clear(); - response['shopping_carts'].forEach((item) { - _addToCartModel.add(Wishlist.fromJson(item)); - }); - AppToast.showSuccessToast(message: 'You have added a product to the cart'); - localRes = response; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); - }, body: request); + + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, onSuccess: (dynamic response, int statusCode) { + _addToCartModel.clear(); + response['shopping_carts'].forEach((item) { + _addToCartModel.add(Wishlist.fromJson(item)); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).addToCartMsg + // 'You have added a product to the cart' + ); + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage()); + }, body: request); return Future.value(localRes); } - Future notifyMe(customerId, itemID) async { + Future notifyMe(customerId, itemID, context) async { hasError = false; await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: 'You will be notified when product available'); + AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg + //'You will be notified when product available' + ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); + AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage()); }); } - Future addToWishlist(itemID) async { + Future addToWishlist(itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; @@ -126,67 +144,65 @@ class ProductDetailService extends BaseService { request = { "shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1} }; - await baseAppClient.pharmacyPost(GET_SHOPPING_CART, - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); - }, body: request); + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).addToWishlistMsg + // 'You have added a product to the Wishlist' + ); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage()); + }, body: request); } Future getWishlistItems() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_WISHLIST + customerId + "?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - Future deleteItemFromWishlist(itemID) async { + Future deleteItemFromWishlist(itemID, context) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist", - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist'); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); - }); + await baseAppClient.getPharmacy(DELETE_WISHLIST + customerId + "+&product_id=" + itemID + "&cart_type=Wishlist", onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).removeFromWishlistMsg + // 'You have removed a product from the Wishlist' + ); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + AppToast.showErrorToast(message: error ?? Utils.generateContactAdminMessage()); + }); } Future productSpecificationData(itemID) async { hasError = false; - await baseAppClient.getPharmacy(GET_SPECIFICATION+itemID, - onSuccess: (dynamic response, int statusCode) { - _productSpecification.clear(); - response['specification'].forEach((item) { - _productSpecification.add(SpecificationModel.fromJson(item)); - print(_productSpecification); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_SPECIFICATION + itemID, onSuccess: (dynamic response, int statusCode) { + _productSpecification.clear(); + response['specification'].forEach((item) { + _productSpecification.add(SpecificationModel.fromJson(item)); + print(_productSpecification); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - } diff --git a/lib/services/pharmacy_services/recommendedProduct_service.dart b/lib/services/pharmacy_services/recommendedProduct_service.dart index 8953152e..7e09bbfa 100644 --- a/lib/services/pharmacy_services/recommendedProduct_service.dart +++ b/lib/services/pharmacy_services/recommendedProduct_service.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart index c85d68e2..329d52af 100644 --- a/lib/services/pharmacy_services/review_service.dart +++ b/lib/services/pharmacy_services/review_service.dart @@ -1,10 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class ReviewService extends BaseService { diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index fb99e038..ce55a40b 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -1,12 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; -import 'package:diplomaticquarterapp/models/pharmacy/products.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; class WishListService extends BaseService { diff --git a/lib/services/pharmacy_services/writeReview_service.dart b/lib/services/pharmacy_services/writeReview_service.dart index 573095eb..52d31c9b 100644 --- a/lib/services/pharmacy_services/writeReview_service.dart +++ b/lib/services/pharmacy_services/writeReview_service.dart @@ -1,12 +1,10 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; class writeReviewService extends BaseService{ diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart index 3bfe62e3..459c0e83 100644 --- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; @@ -18,8 +19,7 @@ class SmartWatchIntegrationService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -42,13 +42,29 @@ class SmartWatchIntegrationService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_PATIENT_LAST_RECORD, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_PATIENT_LAST_RECORD, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); + } + Future insertPatientHealthData(List healthData, BuildContext context) async { + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { + "Med_InsertTransactionsInputsList": healthData, + }; + dynamic localRes; + await baseAppClient.post(INSERT_PATIENT_HEALTH_DATA, 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 f75680ef..e15cd330 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -1,26 +1,21 @@ import 'dart:async'; + import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; +import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:firebase_analytics/observer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; -import 'analytics/google-analytics.dart'; -import 'config/shared_pref_kay.dart'; -import 'config/size_config.dart'; import 'core/service/AuthenticatedUserObject.dart'; import 'core/service/privilege_service.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; -import 'models/Authentication/authenticated_user.dart'; -import 'widgets/transitions/slide_up_page.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); -AuthenticatedUserObject authenticatedUserObject = - locator(); +AuthenticatedUserObject authenticatedUserObject = locator(); class SplashScreen extends StatefulWidget { @override @@ -29,6 +24,7 @@ class SplashScreen extends StatefulWidget { class _SplashScreenState extends State { PrivilegeService _privilegeService = locator(); + @override void initState() { super.initState(); @@ -49,18 +45,58 @@ class _SplashScreenState extends State { /// load the Privilege from service Future loadPrivilege() async { await _privilegeService.getPrivilege(); - Provider.of(context, listen: false) - .setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); + ProjectViewModel projectProvider = Provider.of(context, listen: false); + projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); + var themeNotifier = Provider.of(context, listen: false); + themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); } @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, - body: Image.asset( - 'assets/images/powerd-by.jpg', - fit: BoxFit.fitWidth, - width: MediaQuery.of(context).size.width, + backgroundColor: Color(0xffF8F8F8), + body: Stack( + alignment: Alignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 53), + child: Image.asset( + 'assets/images/new/hmg_logo.png', + fit: BoxFit.fitWidth, + width: MediaQuery.of(context).size.width, + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).poweredBy, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff333C45), letterSpacing: -0.56, height: 16 / 14), + ), + SizedBox( + height: 5, + ), + SvgPicture.asset( + 'assets/images/new/cloud_logo.svg', + width: 40, + height: 40, + ), + SizedBox( + height: 7, + ), + 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/theme/colors.dart b/lib/theme/colors.dart index 893449f1..6640b442 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -5,7 +5,22 @@ class CustomColors { static const Color purple = Color(0xFF6002EE); static const Color deepPurple = Color(0xFF3900B1); static const Color grey = Color(0xFF848484); + static const Color textColor = Color(0xFF575757); + static const Color grey2 = Color(0xFFA5A5A5); static const Color darkGrey = Color(0xFF222222); static const Color black = Color(0xFF141414); static const Color white = Color(0xFFFFFFFF); + static const Color accentColor = Color(0xFFD02127); + static const Color lightGreyColor = Color(0xFFE2E2E2); + static const Color devider = Color(0xFFE5E5E5); + static const Color darkGreyColor = Color(0xFFC9C9C9); + static const Color pharmacyGreyColor = Color(0xFFDBDBDB); + static const Color backgroudGreyColor = Color(0xFFEFEFEF); + static const Color appBackgroudGreyColor = Color(0xFFF7F7F7); + static const Color appBackgroudGrey2Color = Color(0xFFF8F8F8); + static const Color green = Color(0xFF359846); + static const Color orange = Color(0xFFCC9B14); + + static const Color femaleColor = Color(0xFF359846); + static const Color maleColor = Color(0xFFCC9B14); } diff --git a/lib/theme/theme_notifier.dart b/lib/theme/theme_notifier.dart index e61c73a6..9ad15f33 100644 --- a/lib/theme/theme_notifier.dart +++ b/lib/theme/theme_notifier.dart @@ -1,8 +1,4 @@ -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; class ThemeNotifier with ChangeNotifier { ThemeData _themeData; diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index 65d6f81d..1c01d990 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -1,22 +1,21 @@ import 'dart:ui'; + import 'package:diplomaticquarterapp/Constants.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; /// ---- Default Theme ---- /// //final projectProvider = Provider.of(AppGlobal.context); -final bluePrimary = Color(0xFF3F51B5); +final bluePrimary = Color(0xFF00000); final blueAccent = Color(0xFFFF9800); final blueBackground = Color(0xFFFFFFFF); + defaultTheme({fontName}) { return ThemeData( - fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', - - primarySwatch: Colors.blue, + fontFamily: fontName, + //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.red, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.light, pageTransitionsTheme: const PageTransitionsTheme( @@ -28,7 +27,8 @@ defaultTheme({fontName}) { hintColor: Colors.grey[400], disabledColor: Colors.grey[300], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffE9E9E9), // Colors.grey[100], + scaffoldBackgroundColor: Color(0xffF8F8F8), + // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, @@ -39,15 +39,15 @@ defaultTheme({fontName}) { buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: - BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.grey, primaryTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)), iconTheme: IconThemeData(), textTheme: TextTheme( - bodyText1: TextStyle(color: Colors.black), - headline1: TextStyle(color: Colors.white), - headline2: TextStyle(color: Colors.white)), + bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6), + headline1: TextStyle(color: Colors.white, letterSpacing: 0.6), + headline2: TextStyle(color: Colors.white, letterSpacing: 0.6), + ), floatingActionButtonTheme: FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2), appBarTheme: AppBarTheme( @@ -63,8 +63,9 @@ defaultTheme({fontName}) { invertThemes({fontName}) { return ThemeData( - fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, + fontFamily: fontName, + //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.red, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.dark, @@ -75,13 +76,11 @@ invertThemes({fontName}) { }, ), hintColor: Colors.grey[400], - textTheme: TextTheme( - bodyText1: TextStyle(color: Colors.white), - headline1: TextStyle(color: Colors.white), - headline2: TextStyle(color: Colors.white)), + textTheme: TextTheme(bodyText1: TextStyle(color: Colors.white), headline1: TextStyle(color: Colors.white), headline2: TextStyle(color: Colors.white)), disabledColor: Colors.grey[800], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xff000000), // Colors.grey[100], + scaffoldBackgroundColor: Color(0xff000000), + // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.black, @@ -92,8 +91,7 @@ invertThemes({fontName}) { buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: - BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( @@ -109,8 +107,9 @@ invertThemes({fontName}) { bwThemes({fontName}) { return ThemeData( - fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, + fontFamily: fontName, + //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.red, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.dark, @@ -136,7 +135,8 @@ bwThemes({fontName}) { disabledColor: Colors.grey[800], errorColor: Color.fromRGBO(235, 80, 60, 1.0), - scaffoldBackgroundColor: Color(0xffffffe4), // Colors.grey[100], + scaffoldBackgroundColor: Color(0xffffffe4), + // Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Colors.grey, canvasColor: Colors.black, @@ -146,8 +146,7 @@ bwThemes({fontName}) { primaryColor: Color(0xfffffff4), toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: - BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( @@ -163,8 +162,9 @@ bwThemes({fontName}) { dimTheme({fontName}) { return ThemeData( - fontFamily: fontName, //projectProvider.isArabic ? 'Cairo' : 'WorkSans', - primarySwatch: Colors.blue, + fontFamily: fontName, + //projectProvider.isArabic ? 'Cairo' : 'WorkSans', + primarySwatch: Colors.red, visualDensity: VisualDensity.adaptivePlatformDensity, brightness: Brightness.dark, diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index 546d9b2d..ee602391 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -29,12 +29,7 @@ class CalendarUtils { return _completer.future; } - Future createOrUpdateEvents( - {List scheduleList, - String title, - String description, - List scheduleDateTime, - List daysOfWeek}) async { + Future createOrUpdateEvents({List scheduleList, String title, String description, List scheduleDateTime, List daysOfWeek}) async { List events = List(); scheduleDateTime.forEach((element) { RecurrenceRule recurrenceRule = RecurrenceRule( @@ -42,12 +37,7 @@ class CalendarUtils { daysOfWeek: daysOfWeek, endDate: element, ); - Event event = Event(writableCalendars.id, - recurrenceRule: recurrenceRule, - start: element, - end: element.add(Duration(minutes: 30)), - title: title, - description: description); + Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: element, end: element.add(Duration(minutes: 30)), title: title, description: description); events.add(event); }); @@ -56,6 +46,21 @@ class CalendarUtils { }); } + Future createOrUpdateEvent({String title, String description, DateTime scheduleDateTime, String eventId}) async { + RecurrenceRule recurrenceRule = RecurrenceRule( + RecurrenceFrequency.Daily, + // daysOfWeek: daysOfWeek, + endDate: scheduleDateTime, + ); + print("eventId " + eventId); + Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description); + deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { + print("catchError " + e.toString()); + }).whenComplete(() { + print("whenComplete " + eventId); + }); + } + deleteEvent(Calendar _calendar, Event _event) async { await deviceCalendarPlugin.deleteEvent(_calendar.id, _event.eventId); } @@ -64,8 +69,7 @@ class CalendarUtils { String calendarId, RetrieveEventsParams retrieveEventsParams, ) async { - return await deviceCalendarPlugin.retrieveEvents( - calendarId, retrieveEventsParams); + return await deviceCalendarPlugin.retrieveEvents(calendarId, retrieveEventsParams); } Future createCalendar( @@ -73,7 +77,6 @@ class CalendarUtils { Color calendarColor, String localAccountName, }) async { - return await deviceCalendarPlugin.createCalendar(calendarName, - calendarColor: calendarColor, localAccountName: localAccountName); + return await deviceCalendarPlugin.createCalendar(calendarName, calendarColor: calendarColor, localAccountName: localAccountName); } } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index e0367ba3..f1c6442f 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -53,7 +53,9 @@ class LocalNotification { var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){ + print(err); + }); }); } diff --git a/lib/uitl/PlatformBridge.dart b/lib/uitl/PlatformBridge.dart index 3ad91cdd..56020781 100644 --- a/lib/uitl/PlatformBridge.dart +++ b/lib/uitl/PlatformBridge.dart @@ -1,10 +1,8 @@ -import 'dart:developer'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/localized_values.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; @@ -93,7 +91,6 @@ class PlatformBridge { static const un_register_Hmg_Geofences = "unRegisterHmgGeofences"; Future connectHMGInternetWifi(String patientId) { - print("Invoking platform method: $hmg_internet_wifi_connect_method"); try { return platform.invokeMethod(hmg_internet_wifi_connect_method, [patientId]); } on PlatformException catch (e) { @@ -103,7 +100,6 @@ class PlatformBridge { } Future connectHMGGuestWifi() { - print("Invoking platform method: $hmg_guest_wifi_connect_method"); try { return platform.invokeMethod(hmg_guest_wifi_connect_method); } on PlatformException catch (e) { @@ -113,7 +109,6 @@ class PlatformBridge { } Future isHMGNetworkAvailable(String ssid) { - print("Invoking platform method: $is_hmg_network_available_method"); try { return platform.invokeMethod(is_hmg_network_available_method, ssid); } on PlatformException catch (e) { @@ -123,7 +118,6 @@ class PlatformBridge { } Future enableWifiIfNot() async { - print("Invoking platform method: $enable_wifi_if_not"); try { return platform.invokeMethod(enable_wifi_if_not); } on PlatformException catch (e) { @@ -133,7 +127,6 @@ class PlatformBridge { } void showLoading(String message, bool show) async { - print("Invoking platform method: $show_loading_method"); try { var result = await platform.invokeMethod(show_loading_method, [message, show]); } on PlatformException catch (e) { diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart new file mode 100644 index 00000000..a1a411e0 --- /dev/null +++ b/lib/uitl/SignalRUtil.dart @@ -0,0 +1,48 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:http/io_client.dart'; +import 'package:signalr_core/signalr_core.dart'; + +class SignalRUtil { + String hubName; + BuildContext context; + + SignalRUtil({@required this.hubName, @required this.context}); + + HubConnection connectionBuilder; + + void startSignalRConnection() async { + connectionBuilder = HubConnectionBuilder() + .withUrl( + hubName, + HttpConnectionOptions( + client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), + logging: (level, message) => print(message), + )) + .build(); + + await connectionBuilder.start(); + + connectionBuilder.on('ReceiveMessage', (message) { + handleIncomingMessage(message); + }); + } + + void closeSignalRConnection() { + connectionBuilder.stop(); + } + + void handleIncomingMessage(List message) { + print(message.toString()); + } + + void sendMessage(List args) async { + await connectionBuilder.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] + } + + bool getConnectionState() { + if (connectionBuilder.state == HubConnectionState.connected || connectionBuilder.state == HubConnectionState.connecting) return true; + if (connectionBuilder.state == HubConnectionState.disconnected || connectionBuilder.state == HubConnectionState.disconnecting) return false; + } +} diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index f997b6b8..16aaba3b 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -1,7 +1,7 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; class AppToast { /// show long toast message diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 6deb3907..a11b85e6 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -20,13 +20,28 @@ class DateUtil { return DateTime.now(); } + static DateTime convertStringToDateNoTimeZone(String date) { + // /Date(1585774800000+0300)/ + if (date != null) { + const start = "/Date("; + const end = ")"; + 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 convertStringToDateTime(String date) { if (date != null) { try { var dateT = date.split('/'); var year = dateT[2].substring(0, 4); - var dateP = - DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0])); + var dateP = DateTime(int.parse(year), int.parse(dateT[1]), int.parse(dateT[0])); return dateP; } catch (e) { print(e); @@ -53,6 +68,14 @@ class DateUtil { return start + "$milliseconds" + end; } + static String formatDateToDate(DateTime date, bool isArabic) { + return DateFormat('dd MMM yyy', isArabic ? "ar_SA" : "en_US").format(date); + } + + static String formatDateToTime(DateTime date) { + return DateFormat('hh:mm a').format(date); + } + static String yearMonthDay(DateTime dateTime) { String dateFormat = '${dateTime.year}-${dateTime.month}-${dateTime.day}'; return dateFormat; @@ -274,24 +297,15 @@ class DateUtil { /// [dateTime] convert DateTime to data formatted static String getMonthDayYearDateFormatted(DateTime dateTime) { if (dateTime != null) - return getMonth(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } - /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted Arabic static String getMonthDayYearDateFormattedAr(DateTime dateTime) { if (dateTime != null) - return getMonthArabic(dateTime.month) + - " " + - dateTime.day.toString() + - ", " + - dateTime.year.toString(); + return getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); else return ""; } @@ -341,6 +355,33 @@ class DateUtil { return ""; } + /// get data formatted like 26/4/2020 + 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(); + else + return ""; + } + + static String getMonthYearLangDateFormatted(DateTime dateTime, String lang) { + if (dateTime != null) + return lang == 'en' ? getMonth(dateTime.month) + " " + dateTime.year.toString() : getMonthArabic(dateTime.month) + " " + dateTime.year.toString(); + else + return ""; + } + /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime) { @@ -354,6 +395,29 @@ class DateUtil { return ""; } + /// get data formatted like 26/4/2020 + /// [dateTime] convert DateTime to data formatted + static String getDayMonthDateFormatted(DateTime dateTime) { + if (dateTime != null) + return DateFormat('dd/MM').format(dateTime); + else + return ""; + } + + /// get data formatted like 26/4/2020 + /// [dateTime] convert DateTime to data formatted according to language + static String getDayMonthYearDateFormattedLang(DateTime dateTime, bool isArabic) { + if (dateTime != null) + return DateFormat('dd/MM/yyyy', isArabic ? "ar_SA" : "en_US").format(dateTime); + else + return ""; + } + + /// get data formatted like 10:30 according to lang + static String formatDateToTimeLang(DateTime date, bool isArabic) { + return DateFormat('HH:mm', isArabic ? "ar_SA" : "en_US").format(date); + } + /// get data formatted like 26/4/2020 10:30 /// [dateTime] convert DateTime to data formatted static String getDayMonthYearHourMinuteDateFormatted(DateTime dateTime) { @@ -364,9 +428,7 @@ class DateUtil { "/" + dateTime.year.toString() + " " + - dateTime.hour.toString() + - ":" + - dateTime.minute.toString(); + DateFormat('HH:mm').format(dateTime); else return ""; } @@ -390,8 +452,9 @@ 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) { diff --git a/lib/uitl/laser_body_parts_data.dart b/lib/uitl/laser_body_parts_data.dart new file mode 100644 index 00000000..b8e8e58e --- /dev/null +++ b/lib/uitl/laser_body_parts_data.dart @@ -0,0 +1,129 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; + +class LaserBodyParts { + static final LaserBodyParts _instance = LaserBodyParts._internal(); + + LaserBodyParts._internal(); + + factory LaserBodyParts() => _instance; + + static Widget image(String assetUri) { + return new SvgPicture.asset(assetUri, fit: BoxFit.cover,width: 97,height: 97,); + } + + Map maleBodyMap = { + "40": image("assets/images/new/body_parts/male/upper_arm.svg"), + "41": image("assets/images/new/body_parts/male/lower_arm.svg"), + "42": image("assets/images/new/body_parts/male/chest.svg"), + "43": image("assets/images/new/body_parts/male/chest_line.svg"), + "44": image("assets/images/new/body_parts/male/shoulders.svg"), + "45": image("assets/images/new/body_parts/male/back.svg"), + "46": image("assets/images/new/body_parts/male/abdomin.svg"), + "47": image("assets/images/new/body_parts/male/upper_leg.svg"), + "48": image("assets/images/new/body_parts/male/lower_leg.svg"), + "49": image("assets/images/new/body_parts/male/axilla.svg") + }; + + Map maleFaceMap = { + "62": image("assets/images/new/body_parts/male/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/male/upper_lips.svg"), + "6": image("assets/images/new/body_parts/male/chin.svg"), + "7": image("assets/images/new/body_parts/male/cheek.svg"), + "8": image("assets/images/new/body_parts/male/side_burn.svg"), + "9": image("assets/images/new/body_parts/male/ears.svg"), + "10": image("assets/images/new/body_parts/male/full_neck.svg"), + "11": image("assets/images/new/body_parts/male/half_neck.svg"), + "12": image("assets/images/new/body_parts/male/eyebrows.svg") + }; + + Map maleBodyRetouchMap = { + "51": image("assets/images/new/body_parts/male/upper_arm.svg"), + "52": image("assets/images/new/body_parts/male/lower_arm.svg"), + "53": image("assets/images/new/body_parts/male/chest.svg"), + "54": image("assets/images/new/body_parts/male/shoulders.svg"), + "55": image("assets/images/new/body_parts/male/back.svg"), + "56": image("assets/images/new/body_parts/male/abdomin.svg"), + "57": image("assets/images/new/body_parts/male/full_leg.svg"), + "58": image("assets/images/new/body_parts/male/upper_leg.svg"), + "59": image("assets/images/new/body_parts/male/lower_leg.svg"), + "60": image("assets/images/new/body_parts/male/bikini.svg"), + "61": image("assets/images/new/body_parts/male/bikini_line.svg") + }; + + Map femaleBodyMap = { + "40": image("assets/images/new/body_parts/female/upper_arm.svg"), + "41": image("assets/images/new/body_parts/female/lower_arm.svg"), + "42": image("assets/images/new/body_parts/female/chest.svg"), + "43": image("assets/images/new/body_parts/female/chest_line.svg"), + "44": image("assets/images/new/body_parts/female/shoulder.svg"), + "45": image("assets/images/new/body_parts/female/back.svg"), + "46": image("assets/images/new/body_parts/female/abdomin.svg"), + "47": image("assets/images/new/body_parts/female/upper_leg.svg"), + "48": image("assets/images/new/body_parts/female/lower_leg.svg"), + "49": image("assets/images/new/body_parts/female/axilla.svg") + }; + + Map femaleFaceMap = { + "62": image("assets/images/new/body_parts/female/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/female/upper_lips.svg"), + "6": image("assets/images/new/body_parts/female/chin.svg"), + "7": image("assets/images/new/body_parts/female/cheeks.svg"), + "8": image("assets/images/new/body_parts/female/side_burn.svg"), + "9": image("assets/images/new/body_parts/female/ears.svg"), + "10": image("assets/images/new/body_parts/female/full_neck.svg"), + "11": image("assets/images/new/body_parts/female/half_neck.svg"), + "12": image("assets/images/new/body_parts/female/eyebrows.svg") + }; + + Map femaleBodyBikiniMap = { + "34": image("assets/images/new/body_parts/female/bikini.svg"), + "36": image("assets/images/new/body_parts/female/bikini_line.svg"), + "38": image("assets/images/new/body_parts/female/buttocks.svg"), + "39": image("assets/images/new/body_parts/female/anal.svg") + }; + + Map femaleBodyRetouchMap = { + "51": image("assets/images/new/body_parts/female/upper_arm.svg"), + "52": image("assets/images/new/body_parts/female/lower_arm.svg"), + "53": image("assets/images/new/body_parts/female/chest.svg"), + "54": image("assets/images/new/body_parts/female/shoulder.svg"), + "55": image("assets/images/new/body_parts/female/back.svg"), + "56": image("assets/images/new/body_parts/female/abdomin.svg"), + "57": image("assets/images/new/body_parts/female/full_leg.svg"), + "58": image("assets/images/new/body_parts/female/upper_leg.svg"), + "59": image("assets/images/new/body_parts/female/lower_leg.svg"), + "60": image("assets/images/new/body_parts/female/bikini.svg"), + "61": image("assets/images/new/body_parts/female/bikini_line.svg") + }; + + + Widget getCategoryImage(bool isMale, int category, String mappingCode) { + if (isMale) { + if (category == 1) { + return maleBodyMap[mappingCode]; + } + if (category == 2) { + return maleFaceMap[mappingCode]; + } + if (category == 11) { + return maleBodyRetouchMap[mappingCode]; + } + } else { + if (category == 1) { + return femaleBodyMap[mappingCode]; + } + if (category == 2) { + return femaleFaceMap[mappingCode]; + } + if (category == 10) { + return femaleBodyBikiniMap[mappingCode]; + } + if (category == 11) { + return femaleBodyRetouchMap[mappingCode]; + } + } + return null; + } +} diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index e2edb2a1..2daa392f 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:connectivity/connectivity.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,18 +8,15 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:huawei_location/permission/permission_handler.dart'; import 'package:huawei_location/location/fused_location_provider_client.dart'; +import 'package:huawei_location/location/location.dart'; +import 'package:huawei_location/location/location_callback.dart'; import 'package:huawei_location/location/location_request.dart'; import 'package:huawei_location/location/location_settings_request.dart'; -import 'package:huawei_location/location/location_callback.dart'; -import 'package:huawei_location/location/location.dart'; -import 'package:huawei_location/location/location_settings_states.dart'; -import 'package:huawei_location/location/location_availability.dart'; +import 'package:huawei_location/permission/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart'; class LocationUtils { - AppSharedPreferences sharedPref = new AppSharedPreferences(); bool isShowConfirmDialog; @@ -29,27 +25,28 @@ class LocationUtils { LocationUtils({@required this.isShowConfirmDialog, @required this.context}); void getCurrentLocation({Function(LatLng) callBack}) async { - print("current location"); - if(Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) { + if (Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) { _getHMSCurrentLocation(callBack); - }else{ + } else { Geolocator.isLocationServiceEnabled().then((value) { if (value) { - Geolocator.checkPermission().then((permission) { - if (permission == LocationPermission.always || - permission == LocationPermission.whileInUse) { - Geolocator.getLastKnownPosition() - .then((value){ - setLocation(value); - if(callBack != null) - callBack(LatLng(value.latitude, value.longitude)); + Geolocator.checkPermission().then((permission) async { + if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { + setLocation(value); + print(value.latitude); + print(value.longitude); + if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }); } - if (permission == LocationPermission.denied || - permission == LocationPermission.deniedForever) { - setZeroLocation(); - if (isShowConfirmDialog) showErrorLocationDialog(false); + if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { + if(await Permission.location.request().isGranted) { + getCurrentLocation(); + } else { + setZeroLocation(); + if (isShowConfirmDialog) showErrorLocationDialog(false); + } } }).catchError((err) { print(err); @@ -64,11 +61,12 @@ class LocationUtils { } LocationCallback _locationCallback; - _getHMSCurrentLocation(Function(LatLng) callBack) async{ + + _getHMSCurrentLocation(Function(LatLng) callBack) async { PermissionHandler permissionHandler = PermissionHandler(); int _locationUpdateCbId = 0; - doIt(){ + doIt() { FusedLocationProviderClient locationService = FusedLocationProviderClient(); LocationRequest locationRequest = LocationRequest(); locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY; @@ -76,37 +74,31 @@ class LocationUtils { List locationRequestList = [locationRequest]; LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList); - locationService.checkLocationSettings(locationSettingsRequest).then((settings) async{ - - _locationUpdateCbId = await locationService.requestLocationUpdatesCb(locationRequest, LocationCallback(onLocationResult: (locationResult){ - Location location = locationResult.lastLocation; - locationService.removeLocationUpdatesCb(_locationUpdateCbId); - callBack(LatLng(location.latitude, location.longitude)); - setLocation(Position(latitude: location.latitude, longitude: location.longitude, altitude: location.altitude)); - }, onLocationAvailability: (locationAvailability){ - debugPrint("onLocationAvailability: $locationAvailability"); - })); - - }).catchError((error){ - - if(error.code == "LOCATION_SETTINGS_NOT_AVAILABLE"){ + locationService.checkLocationSettings(locationSettingsRequest).then((settings) async { + _locationUpdateCbId = await locationService.requestLocationUpdatesCb( + locationRequest, + LocationCallback(onLocationResult: (locationResult) { + Location location = locationResult.lastLocation; + locationService.removeLocationUpdatesCb(_locationUpdateCbId); + callBack(LatLng(location.latitude, location.longitude)); + setLocation(Position(latitude: location.latitude, longitude: location.longitude, altitude: location.altitude)); + }, onLocationAvailability: (locationAvailability) { + debugPrint("onLocationAvailability: $locationAvailability"); + })); + }).catchError((error) { + if (error.code == "LOCATION_SETTINGS_NOT_AVAILABLE") { // Location service not enabled. } - }); - } - - if(await permissionHandler.hasLocationPermission()){ + if (await permissionHandler.hasLocationPermission()) { doIt(); - }else{ + } else { bool has = await requestPermissions(); - if(has) + if (has) doIt(); - else if(isShowConfirmDialog) - showErrorLocationDialog(false); - + else if (isShowConfirmDialog) showErrorLocationDialog(false); } } @@ -116,24 +108,14 @@ class LocationUtils { confirmMessage: TranslationBase.of(context).locationDialogMessage, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => { - ConfirmDialog.closeAlertDialog(context), - if (isPermissionError) - Geolocator.openAppSettings() - else - Geolocator.openLocationSettings() - }, + okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings()}, cancelFunction: () => {}); return dialog.showAlertDialog(context); } void setLocation(Position position) { - this - .sharedPref - .setDouble(USER_LAT, position != null ? position.latitude : 0.0); - this - .sharedPref - .setDouble(USER_LONG, position != null ? position.longitude : 0.0); + this.sharedPref.setDouble(USER_LAT, position != null ? position.latitude : 0.0); + this.sharedPref.setDouble(USER_LONG, position != null ? position.longitude : 0.0); } void setZeroLocation() { @@ -141,7 +123,6 @@ class LocationUtils { this.sharedPref.setDouble(USER_LONG, 0.0); } - Future requestPermissions() async { var result = await [ Permission.location, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 6a131d09..fb13232b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/localized_values.dart'; -import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:flutter/foundation.dart' show SynchronousFuture; import 'package:flutter/material.dart'; @@ -18,8 +17,9 @@ class TranslationBase { return localizedValues[key][locale.languageCode]; } - String get dashboardScreenToolbarTitle => - localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; + String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; + + String get bloodType1 => localizedValues['bloodType'][locale.languageCode]; String get settings => localizedValues['settings'][locale.languageCode]; @@ -49,6 +49,10 @@ class TranslationBase { String get clinic => localizedValues['clinic'][locale.languageCode]; + String get byClinic => localizedValues['by-clinic'][locale.languageCode]; + + String get byHospital => localizedValues['by-hospital'][locale.languageCode]; + String get name => localizedValues['name'][locale.languageCode]; String get doctor => localizedValues['doctor'][locale.languageCode]; @@ -59,59 +63,75 @@ class TranslationBase { String get nearestAppo => localizedValues['nearestAppo'][locale.languageCode]; - String get searchByDocText => - localizedValues['searchByDocText'][locale.languageCode]; + String get searchByDocText => localizedValues['searchByDocText'][locale.languageCode]; - String get enterDocName => - localizedValues['enterDocName'][locale.languageCode]; + String get enterDocName => localizedValues['enterDocName'][locale.languageCode]; String get search => localizedValues['search'][locale.languageCode]; - String get noResultFound => - localizedValues['noResultFound'][locale.languageCode]; - String get pleaseEnterProductName => - localizedValues['pleaseEnterProductName'][locale.languageCode]; + + String get noResultFound => localizedValues['noResultFound'][locale.languageCode]; + + String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode]; String get bookNow => localizedValues['bookNow'][locale.languageCode]; + String get reviewAppointment => localizedValues['reviewAppointment'][locale.languageCode]; + String get docInfo => localizedValues['docInfo'][locale.languageCode]; String get appoInfo => localizedValues['appoInfo'][locale.languageCode]; - String get availableAppo => - localizedValues['availableAppo'][locale.languageCode]; + String get availableAppo => localizedValues['availableAppo'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; + String get pleaseSelectGender => localizedValues['please_select_gender'][locale.languageCode]; + String get nationality => localizedValues['nationality'][locale.languageCode]; - String get docQualifications => - localizedValues['docQualifications'][locale.languageCode]; + String get docQualifications => localizedValues['docQualifications'][locale.languageCode]; - String get confirmAppoHeading => - localizedValues['confirmAppoHeading'][locale.languageCode]; + String get confirmAppoHeading => localizedValues['confirmAppoHeading'][locale.languageCode]; String get patientInfo => localizedValues['patientInfo'][locale.languageCode]; String get bookSuccess => localizedValues['bookSuccess'][locale.languageCode]; - String get patientShare => - localizedValues['patientShare'][locale.languageCode]; + String get patientShare => localizedValues['patientShare'][locale.languageCode]; + + String get neverWait => localizedValues['neverWait'][locale.languageCode]; - String get patientShareWithTax => - localizedValues['patientShareWithTax'][locale.languageCode]; + String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; + + String get reminderTitle => localizedValues['reminderTitle'][locale.languageCode]; String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode]; + String get appointmentCalendar => localizedValues['appointmentCalendar'][locale.languageCode]; + + String get appointmentReminder => localizedValues['appointmentReminder'][locale.languageCode]; + + String get prescriptionReminder => localizedValues['prescriptionReminder'][locale.languageCode]; + + String get pleaseSelectFromBelowOptions => localizedValues['please_select_from_below_options'][locale.languageCode]; + + String get appointmentSuccess => localizedValues['appointmentSuccess'][locale.languageCode]; + String get confirm => localizedValues['confirm'][locale.languageCode]; - String get confirmLiveCare => - localizedValues['confirmLiveCare'][locale.languageCode]; + String get pressAgain => localizedValues['pressAgain'][locale.languageCode]; + + String get laserMaxLimitReach => localizedValues['laserMaxLimitReach'][locale.languageCode]; + + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; - String get waitingForDoctor => - localizedValues['waitingForDoctor'][locale.languageCode]; + String get doctorFilter => localizedValues['doctorFilter'][locale.languageCode]; - String get confirmLater => - localizedValues['confirmLater'][locale.languageCode]; + String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; + + String get waitingTime => localizedValues['waitingTime'][locale.languageCode]; + + String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; String get todoList => localizedValues['todoList'][locale.languageCode]; @@ -127,47 +147,51 @@ class TranslationBase { String get login => localizedValues['login'][locale.languageCode]; - String get loginregister => - localizedValues['loginregister'][locale.languageCode]; + String get loginregister => localizedValues['loginregister'][locale.languageCode]; String get poweredBy => localizedValues['poweredBy'][locale.languageCode]; String get welcome => localizedValues['welcome'][locale.languageCode]; - String get welcomeText => - localizedValues['welcome_text'][locale.languageCode]; + String get welcomeTo => localizedValues['welcome-to'][locale.languageCode]; + + String get drSulaimanText => localizedValues['dr-sulaiman-text'][locale.languageCode]; + + String get patientApp => localizedValues['patient-app'][locale.languageCode]; - String get welcomeText2 => - localizedValues['welcome_text2'][locale.languageCode]; + String get welcomeText => localizedValues['welcome_text'][locale.languageCode]; + + String get welcomeText2 => localizedValues['welcome_text2'][locale.languageCode]; String get yes => localizedValues['yes'][locale.languageCode]; String get no => localizedValues['no'][locale.languageCode]; - String get logintypeRadio => - localizedValues['logintyperadio'][locale.languageCode]; - String get registerInfoFamily => - localizedValues['register-info-family'][locale.languageCode]; + String get logintypeRadio => localizedValues['logintyperadio'][locale.languageCode]; + + String get registerInfoFamily => localizedValues['register-info-family'][locale.languageCode]; String get registerNow => localizedValues['registernow'][locale.languageCode]; String get nationalID => localizedValues['nationalID'][locale.languageCode]; + String get medicalFileNumber => localizedValues['medical-file-number'][locale.languageCode]; + + String get nationalIdNumber => localizedValues['national-id-number'][locale.languageCode]; + String get idNo => localizedValues['national-id'][locale.languageCode]; String get fileNo => localizedValues['fileNo'][locale.languageCode]; + String get fileno => localizedValues['fileno'][locale.languageCode]; - String get forgotPassword => - localizedValues['forgotFileNo'][locale.languageCode]; - String get forgotFileNoTitle => - localizedValues['forgotFileNoTitle'][locale.languageCode]; + String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; + + String get forgotFileNoTitle => localizedValues['forgotFileNoTitle'][locale.languageCode]; - String get enterNationalId => - localizedValues['enter-national-id'][locale.languageCode]; + String get enterNationalId => localizedValues['enter-national-id'][locale.languageCode]; - String get profileInfo => - localizedValues['profile-info'][locale.languageCode]; + String get profileInfo => localizedValues['profile-info'][locale.languageCode]; String get submit => localizedValues['submit'][locale.languageCode]; @@ -177,78 +201,65 @@ class TranslationBase { String get hijriDate => localizedValues['hijri-date'][locale.languageCode]; - String get gregorianDate => - localizedValues['gregorian-date'][locale.languageCode]; + String get gregorianDate => localizedValues['gregorian-date'][locale.languageCode]; - String get verifyLoginWith => - localizedValues['verify-login-with'][locale.languageCode]; + String get verifyLoginWith => localizedValues['verify-login-with'][locale.languageCode]; String get register => localizedValues['register-user'][locale.languageCode]; - String get verifyFingerprint => - localizedValues['verify-with-fingerprint'][locale.languageCode]; + String get verifyFingerprint => localizedValues['verify-with-fingerprint'][locale.languageCode]; - String get verifyFaceID => - localizedValues['verify-with-faceid'][locale.languageCode]; + String get verifyFaceID => localizedValues['verify-with-faceid'][locale.languageCode]; - String get verifySMS => - localizedValues['verify-with-sms'][locale.languageCode]; + String get verifySMS => localizedValues['verify-with-sms'][locale.languageCode]; - String get verifyWhatsApp => - localizedValues['verify-with-whatsapp'][locale.languageCode]; + String get verifyWhatsApp => localizedValues['verify-with-whatsapp'][locale.languageCode]; + + String get verifyThrough => localizedValues['verify-through'][locale.languageCode]; String get lastLoginAt => localizedValues['last-login'][locale.languageCode]; - String get lastLoginWith => - localizedValues['last-login-with'][locale.languageCode]; + String get pleaseVerify => localizedValues['please-verify'][locale.languageCode]; + + String get lastLoginWith => localizedValues['last-login-with'][locale.languageCode]; - String get verifyFingerprint2 => - localizedValues['verify-fingerprint'][locale.languageCode]; + String get verifyFingerprint2 => localizedValues['verify-fingerprint'][locale.languageCode]; - String get searchMedicine => - localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; - String get searchMedicineHere => - localizedValues['searchMedicineHere'][locale.languageCode]; + String get searchMedicineHere => localizedValues['searchMedicineHere'][locale.languageCode]; - String get pendingPayment => - localizedValues['pendingPayment'][locale.languageCode]; + String get pendingPayment => localizedValues['pendingPayment'][locale.languageCode]; String get payNow => localizedValues['payNow'][locale.languageCode]; + String get dailyWater => localizedValues['dailyWater'][locale.languageCode]; + String get viewQR => localizedValues['viewQR'][locale.languageCode]; String get instruction => localizedValues['instruction'][locale.languageCode]; String get livecare => localizedValues['livecare'][locale.languageCode]; - String get upcomingNoAction => - localizedValues['upcoming-noAction'][locale.languageCode]; + String get upcomingNoAction => localizedValues['upcoming-noAction'][locale.languageCode]; + + String get upcomingConfirm => localizedValues['upcoming-confirm'][locale.languageCode]; - String get upcomingConfirm => - localizedValues['upcoming-confirm'][locale.languageCode]; + String get upcomingPaymentPending => localizedValues['upcoming-payment-pending'][locale.languageCode]; - String get upcomingPaymentPending => - localizedValues['upcoming-payment-pending'][locale.languageCode]; - String get upcomingConfirmMore => - localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; + String get upcomingConfirmMore => localizedValues['book-success-confirm-more-24-1-2'][locale.languageCode]; - String get upcomingPaymentNow => - localizedValues['upcoming-payment-now'][locale.languageCode]; + String get upcomingPaymentNow => localizedValues['upcoming-payment-now'][locale.languageCode]; String get upcomingQR => localizedValues['upcoming-QR'][locale.languageCode]; - String get upcomingVirtual => - localizedValues['upcoming-virtual'][locale.languageCode]; + String get upcomingVirtual => localizedValues['upcoming-virtual'][locale.languageCode]; - String get upcomingLivecare => - localizedValues['upcoming-livecare'][locale.languageCode]; + String get upcomingLivecare => localizedValues['upcoming-livecare'][locale.languageCode]; - String get liveCareAppo => - localizedValues['livecareAppo'][locale.languageCode]; + String get liveCareAppo => localizedValues['livecareAppo'][locale.languageCode]; - String get upcomingDetails => - localizedValues['upcoming-details'][locale.languageCode]; + String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; String get reschedule => localizedValues['reschedule'][locale.languageCode]; @@ -264,100 +275,178 @@ class TranslationBase { String get online => localizedValues['online'][locale.languageCode]; + String get viewMedicalFile => localizedValues['viewMedicalFile'][locale.languageCode]; + + String get viewAllServices => localizedValues['viewAllServices'][locale.languageCode]; + + String get medicalFile => localizedValues['medicalFile'][locale.languageCode]; + + String get verified => localizedValues['verified'][locale.languageCode]; + + String get onlineConsulting => localizedValues['onlineConsulting'][locale.languageCode]; + + String get checkup => localizedValues['checkup'][locale.languageCode]; + + String get comprehensive => localizedValues['comprehensive'][locale.languageCode]; + + String get hhcHome => localizedValues['hhcHome'][locale.languageCode]; + + String get refferal => localizedValues['refferal'][locale.languageCode]; + + String get healthCare => localizedValues['healthCare'][locale.languageCode]; + + String get emergency => localizedValues['emergency'][locale.languageCode]; + + String get cantSeeProfile => localizedValues['cantSeeProfile'][locale.languageCode]; + + String get loginRegisterNow => localizedValues['loginRegisterNow'][locale.languageCode]; + + String get HMGPharmacy => localizedValues['HMGPharmacy'][locale.languageCode]; + + String get ecommerceSolution => localizedValues['ecommerceSolution'][locale.languageCode]; + + String get services2 => localizedValues['services2'][locale.languageCode]; + String get payment => localizedValues['payment'][locale.languageCode]; - String get cancel_nocaps => - localizedValues['cancel-nocaps'][locale.languageCode]; + String get cancel_nocaps => localizedValues['cancel-nocaps'][locale.languageCode]; - String get cancelAppoMsg => - localizedValues['cancelAppoMsg'][locale.languageCode]; + String get cancelAppoMsg => localizedValues['cancelAppoMsg'][locale.languageCode]; - String get pharmaciesList => - localizedValues['pharmaciesList'][locale.languageCode]; + String get pharmaciesList => localizedValues['pharmaciesList'][locale.languageCode]; String get description => localizedValues['description'][locale.languageCode]; + String get howToUse => localizedValues['howToUse'][locale.languageCode]; String get price => localizedValues['price'][locale.languageCode]; - String get youCanFindItIn => - localizedValues['youCanFindItIn'][locale.languageCode]; + String get youCanFindItIn => localizedValues['youCanFindItIn'][locale.languageCode]; - String get pleaseEnterMedicineName => - localizedValues['pleaseEnterMedicineName'][locale.languageCode]; + String get pleaseEnterMedicineName => localizedValues['pleaseEnterMedicineName'][locale.languageCode]; - String get verificationMessage => - localizedValues['verification_message'][locale.languageCode]; + String get verificationMessage => localizedValues['verification_message'][locale.languageCode]; - String get validationMessage => - localizedValues['validation_message'][locale.languageCode]; + String get validationMessage => localizedValues['validation_message'][locale.languageCode]; - String get arabicChange => - localizedValues['arabic-change'][locale.languageCode]; + String get arabicChange => localizedValues['arabic-change'][locale.languageCode]; - String get notification => - localizedValues['notification'][locale.languageCode]; + String get notification => localizedValues['notification'][locale.languageCode]; String get appsetting => localizedValues['app-settings'][locale.languageCode]; + String get parkingDescription => localizedValues['parkingDescription'][locale.languageCode]; + + String get checkinOptions => localizedValues['checkinOption'][locale.languageCode]; + + String get wayHeading => localizedValues['RRT-way-heading'][locale.languageCode]; + + String get feedbackType => localizedValues["feedback-type"][locale.languageCode]; + + String get allow => localizedValues["allow"][locale.languageCode]; + + String get reject => localizedValues["reject"][locale.languageCode]; + + String get enterReferralRequesterName => localizedValues["enterReferralRequesterName"][locale.languageCode]; + + String get somethingWentWrong => localizedValues["somethingWentWrong"][locale.languageCode]; + + String get enterIdentificationNumber => localizedValues["enterIdentificationNumber"][locale.languageCode]; + + String get accountActivationDesc => localizedValues["accountActivationDesc"][locale.languageCode]; + + String get pointsToTransfer => localizedValues["pointsToTransfer"][locale.languageCode]; + + String get enterBeneficiaryAccountNo => localizedValues["enterBeneficiaryAccountNo"][locale.languageCode]; + + String get confirmPrescription => localizedValues["confirm-prescription"][locale.languageCode]; + + String get youAlreadyHaveOrder => localizedValues["you-already-have-order"][locale.languageCode]; + + String get orderOverview => localizedValues["order-overview"][locale.languageCode]; + + String get RapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode]; + + String get RRTDDetails => localizedValues['RRTDDetails'][locale.languageCode]; + + String get ApproximateServiceFee => localizedValues['ApproximateServiceFee'][locale.languageCode]; + + String get AmountBeforeTax => localizedValues['AmountBeforeTax'][locale.languageCode]; + + String get TaxAmount => localizedValues['TaxAmount'][locale.languageCode]; + + String get TotalAmountPayable => localizedValues['TotalAmountPayable'][locale.languageCode]; + + String get iAcceptTermsConditions => localizedValues['iAcceptTermsConditions'][locale.languageCode]; + + String get YouCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode]; + + String get rrtService => localizedValues['rrtService'][locale.languageCode]; + String get rateApp => localizedValues['rate-app'][locale.languageCode]; - String get setReminder => - localizedValues['set-reminder'][locale.languageCode]; + + String get setReminder => localizedValues['set-reminder'][locale.languageCode]; + String get before => localizedValues['before'][locale.languageCode]; + String get minute => localizedValues['minute'][locale.languageCode]; + String get hour => localizedValues['hour'][locale.languageCode]; - String get reminderSuccess => - localizedValues['reminderSuccess'][locale.languageCode]; - String get patientShareToDo => - localizedValues['patientShareToDo'][locale.languageCode]; - String get patientTaxToDo => - localizedValues['patientTaxToDo'][locale.languageCode]; - String get patientShareTotalToDo => - localizedValues['patientShareTotalToDo'][locale.languageCode]; - String get paymentMethod => - localizedValues['paymentMethod'][locale.languageCode]; - String get moreVerification => - localizedValues['more-verify'][locale.languageCode]; + String get reminderSuccess => localizedValues['reminderSuccess'][locale.languageCode]; + + String get patientShareToDo => localizedValues['patientShareToDo'][locale.languageCode]; + + String get patientTaxToDo => localizedValues['patientTaxToDo'][locale.languageCode]; - String get welcomeBack => - localizedValues['welcome-back'][locale.languageCode]; + String get patientShareTotalToDo => localizedValues['patientShareTotalToDo'][locale.languageCode]; - String get accountInfo => - localizedValues['account-info'][locale.languageCode]; + String get paymentMethod => localizedValues['paymentMethod'][locale.languageCode]; - String get useAnotherAccount => - localizedValues['another-acc'][locale.languageCode]; + String get moreVerification => localizedValues['more-verify'][locale.languageCode]; + + String get welcomeBack => localizedValues['welcome-back'][locale.languageCode]; + + String get accountInfo => localizedValues['account-info'][locale.languageCode]; + + String get useAnotherAccount => localizedValues['another-acc'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; - String get noNeedToWaitInLine => - localizedValues['noNeedToWaitInLine'][locale.languageCode]; - String get useQRAppoAttend => - localizedValues['useQRAppoAttend'][locale.languageCode]; - String get passQRAppoAttend => - localizedValues['passQRAppoAttend'][locale.languageCode]; - String get sitWaitingQR => - localizedValues['sitWaitingQR'][locale.languageCode]; - String get attendRegisterCode => - localizedValues['attendRegisterCode'][locale.languageCode]; - String get scanQRHospital => - localizedValues['scanQRHospital'][locale.languageCode]; + String get noNeedToWaitInLine => localizedValues['noNeedToWaitInLine'][locale.languageCode]; + + String get useQRAppoAttend => localizedValues['useQRAppoAttend'][locale.languageCode]; + + String get passQRAppoAttend => localizedValues['passQRAppoAttend'][locale.languageCode]; + + String get sitWaitingQR => localizedValues['sitWaitingQR'][locale.languageCode]; + + String get attendRegisterCode => localizedValues['attendRegisterCode'][locale.languageCode]; + + String get scanQRHospital => localizedValues['scanQRHospital'][locale.languageCode]; + String get sendEmail => localizedValues['sendEmail'][locale.languageCode]; + String get close => localizedValues['close'][locale.languageCode]; + String get closeIt => localizedValues['closeIt'][locale.languageCode]; + String get booked => localizedValues['booked'][locale.languageCode]; + String get confirmed => localizedValues['confirmed'][locale.languageCode]; + String get arrived => localizedValues['arrived'][locale.languageCode]; - String get payNowBookSuccess => - localizedValues['payNowBookSuccess'][locale.languageCode]; - String get payNowBookSuccesstext1 => - localizedValues['payNowBookSuccesstext1'][locale.languageCode]; - String get payNowBookSuccesstext2 => - localizedValues['payNowBookSuccesstext2'][locale.languageCode]; + + String get payNowBookSuccess => localizedValues['payNowBookSuccess'][locale.languageCode]; + + String get payNowBookSuccesstext1 => localizedValues['payNowBookSuccesstext1'][locale.languageCode]; + + String get payNowBookSuccesstext2 => localizedValues['payNowBookSuccesstext2'][locale.languageCode]; + String get payLater => localizedValues['payLater'][locale.languageCode]; - String get askDocNotAllowed => - localizedValues['askDocNotAllowed'][locale.languageCode]; + + String get askDocNotAllowed => localizedValues['askDocNotAllowed'][locale.languageCode]; + String get firstName => localizedValues['first-name'][locale.languageCode]; String get middleName => localizedValues['middle-name'][locale.languageCode]; @@ -368,15 +457,13 @@ class TranslationBase { String get female => localizedValues['female'][locale.languageCode]; - String get prefferedLanguage => - localizedValues['preferred-language'][locale.languageCode]; + String get prefferedLanguage => localizedValues['preferred-language'][locale.languageCode]; String get english => localizedValues['english'][locale.languageCode]; String get arabic => localizedValues['arabic'][locale.languageCode]; - String get registrLocation => - localizedValues['locations-register'][locale.languageCode]; + String get registrLocation => localizedValues['locations-register'][locale.languageCode]; String get ksa => localizedValues['ksa'][locale.languageCode]; @@ -386,1410 +473,2324 @@ class TranslationBase { String get family => localizedValues['family'][locale.languageCode]; - String get myFamilyFiles => - localizedValues['family-title'][locale.languageCode]; + String get myFamilyFiles => localizedValues['family-title'][locale.languageCode]; + String get myFamily => localizedValues['myFamily'][locale.languageCode]; String get oxygenation => localizedValues['oxygenation'][locale.languageCode]; - String get respirationRate => - localizedValues['respirationRate'][locale.languageCode]; - String get bodyMeasurements => - localizedValues['bodyMeasurements'][locale.languageCode]; + String get respirationRate => localizedValues['respirationRate'][locale.languageCode]; + + String get bodyMeasurements => localizedValues['bodyMeasurements'][locale.languageCode]; + String get height => localizedValues['height'][locale.languageCode]; + + String get unit => localizedValues['unit'][locale.languageCode]; + String get heightUnit => localizedValues['heightUnit'][locale.languageCode]; + String get weightUnit => localizedValues['weightUnit'][locale.languageCode]; + String get temperature => localizedValues['temperature'][locale.languageCode]; String get pulse => localizedValues['pulse'][locale.languageCode]; String get respiration => localizedValues['respiration'][locale.languageCode]; - String get bloodPressure => - localizedValues['bloodPressure'][locale.languageCode]; + String get bloodPressure => localizedValues['bloodPressure'][locale.languageCode]; + String get painScale => localizedValues['painScale'][locale.languageCode]; + String get heart => localizedValues['heart'][locale.languageCode]; String get weight => localizedValues['weight'][locale.languageCode]; String get request => localizedValues['request'][locale.languageCode]; + String get memberName => localizedValues['member-name'][locale.languageCode]; + String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => - localizedValues['remove-membe'][locale.languageCode]; + + String get removeMember => localizedValues['remove-membe'][locale.languageCode]; + String get allowView => localizedValues['allow-view'][locale.languageCode]; + String get rejectView => localizedValues['reject-view'][locale.languageCode]; + String get deleteView => localizedValues['delete-view'][locale.languageCode]; + String get approvals => localizedValues['approvals'][locale.languageCode]; + String get approvalNo => localizedValues['approvalNo'][locale.languageCode]; + String get companyName => localizedValues['companyName'][locale.languageCode]; + String get receiptOn => localizedValues['receiptOn'][locale.languageCode]; + + String get expiryOn => localizedValues['expiryOn'][locale.languageCode]; + String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; - String get procedureName => - localizedValues['procedureName'][locale.languageCode]; - String get procedureStatus => - localizedValues['procedureStatus'][locale.languageCode]; + + String get procedureName => localizedValues['procedureName'][locale.languageCode]; + + String get procedure => localizedValues['procedure'][locale.languageCode]; + + String get procedureStatus => localizedValues['procedureStatus'][locale.languageCode]; + String get usageStatus => localizedValues['usageStatus'][locale.languageCode]; + String get unusedCount => localizedValues['unusedCount'][locale.languageCode]; - String get totalApproval => - localizedValues['totalApproval'][locale.languageCode]; + + String get totalApproval => localizedValues['totalApproval'][locale.languageCode]; + String get category => localizedValues['category'][locale.languageCode]; - String get expirationDate => - localizedValues['expirationDate'][locale.languageCode]; + + String get expirationDate => localizedValues['expirationDate'][locale.languageCode]; + String get patientCard => localizedValues['patientCard'][locale.languageCode]; - String get policyNumber => - localizedValues['policyNumber'][locale.languageCode]; + + String get policyNumber => localizedValues['policyNumber'][locale.languageCode]; + String get seeDetails => localizedValues['seeDetails'][locale.languageCode]; - String get insuranceCards => - localizedValues['insuranceCards'][locale.languageCode]; + + String get insuranceCards => localizedValues['insuranceCards'][locale.languageCode]; + String get requestType => localizedValues['requestType'][locale.languageCode]; - String get addFamilyMember => - localizedValues['add-new-member'][locale.languageCode]; - String get removeFamilyMember => - localizedValues['remove-family-member'][locale.languageCode]; - - String get myMedicalFile => - localizedValues['MyMedicalFile'][locale.languageCode]; - String get myMedicalFileSubTitle => - localizedValues['myMedicalFileSubTitle'][locale.languageCode]; + + String get addFamilyMember => localizedValues['add-new-member'][locale.languageCode]; + + String get removeFamilyMember => localizedValues['remove-family-member'][locale.languageCode]; + + String get myMedicalFile => localizedValues['MyMedicalFile'][locale.languageCode]; + + String get myMedicalFileSubTitle => localizedValues['myMedicalFileSubTitle'][locale.languageCode]; + String get viewMore => localizedValues['viewMore'][locale.languageCode]; - String get homeHealthCareService => - localizedValues['homeHealthCareService'][locale.languageCode]; - String get onlinePharmacy => - localizedValues['OnlinePharmacy'][locale.languageCode]; - String get emergencyService => - localizedValues['EmergencyService'][locale.languageCode]; - String get onlinePaymentService => - localizedValues['OnlinePaymentService'][locale.languageCode]; - String get offersAndPackages => - localizedValues['OffersAndPackages'][locale.languageCode]; - String get comprehensiveMedicalCheckup => - localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode]; + + String get homeHealthCareService => localizedValues['homeHealthCareService'][locale.languageCode]; + + String get onlinePharmacy => localizedValues['OnlinePharmacy'][locale.languageCode]; + + String get emergencyService => localizedValues['EmergencyService'][locale.languageCode]; + + String get onlinePaymentService => localizedValues['OnlinePaymentService'][locale.languageCode]; + + String get offersAndPackages => localizedValues['OffersAndPackages'][locale.languageCode]; + + String get comprehensiveMedicalCheckup => localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode]; + String get hMGService => localizedValues['HMGService'][locale.languageCode]; - String get viewAllHabibMedicalService => - localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; + + String get viewAllHabibMedicalService => localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; + String get viewAll => localizedValues['viewAll'][locale.languageCode]; + String get view => localizedValues['view'][locale.languageCode]; + String get contactUs => localizedValues['ContactUs'][locale.languageCode]; - String get viewAllWaysReachUs => - localizedValues['ViewAllWaysReachUs'][locale.languageCode]; - String get medicalProfile => - localizedValues['medicalProfile'][locale.languageCode]; + + String get viewAllWaysReachUs => localizedValues['ViewAllWaysReachUs'][locale.languageCode]; + + String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; + String get parking => localizedValues['parking'][locale.languageCode]; - String get parkingDescription => - localizedValues['parkingDescription'][locale.languageCode]; - String get checkinOptions => - localizedValues['checkinOption'][locale.languageCode]; - String get alhabiServices => - localizedValues['alhabiServices'][locale.languageCode]; - String get parkingTitle => - localizedValues['parkingTitle'][locale.languageCode]; + + String get alhabiServices => localizedValues['alhabiServices'][locale.languageCode]; + + String get parkingTitle => localizedValues['parkingTitle'][locale.languageCode]; + String get readBarcode => localizedValues['readBarcode'][locale.languageCode]; + String get showMyPark => localizedValues['showMyPark'][locale.languageCode]; + String get clearMyData => localizedValues['clearMyData'][locale.languageCode]; + String get floor => localizedValues['floor'][locale.languageCode]; + String get gate => localizedValues['gate'][locale.languageCode]; + String get building => localizedValues['building'][locale.languageCode]; + String get branch => localizedValues['branch'][locale.languageCode]; - String get emergencyServices => - localizedValues['emergencyServices'][locale.languageCode]; + + String get emergencyServices => localizedValues['emergencyServices'][locale.languageCode]; + String get nearester => localizedValues['nearester'][locale.languageCode]; + String get locationa => localizedValues['locationa'][locale.languageCode]; - String get ambulancerequest => - localizedValues['ambulancerequest'][locale.languageCode]; + + String get callNow => localizedValues['call_now'][locale.languageCode]; + + String get ambulancerequest => localizedValues['ambulancerequest'][locale.languageCode]; + String get requestA => localizedValues['requestA'][locale.languageCode]; - String get consultation => - localizedValues['consultation'][locale.languageCode]; + + String get consultation => localizedValues['consultation'][locale.languageCode]; + String get logs => localizedValues['logs'][locale.languageCode]; - String get textToSpeech => - localizedValues['textToSpeech'][locale.languageCode]; - - String get myAppointments => - localizedValues['MyAppointments'][locale.languageCode]; - String get noBookedAppointments => - localizedValues['NoBookedAppointments'][locale.languageCode]; - String get noConfirmedAppointments => - localizedValues['NoConfirmedAppointments'][locale.languageCode]; - String get noArrivedAppointments => - localizedValues['noArrivedAppointments'][locale.languageCode]; - String get myAppointmentsList => - localizedValues['MyAppointmentsList'][locale.languageCode]; + + String get textToSpeech => localizedValues['textToSpeech'][locale.languageCode]; + + String get myAppointments => localizedValues['MyAppointments'][locale.languageCode]; + + String get noBookedAppointments => localizedValues['NoBookedAppointments'][locale.languageCode]; + + String get noConfirmedAppointments => localizedValues['NoConfirmedAppointments'][locale.languageCode]; + + String get noArrivedAppointments => localizedValues['noArrivedAppointments'][locale.languageCode]; + + String get myAppointmentsList => localizedValues['MyAppointmentsList'][locale.languageCode]; + String get radiology => localizedValues['Radiology'][locale.languageCode]; - String get radiologySubtitle => - localizedValues['RadiologySubtitle'][locale.languageCode]; + + String get radiologySubtitle => localizedValues['RadiologySubtitle'][locale.languageCode]; + String get lab => localizedValues['Lab'][locale.languageCode]; + String get labSubtitle => localizedValues['LabSubtitle'][locale.languageCode]; + String get medicines => localizedValues['Medicines'][locale.languageCode]; - String get medicinesSubtitle => - localizedValues['MedicinesSubtitle'][locale.languageCode]; + + String get medicinesSubtitle => localizedValues['MedicinesSubtitle'][locale.languageCode]; + String get vitalSigns => localizedValues['VitalSigns'][locale.languageCode]; - String get vitalSignsSubtitle => - localizedValues['VitalSignsSubTitle'][locale.languageCode]; + + String get vitalSignsSubtitle => localizedValues['VitalSignsSubTitle'][locale.languageCode]; + String get myMedical => localizedValues['MyMedical'][locale.languageCode]; - String get myMedicalSubtitle => - localizedValues['MyMedicalSubtitle'][locale.languageCode]; + + String get myMedicalSubtitle => localizedValues['MyMedicalSubtitle'][locale.languageCode]; + String get myDoctor => localizedValues['MyDoctor'][locale.languageCode]; - String get myDoctorSubtitle => - localizedValues['MyDoctorSubtitle'][locale.languageCode]; + + String get myDoctorSubtitle => localizedValues['MyDoctorSubtitle'][locale.languageCode]; + String get eye => localizedValues['Eye'][locale.languageCode]; + String get eyeSubtitle => localizedValues['EyeSubtitle'][locale.languageCode]; + String get insurance => localizedValues['Insurance'][locale.languageCode]; - String get insuranceSubtitle => - localizedValues['InsuranceSubtitle'][locale.languageCode]; - String get updateInsurance => - localizedValues['UpdateInsurance'][locale.languageCode]; - String get updateInsuranceSubtitle => - localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; - String get insuranceApproval => - localizedValues['InsuranceApproval'][locale.languageCode]; - String get insuranceApprovalSubtitle => - localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; + + String get insuranceSubtitle => localizedValues['InsuranceSubtitle'][locale.languageCode]; + + String get updateInsurance => localizedValues['UpdateInsurance'][locale.languageCode]; + + String get updateInsuranceSubtitle => localizedValues['UpdateInsuranceSubtitle'][locale.languageCode]; + + String get insuranceApproval => localizedValues['InsuranceApproval'][locale.languageCode]; + + String get insuranceApprovalSubtitle => localizedValues['InsuranceApprovalSubtitle'][locale.languageCode]; + String get allergies => localizedValues['Allergies'][locale.languageCode]; - String get allergiesSubtitle => - localizedValues['AllergiesSubtitle'][locale.languageCode]; + + String get allergiesSubtitle => localizedValues['AllergiesSubtitle'][locale.languageCode]; + String get myVaccines => localizedValues['MyVaccines'][locale.languageCode]; - String get myVaccinesSubtitle => - localizedValues['MyVaccinesSubtitle'][locale.languageCode]; + + String get myVaccinesSubtitle => localizedValues['MyVaccinesSubtitle'][locale.languageCode]; + String get medical => localizedValues['Medical'][locale.languageCode]; - String get medicalSubtitle => - localizedValues['MedicalSubtitle'][locale.languageCode]; + + String get medicalSubtitle => localizedValues['MedicalSubtitle'][locale.languageCode]; + String get monthly => localizedValues['Monthly'][locale.languageCode]; - String get monthlySubtitle => - localizedValues['MonthlySubtitle'][locale.languageCode]; + + String get monthlySubtitle => localizedValues['MonthlySubtitle'][locale.languageCode]; + String get sick => localizedValues['Sick'][locale.languageCode]; - String get sickSubtitle => - localizedValues['SickSubtitle'][locale.languageCode]; + + String get sickSubtitle => localizedValues['SickSubtitle'][locale.languageCode]; + String get myBalance => localizedValues['MyBalance'][locale.languageCode]; - String get myBalanceSubtitle => - localizedValues['MyBalanceSubtitle'][locale.languageCode]; + + String get myBalanceSubtitle => localizedValues['MyBalanceSubtitle'][locale.languageCode]; + String get patientCall => localizedValues['PatientCall'][locale.languageCode]; - String get patientCallSubtitle => - localizedValues['PatientCallSubtitle'][locale.languageCode]; - String get smartWatches => - localizedValues['SmartWatches'][locale.languageCode]; - String get smartWatchesSubtitle => - localizedValues['SmartWatchesSubtitle'][locale.languageCode]; + + String get patientCallSubtitle => localizedValues['PatientCallSubtitle'][locale.languageCode]; + + String get smartWatches => localizedValues['SmartWatches'][locale.languageCode]; + + String get smartWatchesSubtitle => localizedValues['SmartWatchesSubtitle'][locale.languageCode]; + String get myTrackers => localizedValues['MyTrackers'][locale.languageCode]; - String get myTrackersSubtitle => - localizedValues['MyTrackersSubtitle'][locale.languageCode]; + + String get myTrackersSubtitle => localizedValues['MyTrackersSubtitle'][locale.languageCode]; + String get askYour => localizedValues['AskYour'][locale.languageCode]; - String get askYourSubtitle => - localizedValues['AskYourSubtitle'][locale.languageCode]; + + String get askYourSubtitle => localizedValues['AskYourSubtitle'][locale.languageCode]; + String get internet => localizedValues['Internet'][locale.languageCode]; - String get internetSubtitle => - localizedValues['InternetSubtitle'][locale.languageCode]; + + String get internetSubtitle => localizedValues['InternetSubtitle'][locale.languageCode]; + String get chatbot => localizedValues['Chatbot'][locale.languageCode]; - String get chatbotSubtitle => - localizedValues['ChatbotSubtitle'][locale.languageCode]; + + String get chatbotSubtitle => localizedValues['ChatbotSubtitle'][locale.languageCode]; + String get timeLine => localizedValues['TimeLine'][locale.languageCode]; + String get labOrders => localizedValues['LabOrders'][locale.languageCode]; + String get billNo => localizedValues['BillNo'][locale.languageCode]; - String get prescriptions => - localizedValues['Prescriptions'][locale.languageCode]; + + String get prescriptions => localizedValues['Prescriptions'][locale.languageCode]; + String get history => localizedValues['History'][locale.languageCode]; + String get orderNo => localizedValues['OrderNo'][locale.languageCode]; - String get trackDeliveryDriver => - localizedValues['trackDeliveryDriver'][locale.languageCode]; - String get orderDetails => - localizedValues['OrderDetails'][locale.languageCode]; + + String get trackDeliveryDriver => localizedValues['trackDeliveryDriver'][locale.languageCode]; + + String get orderDetails => localizedValues['OrderDetails'][locale.languageCode]; + String get vitalSign => localizedValues['VitalSign'][locale.languageCode]; - String get monthlyReports => - localizedValues['MonthlyReports'][locale.languageCode]; - String get locationDialogMessage => - localizedValues['locationDialogMessage'][locale.languageCode]; - String get userViewRequest => - localizedValues['user-view-requester'][locale.languageCode]; + String get monthlyReports => localizedValues['MonthlyReports'][locale.languageCode]; + + String get locationDialogMessage => localizedValues['locationDialogMessage'][locale.languageCode]; + + String get userViewRequest => localizedValues['user-view-requester'][locale.languageCode]; + String get userView => localizedValues['user-view'][locale.languageCode]; - String get sentRequest => - localizedValues['sent-requests'][locale.languageCode]; + + String get sentRequest => localizedValues['sent-requests'][locale.languageCode]; + String get km => localizedValues['km'][locale.languageCode]; + String get km_ => localizedValues['km_'][locale.languageCode]; - String get patientHealthSummaryReport => - localizedValues['PatientHealthSummaryReport'][locale.languageCode]; - String get toViewTheTermsAndConditions => - localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + + String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; + + String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + String get clickHere => localizedValues['ClickHere'][locale.languageCode]; - String get iAgreeToTheTermsAndConditions => - localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; - String get iAgreeToTheTermsAndConditionsSubtitle => - localizedValues['IAgreeToTheTermsAndConditionsSubtitle'] - [locale.languageCode]; + + String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; + + String get iAgreeToTheTermsAndConditionsSubtitle => localizedValues['IAgreeToTheTermsAndConditionsSubtitle'][locale.languageCode]; + String get save => localizedValues['Save'][locale.languageCode]; - String get userAgreement => - localizedValues['UserAgreement'][locale.languageCode]; - String get updateSuccessfully => - localizedValues['UpdateSuccessfully'][locale.languageCode]; - String get emailSentSuccessfully => - localizedValues['EmailSentSuccessfully'][locale.languageCode]; - String get EmailSentError => - localizedValues['EmailSentError'][locale.languageCode]; - String get checkVaccineAvailability => - localizedValues['CHECK_VACCINE_AVAILABILITY'][locale.languageCode]; - String get myVaccinesAvailability => - localizedValues['MyVaccinesAvailability'][locale.languageCode]; - String get paymentService => - localizedValues['PaymentService'][locale.languageCode]; - String get paymentOnline => - localizedValues['PaymentOnline'][locale.languageCode]; - String get onlineCheckIn => - localizedValues['OnlineCheckIn'][locale.languageCode]; + + String get agreeTo => localizedValues['agreeTo'][locale.languageCode]; + + String get termsConditoins => localizedValues['termsConditoins'][locale.languageCode]; + + String get userAgreement => localizedValues['UserAgreement'][locale.languageCode]; + + String get updateSuccessfully => localizedValues['UpdateSuccessfully'][locale.languageCode]; + + String get emailSentSuccessfully => localizedValues['EmailSentSuccessfully'][locale.languageCode]; + + String get EmailSentError => localizedValues['EmailSentError'][locale.languageCode]; + + String get checkVaccineAvailability => localizedValues['CHECK_VACCINE_AVAILABILITY'][locale.languageCode]; + + String get myVaccinesAvailability => localizedValues['MyVaccinesAvailability'][locale.languageCode]; + + String get paymentService => localizedValues['PaymentService'][locale.languageCode]; + + String get paymentOnline => localizedValues['PaymentOnline'][locale.languageCode]; + + String get onlineCheckIn => localizedValues['OnlineCheckIn'][locale.languageCode]; + String get myBalances => localizedValues['MyBalances'][locale.languageCode]; - String get balanceAmount => - localizedValues['BalanceAmount'][locale.languageCode]; - String get totalBalance => - localizedValues['TotalBalance'][locale.languageCode]; - String get createAdvancedPayment => - localizedValues['CreateAdvancedPayment'][locale.languageCode]; - String get advancePayment => - localizedValues['AdvancePayment'][locale.languageCode]; - String get advancePaymentLabel => - localizedValues['AdvancePaymentLabel'][locale.languageCode]; - String get referralRequesterInformation => - localizedValues['referralRequesterInformation'][locale.languageCode]; - String get fileNumber => localizedValues['FileNumber'][locale.languageCode]; - String get amount => localizedValues['Amount'][locale.languageCode]; - String get depositorEmail => - localizedValues['DepositorEmail'][locale.languageCode]; - String get notes => localizedValues['Notes'][locale.languageCode]; - String get selectPatientName => - localizedValues['SelectPatientName'][locale.languageCode]; - String get selectFamilyPatientName => - localizedValues['SelectFamilyPatientName'][locale.languageCode]; - String get selectHospital => - localizedValues['SelectHospital'][locale.languageCode]; + + String get myWallet => localizedValues['MyWallet'][locale.languageCode]; + + String get balanceAmount => localizedValues['BalanceAmount'][locale.languageCode]; + + String get totalBalance => localizedValues['TotalBalance'][locale.languageCode]; + + String get createAdvancedPayment => localizedValues['CreateAdvancedPayment'][locale.languageCode]; + + String get advancePayment => localizedValues['AdvancePayment'][locale.languageCode]; + + String get advancePaymentLabel => localizedValues['AdvancePaymentLabel'][locale.languageCode]; + + String get referralRequesterInformation => localizedValues['referralRequesterInformation'][locale.languageCode]; + + String get fileNumber => localizedValues['FileNumber'][locale.languageCode]; + + String get enterfileNumber => localizedValues['enterfileNumber'][locale.languageCode]; + + String get complaintNumber => localizedValues['complaintNumber'][locale.languageCode]; + + String get identificationNumber => localizedValues['identificationNumber'][locale.languageCode]; + + String get amount => localizedValues['Amount'][locale.languageCode]; + + String get depositorEmail => localizedValues['DepositorEmail'][locale.languageCode]; + + String get notes => localizedValues['Notes'][locale.languageCode]; + + String get selectPatientName => localizedValues['SelectPatientName'][locale.languageCode]; + + String get selectFamilyPatientName => localizedValues['SelectFamilyPatientName'][locale.languageCode]; + + String get selectHospital => localizedValues['SelectHospital'][locale.languageCode]; + String get selectCity => localizedValues['selectCity'][locale.languageCode]; + + String get city => localizedValues['city'][locale.languageCode]; + + String get distance => localizedValues['distance'][locale.languageCode]; + String get myAccount => localizedValues['MyAccount'][locale.languageCode]; - String get otherAccount => - localizedValues['OtherAccount'][locale.languageCode]; - String get selectBeneficiary => - localizedValues['SelectBeneficiary'][locale.languageCode]; - String get confirmThePayment => - localizedValues['ConfirmThePayment'][locale.languageCode]; - String get depositorName => - localizedValues['DepositorName'][locale.languageCode]; - String get mobileNumber => - localizedValues['MobileNumber'][locale.languageCode]; + + String get otherAccount => localizedValues['OtherAccount'][locale.languageCode]; + + String get selectBeneficiary => localizedValues['SelectBeneficiary'][locale.languageCode]; + + String get confirmThePayment => localizedValues['ConfirmThePayment'][locale.languageCode]; + + String get changePayment => localizedValues['changePayment'][locale.languageCode]; + + String get depositorName => localizedValues['DepositorName'][locale.languageCode]; + + String get mobileNumber => localizedValues['MobileNumber'][locale.languageCode]; + + String get phoneNumber => localizedValues['phone-number'][locale.languageCode]; + + String get country => localizedValues['country'][locale.languageCode]; + String get ok => localizedValues['Ok'][locale.languageCode]; - String get averageWaitingTime => - localizedValues['averageWaitingTime'][locale.languageCode]; - String get waterConsumedInWeek => - localizedValues['WaterConsumedInWeek'][locale.languageCode]; - String get waterConsumedInMonth => - localizedValues['WaterConsumedInMonth'][locale.languageCode]; - String get theVerificationCodeExpiresIn => - localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; - String get pleaseEnterTheVerificationCode => - localizedValues['PleaseEnterTheVerificationCode'][locale.languageCode]; - String get eyeMeasurements => - localizedValues['EyeMeasurements'][locale.languageCode]; - String get measurements => - localizedValues['Measurements'][locale.languageCode]; + + String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode]; + + String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; + + String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; + + String get theVerificationCodeExpiresIn => localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; + + String get pleaseEnterTheVerificationCode => localizedValues['PleaseEnterTheVerificationCode'][locale.languageCode]; + + String get eyeMeasurements => localizedValues['EyeMeasurements'][locale.languageCode]; + + String get measurements => localizedValues['Measurements'][locale.languageCode]; + String get classes => localizedValues['Classes'][locale.languageCode]; + String get contactLens => localizedValues['ContactLens'][locale.languageCode]; + String get rightEye => localizedValues['RightEye'][locale.languageCode]; + String get sphere => localizedValues['Sphere'][locale.languageCode]; + String get cylinder => localizedValues['Cylinder'][locale.languageCode]; + String get axis => localizedValues['Axis'][locale.languageCode]; + String get prism => localizedValues['Prism'][locale.languageCode]; + String get va => localizedValues['VA'][locale.languageCode]; + String get leftEye => localizedValues['LeftEye'][locale.languageCode]; + String get brand => localizedValues['Brand'][locale.languageCode]; + String get power => localizedValues['Power'][locale.languageCode]; + String get diameter => localizedValues['Diameter'][locale.languageCode]; + String get remarks => localizedValues['Remarks'][locale.languageCode]; - String get activeMedications => - localizedValues['ActiveMedications'][locale.languageCode]; + + String get activeMedications => localizedValues['ActiveMedications'][locale.languageCode]; + String get expDate => localizedValues['ExpDate'][locale.languageCode]; + String get route => localizedValues['Route'][locale.languageCode]; + String get frequency => localizedValues['Frequency'][locale.languageCode]; - String get dailyQuantity => - localizedValues['DailyQuantity'][locale.languageCode]; + + String get dailyQuantity => localizedValues['DailyQuantity'][locale.languageCode]; + String get addReminder => localizedValues['AddReminder'][locale.languageCode]; + String get reminderDes => localizedValues['reminderDes'][locale.languageCode]; + String get startDay => localizedValues['StartDay'][locale.languageCode]; + String get endDay => localizedValues['EndDay'][locale.languageCode]; + String get days => localizedValues['Days'][locale.languageCode]; - String get scheduleTime => - localizedValues['ScheduleTime'][locale.languageCode]; + + String get scheduleTime => localizedValues['ScheduleTime'][locale.languageCode]; + String get askDoctor => localizedValues['AskDoctor'][locale.languageCode]; - String get doctorResponses => - localizedValues['DoctorResponses'][locale.languageCode]; + + String get doctorResponses => localizedValues['DoctorResponses'][locale.languageCode]; + String get newDes => localizedValues['New'][locale.languageCode]; + String get all => localizedValues['All'][locale.languageCode]; - String get questionHere => - localizedValues['QuestionHere'][locale.languageCode]; - String get viewDoctorResponses => - localizedValues['ViewDoctorResponses'][locale.languageCode]; - String get serviceInformationButton => - localizedValues['ServiceInformationButton'][locale.languageCode]; - String get serviceInformationTitle => - localizedValues['ServiceInformationTitle'][locale.languageCode]; + + String get questionHere => localizedValues['QuestionHere'][locale.languageCode]; + + String get viewDoctorResponses => localizedValues['ViewDoctorResponses'][locale.languageCode]; + + String get serviceInformationButton => localizedValues['ServiceInformationButton'][locale.languageCode]; + + String get serviceInformationTitle => localizedValues['ServiceInformationTitle'][locale.languageCode]; + String get infoLab => localizedValues['info-lab'][locale.languageCode]; - String get infoRadiology => - localizedValues['info-radiology'][locale.languageCode]; + + String get infoRadiology => localizedValues['info-radiology'][locale.languageCode]; + String get orders => localizedValues['orders'][locale.languageCode]; + String get lakum => localizedValues['lakum'][locale.languageCode]; + + String get lakumMsg => localizedValues['lakumMsg'][locale.languageCode]; + + String get lakumPoint => localizedValues['lakumPoint'][locale.languageCode]; + + String get MEMBERSINCE => localizedValues['MEMBERSINCE'][locale.languageCode]; + + String get IDENTIFICATION => localizedValues['IDENTIFICATION'][locale.languageCode]; + + String get lakumMobile => localizedValues['lakumMobile'][locale.languageCode]; + + String get Waitinggained => localizedValues['Waitinggained'][locale.languageCode]; + + String get Expired => localizedValues['Expired'][locale.languageCode]; + + String get WillBeExpired => localizedValues['WillBeExpired'][locale.languageCode]; + + String get RIYAL => localizedValues['RIYAL'][locale.languageCode]; + + String get LakumPoint => localizedValues['LakumPoint'][locale.languageCode]; + + String get ActivateLAKUMAccount => localizedValues['ActivateLAKUMAccount'][locale.languageCode]; + String get wishlist => localizedValues['wishlist'][locale.languageCode]; + String get brands => localizedValues['brands'][locale.languageCode]; + String get products => localizedValues['products'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; - String get productDetails => - localizedValues['productDetails'][locale.languageCode]; - String get noReviewsAvailable => - localizedValues['noReviewsAvailable'][locale.languageCode]; - String get noLocationAvailable => - localizedValues['noLocationAvailable'][locale.languageCode]; - String get myPrescriptions => - localizedValues['myPrescriptions'][locale.languageCode]; - String get medicationRefill => - localizedValues['medicationRefill'][locale.languageCode]; - String get pillReminder => - localizedValues['pillReminder'][locale.languageCode]; - String get shippingAddresses => - localizedValues['shippingAddresses'][locale.languageCode]; + + String get productDetails => localizedValues['productDetails'][locale.languageCode]; + + String get noReviewsAvailable => localizedValues['noReviewsAvailable'][locale.languageCode]; + + String get noLocationAvailable => localizedValues['noLocationAvailable'][locale.languageCode]; + + String get myPrescriptions => localizedValues['myPrescriptions'][locale.languageCode]; + + String get medicationRefill => localizedValues['medicationRefill'][locale.languageCode]; + + String get pillReminder => localizedValues['pillReminder'][locale.languageCode]; + + String get shippingAddresses => localizedValues['shippingAddresses'][locale.languageCode]; + String get reachUs => localizedValues['reachUs'][locale.languageCode]; - String get ourLocations => - localizedValues['ourLocations'][locale.languageCode]; + + String get ourLocations => localizedValues['ourLocations'][locale.languageCode]; + String get edit => localizedValues['edit'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; + String get addAddress => localizedValues['addAddress'][locale.languageCode]; - String get addNewAddress => - localizedValues['addNewAddress'][locale.languageCode]; + + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; + String get order => localizedValues['order'][locale.languageCode]; + String get delivered => localizedValues['delivered'][locale.languageCode]; + String get processing => localizedValues['processing'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get cancelled => localizedValues['cancelled'][locale.languageCode]; + String get writeReview => localizedValues['writeReview'][locale.languageCode]; + String get shareReview => localizedValues['shareReview'][locale.languageCode]; - String get backMyAccount => - localizedValues['backMyAccount'][locale.languageCode]; - String get reviewSuccessful => - localizedValues['reviewSuccessful'][locale.languageCode]; - String get reviewShared => - localizedValues['reviewShared'][locale.languageCode]; - String get reviewComment => - localizedValues['reviewComment'][locale.languageCode]; - String get shippedMethod => - localizedValues['shippedMethod'][locale.languageCode]; + + String get backMyAccount => localizedValues['backMyAccount'][locale.languageCode]; + + String get reviewSuccessful => localizedValues['reviewSuccessful'][locale.languageCode]; + + String get reviewShared => localizedValues['reviewShared'][locale.languageCode]; + + String get reviewComment => localizedValues['reviewComment'][locale.languageCode]; + + String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; + String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; - String get deliveryDriverTrack => - localizedValues['DeliveryDriverTrack'][locale.languageCode]; - String get deliveryLocation => - localizedValues['DeliveryLocation'][locale.languageCode]; + + String get deliveryDriverTrack => localizedValues['DeliveryDriverTrack'][locale.languageCode]; + + String get deliveryLocation => localizedValues['DeliveryLocation'][locale.languageCode]; + String get driver => localizedValues['Driver'][locale.languageCode]; + String get subtotal => localizedValues['subtotal'][locale.languageCode]; + String get shipping => localizedValues['shipping'][locale.languageCode]; + String get shipBy => localizedValues['shipBy'][locale.languageCode]; + String get lakumPoints => localizedValues['lakumPoints'][locale.languageCode]; + String get use => localizedValues['use'][locale.languageCode]; + String get proceedPay => localizedValues['proceedPay'][locale.languageCode]; + String get vat => localizedValues['vat'][locale.languageCode]; - String get inclusiveVat => - localizedValues['inclusiveVat'][locale.languageCode]; + + String get inclusiveVat => localizedValues['inclusiveVat'][locale.languageCode]; + String get items => localizedValues['items'][locale.languageCode]; + String get checkOut => localizedValues['checkOut'][locale.languageCode]; + String get total => localizedValues['total'][locale.languageCode]; + String get sar => localizedValues['sar'][locale.languageCode]; + String get payOnline => localizedValues['payOnline'][locale.languageCode]; + String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; - String get confirmAddress => - localizedValues['confirmAddress'][locale.languageCode]; - String get confirmLocation => - localizedValues['confirmLocation'][locale.languageCode]; - String get confirmDeleteMsg => - localizedValues['confirmDeleteMsg'][locale.languageCode]; - String get confirmDelete => - localizedValues['confirmDelete'][locale.languageCode]; - String get confirmCancellation => - localizedValues['confirmCancellation'][locale.languageCode]; - String get serviceInformation => - localizedValues['ServiceInformation'][locale.languageCode]; - String get homeHealthCare => - localizedValues['HomeHealthCare'][locale.languageCode]; - String get HHCNotAuthMsg => - localizedValues['HHCNotAuthMsg'][locale.languageCode]; - String get homeHealthCareText => - localizedValues['HomeHealthCareText'][locale.languageCode]; - String get loginRegister => - localizedValues['LoginRegister'][locale.languageCode]; + + String get confirmAddress => localizedValues['confirmAddress'][locale.languageCode]; + + String get confirmLocation => localizedValues['confirmLocation'][locale.languageCode]; + + String get confirmDeleteMsg => localizedValues['confirmDeleteMsg'][locale.languageCode]; + + String get confirmDelete => localizedValues['confirmDelete'][locale.languageCode]; + + String get confirmCancellation => localizedValues['confirmCancellation'][locale.languageCode]; + + String get serviceInformation => localizedValues['ServiceInformation'][locale.languageCode]; + + String get homeHealthCare => localizedValues['HomeHealthCare'][locale.languageCode]; + + String get HHCNotAuthMsg => localizedValues['HHCNotAuthMsg'][locale.languageCode]; + + String get homeHealthCareText => localizedValues['HomeHealthCareText'][locale.languageCode]; + + String get loginRegister => localizedValues['LoginRegister'][locale.languageCode]; + String get orderLog => localizedValues['OrderLog'][locale.languageCode]; // String get infoLab => localizedValues['info-lab'][locale.languageCode]; // String get infoRadiology => String get orderNumber => localizedValues['orderNumber'][locale.languageCode]; + String get orderDate => localizedValues['orderDate'][locale.languageCode]; + String get itemsNo => localizedValues['itemsNo'][locale.languageCode]; + String get noOrder => localizedValues['noOrder'][locale.languageCode]; + String get noResult => localizedValues['noResult'][locale.languageCode]; - String get offersAndPromotions => - localizedValues['offersAndPromotions'][locale.languageCode]; + String get offersAndPromotions => localizedValues['offersAndPromotions'][locale.languageCode]; + + String get offers => localizedValues['offers'][locale.languageCode]; + String get review => localizedValues['review'][locale.languageCode]; - String get deliveredOrder => - localizedValues['deliveredOrder'][locale.languageCode]; - String get pendingOrder => - localizedValues['pendingOrder'][locale.languageCode]; - String get processingOrder => - localizedValues['processingOrder'][locale.languageCode]; - String get cancelledOrder => - localizedValues['cancelledOrder'][locale.languageCode]; + + String get deliveredOrder => localizedValues['deliveredOrder'][locale.languageCode]; + + String get pendingOrder => localizedValues['pendingOrder'][locale.languageCode]; + + String get processingOrder => localizedValues['processingOrder'][locale.languageCode]; + + String get cancelledOrder => localizedValues['cancelledOrder'][locale.languageCode]; + String get compare => localizedValues['compare'][locale.languageCode]; - String get medicationsRefill => - localizedValues['medicationsRefill'][locale.languageCode]; - String get myPrescription => - localizedValues['myPrescription'][locale.languageCode]; + + String get medicationsRefill => localizedValues['medicationsRefill'][locale.languageCode]; + + String get myPrescription => localizedValues['myPrescription'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; - String get conditionsHMG => - localizedValues['conditionsHMG'][locale.languageCode]; + + String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode]; + String get conditions => localizedValues['conditions'][locale.languageCode]; // pharmacy module - String get searchAndScanMedication => - localizedValues['searchAndScanMedication'][locale.languageCode]; - String get shopByBrands => - localizedValues['shopByBrands'][locale.languageCode]; - String get recentlyViewed => - localizedValues['recentlyViewed'][locale.languageCode]; + String get searchAndScanMedication => localizedValues['searchAndScanMedication'][locale.languageCode]; + + String get shopByBrands => localizedValues['shopByBrands'][locale.languageCode]; + + String get recentlyViewed => localizedValues['recentlyViewed'][locale.languageCode]; + String get bestSellers => localizedValues['bestSellers'][locale.languageCode]; + String get recommended => localizedValues['recommended'][locale.languageCode]; - String get deleteAllItems => - localizedValues['deleteAllItems'][locale.languageCode]; - String get selectAddress => - localizedValues['selectAddress'][locale.languageCode]; - String get shippingAddress => - localizedValues['shippingAddress'][locale.languageCode]; - String get changeAddress => - localizedValues['changeAddress'][locale.languageCode]; - String get selectPaymentOption => - localizedValues['selectPaymentOption'][locale.languageCode]; - String get changeMethod => - localizedValues['changeMethod'][locale.languageCode]; + + String get deleteAllItems => localizedValues['deleteAllItems'][locale.languageCode]; + + String get selectAddress => localizedValues['selectAddress'][locale.languageCode]; + + String get shippingAddress => localizedValues['shippingAddress'][locale.languageCode]; + + String get changeAddress => localizedValues['changeAddress'][locale.languageCode]; + + String get selectPaymentOption => localizedValues['selectPaymentOption'][locale.languageCode]; + + String get changeMethod => localizedValues['changeMethod'][locale.languageCode]; + String get reviewOrder => localizedValues['reviewOrder'][locale.languageCode]; - String get orderSummary => - localizedValues['orderSummary'][locale.languageCode]; + + String get orderSummary => localizedValues['orderSummary'][locale.languageCode]; + String get active => localizedValues['active'][locale.languageCode]; + String get inactive => localizedValues['inactive'][locale.languageCode]; + String get balance => localizedValues['balance'][locale.languageCode]; + String get gained => localizedValues['gained'][locale.languageCode]; + String get consumed => localizedValues['consumed'][locale.languageCode]; + String get transferred => localizedValues['transferred'][locale.languageCode]; - String get checkBeneficiary => - localizedValues['checkBeneficiary'][locale.languageCode]; - String get beneficiaryName => - localizedValues['beneficiaryName'][locale.languageCode]; - String get accountActivation => - localizedValues['accountActivation'][locale.languageCode]; - String get nonRecommended => - localizedValues['nonRecommended'][locale.languageCode]; - - String get lakumTransfer => - localizedValues['lakumTransfer'][locale.languageCode]; + + String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode]; + + String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode]; + + String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; + + String get nonRecommended => localizedValues['nonRecommended'][locale.languageCode]; + + String get lakumTransfer => localizedValues['lakumTransfer'][locale.languageCode]; + String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode]; - String get termsService => - localizedValues['TermsService'][locale.languageCode]; + String get termsService => localizedValues['TermsService'][locale.languageCode]; + String get beforeUsing => localizedValues['Beforeusing'][locale.languageCode]; + String get accept => localizedValues['accept'][locale.languageCode]; - String get dataSafeInfo => - localizedValues['data-safe-info'][locale.languageCode]; + + String get dataSafeInfo => localizedValues['data-safe-info'][locale.languageCode]; + String get dataSafe => localizedValues['data-safe'][locale.languageCode]; - String get informational => - localizedValues['informational'][locale.languageCode]; - String get checkDiagnosis => - localizedValues['check-diagnosis'][locale.languageCode]; + + String get informational => localizedValues['informational'][locale.languageCode]; + + String get checkDiagnosis => localizedValues['check-diagnosis'][locale.languageCode]; + String get remeberthat => localizedValues['remeberthat'][locale.languageCode]; - String get notUseInEmbergency => - localizedValues['not-use-in-emerbency'][locale.languageCode]; - String get notUseInEmbergencyDetails => - localizedValues['not-use-in-emerbency-details'][locale.languageCode]; - String get notUseInEmbergencyCall => - localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; - String get selectGender => - localizedValues['select-gender'][locale.languageCode]; + + String get notUseInEmbergency => localizedValues['not-use-in-emerbency'][locale.languageCode]; + + String get notUseInEmbergencyDetails => localizedValues['not-use-in-emerbency-details'][locale.languageCode]; + + String get notUseInEmbergencyCall => localizedValues['not-use-in-emerbency-details-call'][locale.languageCode]; + + String get selectGender => localizedValues['select-gender'][locale.languageCode]; + String get iAma => localizedValues['i-am-a'][locale.languageCode]; + String get selectAge => localizedValues['select-age'][locale.languageCode]; + String get iAm => localizedValues['i-am'][locale.languageCode]; + String get yearOld => localizedValues['years-old'][locale.languageCode]; + String get categorise => localizedValues['categorise'][locale.languageCode]; + String get refine => localizedValues['refine'][locale.languageCode]; + + String get max => localizedValues['max'][locale.languageCode]; + + String get min => localizedValues['min'][locale.languageCode]; + + String get compeleteOrderMsg => localizedValues['compeleteOrderMsg'][locale.languageCode]; + + String get addToCompareMsg => localizedValues['addToCompareMsg'][locale.languageCode]; + + String get itInListMsg => localizedValues['itInListMsg'][locale.languageCode]; + + String get compareListFull => localizedValues['compareListFull'][locale.languageCode]; + + String get addQuantity => localizedValues['addQuantity'][locale.languageCode]; + + String get addToCartMsg => localizedValues['addToCartMsg'][locale.languageCode]; + + String get addToWishlistMsg => localizedValues['addToWishlistMsg'][locale.languageCode]; + + String get notifyMeMsg => localizedValues['notifyMeMsg'][locale.languageCode]; + + String get removeFromWishlistMsg => localizedValues['removeFromWishlistMsg'][locale.languageCode]; + String get apply => localizedValues['apply'][locale.languageCode]; + String get reset => localizedValues['reset'][locale.languageCode]; - String get viewCategorise => - localizedValues['viewCategorise'][locale.languageCode]; + + String get viewCategorise => localizedValues['viewCategorise'][locale.languageCode]; + String get cart => localizedValues['cart'][locale.languageCode]; + String get wishList => localizedValues['wishList'][locale.languageCode]; + String get Alhabibapp => localizedValues['Alhabibapp'][locale.languageCode]; - String get searchProductHere => - localizedValues['searchProductHere'][locale.languageCode]; + + String get searchProductHere => localizedValues['searchProductHere'][locale.languageCode]; + String get email => localizedValues['email'][locale.languageCode]; + String get book => localizedValues['Book'][locale.languageCode]; - String get appointmentLabel => - localizedValues['AppointmentLabel'][locale.languageCode]; + + String get appointmentLabel => localizedValues['AppointmentLabel'][locale.languageCode]; + String get bloodType => localizedValues['BloodType'][locale.languageCode]; - String get loginToUseService => - localizedValues['loginToUseService'][locale.languageCode]; - String get maritalStatus => - localizedValues['marital-status'][locale.languageCode]; + String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; + + String get maritalStatus => localizedValues['marital-status'][locale.languageCode]; + String get general => localizedValues['general'][locale.languageCode]; + String get profile => localizedValues['profile'][locale.languageCode]; - String get notifications => - localizedValues['notifications'][locale.languageCode]; - String get notificationDetails => - localizedValues['notificationDetails'][locale.languageCode]; - List get infoMyDoctorPoints => - localizedValues['info-my-doctor-points'][locale.languageCode]; - String get infoMyDoctor => - localizedValues['info-my-doctor'][locale.languageCode]; - String get infoPrescriptions => - localizedValues['info-prescriptions'][locale.languageCode]; - List get infoPrescriptionsPoints => - localizedValues['info-my-prescription-points'][locale.languageCode]; - - String get infoInsuranceCards => - localizedValues['info-insurance-cards'][locale.languageCode]; - List get infoInsuranceCardsPoints => - localizedValues['info-insurance-cards-points'][locale.languageCode]; - - String get infoAllergies => - localizedValues['info-allergies'][locale.languageCode]; + + String get notifications => localizedValues['notifications'][locale.languageCode]; + + String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; + + List get infoMyDoctorPoints => localizedValues['info-my-doctor-points'][locale.languageCode]; + + String get infoMyDoctor => localizedValues['info-my-doctor'][locale.languageCode]; + + String get infoPrescriptions => localizedValues['info-prescriptions'][locale.languageCode]; + + List get infoPrescriptionsPoints => localizedValues['info-my-prescription-points'][locale.languageCode]; + + String get infoInsuranceCards => localizedValues['info-insurance-cards'][locale.languageCode]; + + List get infoInsuranceCardsPoints => localizedValues['info-insurance-cards-points'][locale.languageCode]; + + String get infoAllergies => localizedValues['info-allergies'][locale.languageCode]; String get sickLeaves => localizedValues['sick-leaves'][locale.languageCode]; - String get infoSickLeaves => - localizedValues['info-sick-leaves'][locale.languageCode]; - List get infoSickLeavePoints => - localizedValues['info-sick-leave-points'][locale.languageCode]; - - String get infoApprovals => - localizedValues['info-approvals'][locale.languageCode]; - List get infoApprovalPoints => - localizedValues['info-approval-points'][locale.languageCode]; - - String get monthReport => - localizedValues['month-report'][locale.languageCode]; - String get infoMonthReport => - localizedValues['info-month-report'][locale.languageCode]; - String get languageSetting => - localizedValues['language-setting'][locale.languageCode]; + + String get infoSickLeaves => localizedValues['info-sick-leaves'][locale.languageCode]; + + List get infoSickLeavePoints => localizedValues['info-sick-leave-points'][locale.languageCode]; + + String get infoApprovals => localizedValues['info-approvals'][locale.languageCode]; + + List get infoApprovalPoints => localizedValues['info-approval-points'][locale.languageCode]; + + String get monthReport => localizedValues['month-report'][locale.languageCode]; + + String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + + String get languageSetting => localizedValues['language-setting'][locale.languageCode]; + String get alert => localizedValues['alert'][locale.languageCode]; + String get emailAlert => localizedValues['email-alert'][locale.languageCode]; + String get smsAlert => localizedValues['sms-alert'][locale.languageCode]; - String get contactInfo => - localizedValues['contact-info'][locale.languageCode]; + + String get contactInfo => localizedValues['contact-info'][locale.languageCode]; + String get emergencyName => localizedValues['emrg-name'][locale.languageCode]; - String get emergencyContact => - localizedValues['emrg-no'][locale.languageCode]; + + String get emergencyContact => localizedValues['emrg-no'][locale.languageCode]; + String get modes => localizedValues['modes'][locale.languageCode]; + String get vibration => localizedValues['vibration'][locale.languageCode]; + String get blindMode => localizedValues['blind-modes'][locale.languageCode]; - String get invertTheme => - localizedValues['invert-theme'][locale.languageCode]; + + String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; + String get offTheme => localizedValues['off-theme'][locale.languageCode]; + String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; + String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; String get permissions => localizedValues['permissions'][locale.languageCode]; - String get cameraPermission => - localizedValues['camera-permission'][locale.languageCode]; - String get locationPermission => - localizedValues['location-permission'][locale.languageCode]; - String get accessibility => - localizedValues['accessibility'][locale.languageCode]; - String get selectClinic => - localizedValues['selectClinic'][locale.languageCode]; + + String get cameraPermission => localizedValues['camera-permission'][locale.languageCode]; + + String get locationPermission => localizedValues['location-permission'][locale.languageCode]; + + String get accessibility => localizedValues['accessibility'][locale.languageCode]; + + String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; + String get findUs => localizedValues['FindUs'][locale.languageCode]; + String get feedback => localizedValues['Feedback'][locale.languageCode]; + String get liveChat => localizedValues['LiveChat'][locale.languageCode]; + String get service => localizedValues['Service'][locale.languageCode]; - String get hMGServiceLabel => - localizedValues['HMGServiceLabel'][locale.languageCode]; - String get healthWeatherIndicators => - localizedValues['HealthWeatherIndicators'][locale.languageCode]; - String get healthTipsBasedOnCurrentWeather => - localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; + + String get hMGServiceLabel => localizedValues['HMGServiceLabel'][locale.languageCode]; + + String get healthWeatherIndicators => localizedValues['HealthWeatherIndicators'][locale.languageCode]; + + String get healthTipsBasedOnCurrentWeather => localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; + String get moreDetails => localizedValues['MoreDetails'][locale.languageCode]; + String get sendCopy => localizedValues['SendCopy'][locale.languageCode]; + String get resendOrder => localizedValues['ResendOrder'][locale.languageCode]; + String get ports => localizedValues['Ports'][locale.languageCode]; + String get way => localizedValues['Way'][locale.languageCode]; + String get average => localizedValues['Average'][locale.languageCode]; + String get dailyDoses => localizedValues['DailyDoses'][locale.languageCode]; + String get period => localizedValues['Period'][locale.languageCode]; + String get duration => localizedValues['duration'][locale.languageCode]; + String get cm => localizedValues['cm'][locale.languageCode]; + String get kg => localizedValues['kg'][locale.languageCode]; + String get lb => localizedValues['lb'][locale.languageCode]; + String get birth_date => localizedValues['birth_date'][locale.languageCode]; + + String get dateOfBirth => localizedValues['date_of_birth'][locale.languageCode]; + String get mass => localizedValues['mass'][locale.languageCode]; + String get tempC => localizedValues['temp-c'][locale.languageCode]; + String get bpm => localizedValues['bpm'][locale.languageCode]; - String get respirationSigns => - localizedValues['respiration-signs'][locale.languageCode]; + + String get respirationSigns => localizedValues['respiration-signs'][locale.languageCode]; + String get sysDias => localizedValues['sys-dias'][locale.languageCode]; + String get body => localizedValues['body'][locale.languageCode]; + + String get bodyString => localizedValues['body_string'][locale.languageCode]; + + String get bikini => localizedValues['bikini'][locale.languageCode]; + + String get totalMinutes => localizedValues['totalMinutes'][locale.languageCode]; + + String get face => localizedValues['face'][locale.languageCode]; + + String get retouch => localizedValues['retouch'][locale.languageCode]; + String get feedbackTitle => localizedValues['feedback'][locale.languageCode]; + String get send => localizedValues['send'][locale.languageCode]; + String get status => localizedValues['status'][locale.languageCode]; + String get likeToHear => localizedValues['like-to-hear'][locale.languageCode]; + String get subject => localizedValues['subject'][locale.languageCode]; + String get message => localizedValues['message'][locale.languageCode]; - String get emptySubject => - localizedValues['empty-subject'][locale.languageCode]; - String get emptyMessage => - localizedValues['empty-message'][locale.languageCode]; - String get selectAttachment => - localizedValues['select-attachment'][locale.languageCode]; - String get complainAppo => - localizedValues['complain-appo'][locale.languageCode]; - String get complainWithoutAppo => - localizedValues['complain-without-appo'][locale.languageCode]; + + String get emptySubject => localizedValues['empty-subject'][locale.languageCode]; + + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + + String get selectAttachment => localizedValues['select-attachment'][locale.languageCode]; + + String get complainAppo => localizedValues['complain-appo'][locale.languageCode]; + + String get complainWithoutAppo => localizedValues['complain-without-appo'][locale.languageCode]; + String get question => localizedValues['question'][locale.languageCode]; - String get messageType => - localizedValues['message-type'][locale.languageCode]; + + String get messageType => localizedValues['message-type'][locale.languageCode]; + String get compliment => localizedValues['compliment'][locale.languageCode]; + String get suggestion => localizedValues['suggestion'][locale.languageCode]; - String get yourFeedback => - localizedValues['your-feedback'][locale.languageCode]; + + String get yourFeedback => localizedValues['your-feedback'][locale.languageCode]; + String get selectPart => localizedValues['select-part'][locale.languageCode]; + String get number => localizedValues['number'][locale.languageCode]; - String get notClassified => - localizedValues['not-classified'][locale.languageCode]; - String get searchItemError => - localizedValues['searchItemError'][locale.languageCode]; + + String get notClassified => localizedValues['not-classified'][locale.languageCode]; + + String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; + String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; - String get itemInSearch => - localizedValues['ItemInSearch'][locale.languageCode]; - String get bloodDonation => - localizedValues['blood-donation'][locale.languageCode]; - String get bloodDonationInfo => - localizedValues['blood-donation-info'][locale.languageCode]; - - String get bloodInstruction => - localizedValues['blood-instruction'][locale.languageCode]; - String get bloodTermsNcondition => - localizedValues['view-terms'][locale.languageCode]; - String get wantToConnectWithHmgNetwork => - localizedValues['wantConnectHmgNetwork'][locale.languageCode]; - String get failedToAccessHmgServices => - localizedValues['failedToAccessHmgServices'][locale.languageCode]; - String get enablingWifi => - localizedValues['enablingWifi'][locale.languageCode]; - String get offerAndPackages => - localizedValues['offerAndPackages'][locale.languageCode]; + + String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; + + String get bloodDonation => localizedValues['blood-donation'][locale.languageCode]; + + String get bloodDonationInfo => localizedValues['blood-donation-info'][locale.languageCode]; + + String get bloodInstruction => localizedValues['blood-instruction'][locale.languageCode]; + + String get bloodTermsNcondition => localizedValues['view-terms'][locale.languageCode]; + + String get wantToConnectWithHmgNetwork => localizedValues['wantConnectHmgNetwork'][locale.languageCode]; + + String get failedToAccessHmgServices => localizedValues['failedToAccessHmgServices'][locale.languageCode]; + + String get enablingWifi => localizedValues['enablingWifi'][locale.languageCode]; + + String get offerAndPackages => localizedValues['offerAndPackages'][locale.languageCode]; + + String get offerAndPackagesDetails => localizedValues['offerAndPackagesDetails'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; - String get invoiceDate => localizedValues['InvoiceNo'][locale.languageCode]; - String get specialResult => - localizedValues['SpecialResult'][locale.languageCode]; - String get generalResult => - localizedValues['GeneralResult'][locale.languageCode]; - String get showMoreBtn => - localizedValues['show-more-btn'][locale.languageCode]; + + String get invoiceDate => localizedValues['InvoiceDate'][locale.languageCode]; + + String get specialResult => localizedValues['SpecialResult'][locale.languageCode]; + + String get generalResult => localizedValues['GeneralResult'][locale.languageCode]; + + String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; + + String get viewFlowChart => localizedValues['view_flow_chart'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode]; + String get range => localizedValues['range'][locale.languageCode]; + String get outpatient => localizedValues['out-patient'][locale.languageCode]; + String get inPatient => localizedValues['in-patient'][locale.languageCode]; + String get liveCare => localizedValues['liveCare'][locale.languageCode]; + String get report => localizedValues['report'][locale.languageCode]; + String get openRad => localizedValues['open-rad'][locale.languageCode]; + String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; + String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode]; + String get vaccination => localizedValues['vaccination'][locale.languageCode]; - String get welcomeBackV => - localizedValues['welcomeBack'][locale.languageCode]; - String get instructions => - localizedValues['instructions'][locale.languageCode]; - String get updateEmail => - localizedValues['update-email'][locale.languageCode]; - String get updatedEmail => - localizedValues['updated-email'][locale.languageCode]; - String get viewListChildren => - localizedValues['view-list-children'][locale.languageCode]; + + String get welcomeBackV => localizedValues['welcomeBack'][locale.languageCode]; + + String get instructions => localizedValues['instructions'][locale.languageCode]; + + String get updateEmail => localizedValues['update-email'][locale.languageCode]; + + String get updatedEmail => localizedValues['updated-email'][locale.languageCode]; + + String get viewListChildren => localizedValues['view-list-children'][locale.languageCode]; + String get addChild => localizedValues['add-child'][locale.languageCode]; + String get childName => localizedValues['child-name'][locale.languageCode]; + String get childDob => localizedValues['childDob'][locale.languageCode]; - String get deletedChildMes => - localizedValues['deleted-child-mes'][locale.languageCode]; + + String get deletedChildMes => localizedValues['deleted-child-mes'][locale.languageCode]; + String get visit => localizedValues['visit'][locale.languageCode]; - String get descriptionVaccination => - localizedValues['description-vaccination'][locale.languageCode]; + + String get descriptionVaccination => localizedValues['description-vaccination'][locale.languageCode]; + String get dueDate => localizedValues['due-date'][locale.languageCode]; + String get validEmail => localizedValues['valid-email'][locale.languageCode]; - String get confirmSend => - localizedValues['confirm-send'][locale.languageCode]; - String get emailSuccess => - localizedValues['email-success'][locale.languageCode]; - String get deletedChild => - localizedValues['deleted-child'][locale.languageCode]; - String get addInstructions => - localizedValues['add-instructions'][locale.languageCode]; + + String get confirmSend => localizedValues['confirm-send'][locale.languageCode]; + + String get emailSuccess => localizedValues['email-success'][locale.languageCode]; + + String get deletedChild => localizedValues['deleted-child'][locale.languageCode]; + + String get addInstructions => localizedValues['add-instructions'][locale.languageCode]; + String get addedChild => localizedValues['added-child'][locale.languageCode]; + String get appUpdate => localizedValues['appUpdate'][locale.languageCode]; - String get ereferralSaveSuccess => - localizedValues['ereferralSaveSuccess'][locale.languageCode]; + + String get ereferralSaveSuccess => localizedValues['ereferralSaveSuccess'][locale.languageCode]; + String get labResults => localizedValues['labResults'][locale.languageCode]; - String get doctorRating => - localizedValues['doctorRating'][locale.languageCode]; + + String get doctorRating => localizedValues['doctorRating'][locale.languageCode]; + String get good => localizedValues['good'][locale.languageCode]; + String get v_good => localizedValues['v-good'][locale.languageCode]; + String get excellent => localizedValues['excellent'][locale.languageCode]; - String get below_average => - localizedValues['below-average'][locale.languageCode]; + + String get below_average => localizedValues['below-average'][locale.languageCode]; + String get infoSigns => localizedValues['info-signs'][locale.languageCode]; - String get infoAdvancePayment => - localizedValues['info-advance-payment'][locale.languageCode]; - String get infoMyBalance => - localizedValues['info-my-balance'][locale.languageCode]; + + String get infoAdvancePayment => localizedValues['info-advance-payment'][locale.languageCode]; + + String get infoMyBalance => localizedValues['info-my-balance'][locale.languageCode]; + String get erContant => localizedValues['er-contant'][locale.languageCode]; + String get er => localizedValues['er'][locale.languageCode]; - String get transportationService => - localizedValues['transportation-Service'][locale.languageCode]; - String get infoAmbulance => - localizedValues['info-ambulance'][locale.languageCode]; - String get transportHeading => - localizedValues['RRT-transport-heading'][locale.languageCode]; - String get directionHeading => - localizedValues['RRT-direction-heading'][locale.languageCode]; - String get wayHeading => - localizedValues['RRT-way-heading'][locale.languageCode]; + + String get transportationService => localizedValues['transportation-Service'][locale.languageCode]; + + String get infoAmbulance => localizedValues['info-ambulance'][locale.languageCode]; + + String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; + + String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; + String get toHospital => localizedValues['to-hospital'][locale.languageCode]; - String get fromHospital => - localizedValues['from-hospital'][locale.languageCode]; + + String get fromHospital => localizedValues['from-hospital'][locale.languageCode]; + String get oneDirec => localizedValues['one-direc'][locale.languageCode]; + String get twoDirec => localizedValues['two-direc'][locale.languageCode]; - String get pickupLocation => - localizedValues['pickup-location'][locale.languageCode]; + + String get pickupLocation => localizedValues['pickup-location'][locale.languageCode]; + String get pickupSpot => localizedValues['pickup-spot'][locale.languageCode]; + String get insideHome => localizedValues['inside-home'][locale.languageCode]; + String get haveAppo => localizedValues['have-appo'][locale.languageCode]; - String get dropoffLocation => - localizedValues['dropoff-location'][locale.languageCode]; + + String get dropoffLocation => localizedValues['dropoff-location'][locale.languageCode]; + String get selectAll => localizedValues['select-all'][locale.languageCode]; + + String get select => localizedValues['select'][locale.languageCode]; + String get selectMap => localizedValues['select-map'][locale.languageCode]; - String get noAppointment => - localizedValues['no-appointment'][locale.languageCode]; - String get patientShareB => - localizedValues['patient-share'][locale.languageCode]; - String get patientShareTax => - localizedValues['patient-share-tax'][locale.languageCode]; - String get patientShareTotal => - localizedValues['patient-share-total'][locale.languageCode]; - String get selectAmbulate => - localizedValues['select-ambulate'][locale.languageCode]; + + String get noAppointment => localizedValues['no-appointment'][locale.languageCode]; + + String get patientShareB => localizedValues['patient-share'][locale.languageCode]; + + String get patientShareTax => localizedValues['patient-share-tax'][locale.languageCode]; + + String get patientShareTotal => localizedValues['patient-share-total'][locale.languageCode]; + + String get selectAmbulate => localizedValues['select-ambulate'][locale.languageCode]; + String get wheelchair => localizedValues['wheelchair'][locale.languageCode]; + String get walker => localizedValues['walker'][locale.languageCode]; + String get stretcher => localizedValues['stretcher'][locale.languageCode]; + String get none => localizedValues['none'][locale.languageCode]; - String get rrtSummary => localizedValues['RRT-Summary'][locale.languageCode]; - String get rapidResponseTeam => - localizedValues['Rapid-Response-Team'][locale.languageCode]; + + String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; + + String get rapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode]; + String get rrtDDetails => localizedValues['RRTDDetails'][locale.languageCode]; - String get approximateServiceFee => - localizedValues['ApproximateServiceFee'][locale.languageCode]; - String get amountBeforeTax => - localizedValues['AmountBeforeTax'][locale.languageCode]; + + String get approximateServiceFee => localizedValues['ApproximateServiceFee'][locale.languageCode]; + + String get amountBeforeTax => localizedValues['AmountBeforeTax'][locale.languageCode]; + String get taxAmount => localizedValues['TaxAmount'][locale.languageCode]; - String get totalAmountPayable => - localizedValues['TotalAmountPayable'][locale.languageCode]; - String get iAcceptTermsConditions => - localizedValues['iAcceptTermsConditions'][locale.languageCode]; - String get somethingWentWrongTryLater => - localizedValues['somethingWentWrongTryLater'][locale.languageCode]; - String get youCanPayByTheFollowingOptions => - localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode]; - String get rrtService => localizedValues['rrtService'][locale.languageCode]; - String get rrtUserAgreementTitle => - localizedValues['rrtUserAgreementTitle'][locale.languageCode]; - String get rrtUserAgreementP1 => - localizedValues['rrtUserAgreementP1'][locale.languageCode]; - String get rrtUserAgreementP2 => - localizedValues['rrtUserAgreementP2'][locale.languageCode]; - String get rrtUserAgreementP3 => - localizedValues['rrtUserAgreementP3'][locale.languageCode]; - String get rrtOrderSuccessMessage => - localizedValues['rrtOrderSuccessMessage'][locale.languageCode]; + + String get totalAmountPayable => localizedValues['TotalAmountPayable'][locale.languageCode]; + + String get somethingWentWrongTryLater => localizedValues['somethingWentWrongTryLater'][locale.languageCode]; + + String get youCanPayByTheFollowingOptions => localizedValues['YouCanPayByTheFollowingOptions'][locale.languageCode]; + + String get rrtUserAgreementTitle => localizedValues['rrtUserAgreementTitle'][locale.languageCode]; + + String get rrtUserAgreementP1 => localizedValues['rrtUserAgreementP1'][locale.languageCode]; + + String get rrtUserAgreementP2 => localizedValues['rrtUserAgreementP2'][locale.languageCode]; + + String get rrtUserAgreementP3 => localizedValues['rrtUserAgreementP3'][locale.languageCode]; + + String get rrtOrderSuccessMessage => localizedValues['rrtOrderSuccessMessage'][locale.languageCode]; + String get billAmount => localizedValues['bill-amount'][locale.languageCode]; - String get transportMethod => - localizedValues['transport-method'][locale.languageCode]; + + String get transportMethod => localizedValues['transport-method'][locale.languageCode]; + String get directions => localizedValues['directions'][locale.languageCode]; - String get infoMyAppointments => - localizedValues['info-my-appointments'][locale.languageCode]; + String get infoMyAppointments => localizedValues['info-my-appointments'][locale.languageCode]; + String get infoTodo => localizedValues['info-todo'][locale.languageCode]; + String get familyInfo => localizedValues['family-info'][locale.languageCode]; - String get profileUpdate => - localizedValues['update-succ'][locale.languageCode]; - String get dentalComplaints => - localizedValues['dental-complains'][locale.languageCode]; - String get emptyResult => - localizedValues['empty-result'][locale.languageCode]; - - String get noBookedAppo => - localizedValues['no-booked-appointment'][locale.languageCode]; - String get noConfirmedAppo => - localizedValues['no-confirmed-appointment'][locale.languageCode]; - String get noArrivedAppo => - localizedValues['no-arrived-appointment'][locale.languageCode]; - String get upcomingEmpty => - localizedValues['upcoming-empty'][locale.languageCode]; - String get upcomingTimeLeft => - localizedValues['upcoming-timeLeft'][locale.languageCode]; - - String get covidTestAllServices => - localizedValues['covid-test-all-services'][locale.languageCode]; + + String get profileUpdate => localizedValues['update-succ'][locale.languageCode]; + + String get dentalComplaints => localizedValues['dental-complains'][locale.languageCode]; + + String get emptyResult => localizedValues['empty-result'][locale.languageCode]; + + String get noBookedAppo => localizedValues['no-booked-appointment'][locale.languageCode]; + + String get noConfirmedAppo => localizedValues['no-confirmed-appointment'][locale.languageCode]; + + String get noArrivedAppo => localizedValues['no-arrived-appointment'][locale.languageCode]; + + String get upcomingEmpty => localizedValues['upcoming-empty'][locale.languageCode]; + + String get upcomingTimeLeft => localizedValues['upcoming-timeLeft'][locale.languageCode]; + + String get covidTestAllServices => localizedValues['covid-test-all-services'][locale.languageCode]; + String get pharmacy => localizedValues['pharmacy'][locale.languageCode]; + String get ereferral => localizedValues['ereferral'][locale.languageCode]; - String get childVaccine => - localizedValues['child-vaccine'][locale.languageCode]; + + String get childVaccine => localizedValues['child-vaccine'][locale.languageCode]; + String get calculators => localizedValues['calculators'][locale.languageCode]; + String get converters => localizedValues['converters'][locale.languageCode]; + String get h2o => localizedValues['h2o'][locale.languageCode]; - String get waterTracker => - localizedValues['waterTracker'][locale.languageCode]; + + String get waterTracker => localizedValues['waterTracker'][locale.languageCode]; + String get ft => localizedValues['ft'][locale.languageCode]; + String get vTour => localizedValues['v-tour'][locale.languageCode]; + String get hmgNews => localizedValues['hmg-news'][locale.languageCode]; + String get bloodD => localizedValues['blood-d'][locale.languageCode]; - String get symptomCheckerTitle => - localizedValues['symptomCheckerTitle'][locale.languageCode]; + + String get symptomCheckerTitle => localizedValues['symptomCheckerTitle'][locale.languageCode]; + String get latestNews => localizedValues['latest-news'][locale.languageCode]; - String get ourLocation => - localizedValues['our-location'][locale.languageCode]; + + String get ourLocation => localizedValues['our-location'][locale.languageCode]; + String get pharmacies => localizedValues['pharmacies'][locale.languageCode]; + String get hospitals => localizedValues['hospitals'][locale.languageCode]; + String get wallet => localizedValues['wallet'][locale.languageCode]; + String get hmg => localizedValues['hmg'][locale.languageCode]; + String get requested => localizedValues['requested'][locale.languageCode]; + String get ready => localizedValues['ready'][locale.languageCode]; + String get completed => localizedValues['completed'][locale.languageCode]; - String get requestMedicalReport => - localizedValues['request-medical-report'][locale.languageCode]; + + String get requestMedicalReport => localizedValues['request-medical-report'][locale.languageCode]; + String get insurCards => localizedValues['insur-cards'][locale.languageCode]; + String get labResult => localizedValues['labResult'][locale.languageCode]; + String get details => localizedValues['details'][locale.languageCode]; + + String get graphDetails => localizedValues['graph-details'][locale.languageCode]; + String get age => localizedValues['age'][locale.languageCode]; - String get activeInsurence => - localizedValues['active-insurence'][locale.languageCode]; + + String get activeInsurence => localizedValues['active-insurence'][locale.languageCode]; + String get notActive => localizedValues['not-active'][locale.languageCode]; + String get cardDetail => localizedValues['card-detail'][locale.languageCode]; + String get dr => localizedValues['Dr'][locale.languageCode]; + String get sendSuc => localizedValues['sendSuc'][locale.languageCode]; - String get instructionsPharmacies => - localizedValues['instructions-pharmacies'][locale.languageCode]; - String get selectHospitalDec => - localizedValues['select-hospital'][locale.languageCode]; + + String get instructionsPharmacies => localizedValues['instructions-pharmacies'][locale.languageCode]; + + String get selectHospitalDec => localizedValues['select-hospital'][locale.languageCode]; String get start => localizedValues['start'][locale.languageCode]; + String get infoChat => localizedValues['info-chat'][locale.languageCode]; String get noRecords => localizedValues['empty'][locale.languageCode]; + String get lastVisit => localizedValues['last-visit'][locale.languageCode]; + String get tapTitle => localizedValues['tap-title'][locale.languageCode]; + String get later => localizedValues['later'][locale.languageCode]; - String get lastAppointment => - localizedValues['last-appointment'][locale.languageCode]; + String get lastAppointment => localizedValues['last-appointment'][locale.languageCode]; + String get rateClinic => localizedValues['rate-clinic'][locale.languageCode]; + String get fetchData => localizedValues['fetch-data'][locale.languageCode]; - String get sendConfEmail => - localizedValues['send-email'][locale.languageCode]; - String get noDataAvailable => - localizedValues['noDataAvailable'][locale.languageCode]; + String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; + + String get noDataAvailable => localizedValues['noDataAvailable'][locale.languageCode]; + String get theName => localizedValues['thename'][locale.languageCode]; - String get noSearchResult => - localizedValues['noSearchResult'][locale.languageCode]; - String get selectFileSouse => - localizedValues['selectFileSouse'][locale.languageCode]; + + String get noSearchResult => localizedValues['noSearchResult'][locale.languageCode]; + + String get selectFileSouse => localizedValues['selectFileSouse'][locale.languageCode]; + String get rate => localizedValues['rate'][locale.languageCode]; - String get bookedSuccess => - localizedValues['booked-success'][locale.languageCode]; - String get appoReminder30 => - localizedValues['appo-reminder-select-option-30'][locale.languageCode]; - String get appoReminder60 => - localizedValues['appo-reminder-select-option-60'][locale.languageCode]; - String get appoReminder90 => - localizedValues['appo-reminder-select-option-90'][locale.languageCode]; - String get appoReminder120 => - localizedValues['appo-reminder-select-option-120'][locale.languageCode]; + + String get bookedSuccess => localizedValues['booked-success'][locale.languageCode]; + + String get appoReminder30 => localizedValues['appo-reminder-select-option-30'][locale.languageCode]; + + String get appoReminder60 => localizedValues['appo-reminder-select-option-60'][locale.languageCode]; + + String get appoReminder90 => localizedValues['appo-reminder-select-option-90'][locale.languageCode]; + + String get appoReminder120 => localizedValues['appo-reminder-select-option-120'][locale.languageCode]; + String get gallery => localizedValues['gallery'][locale.languageCode]; + String get camera => localizedValues['camera'][locale.languageCode]; + String get medReport => localizedValues['med-report'][locale.languageCode]; - String get newMedReport => - localizedValues['new-med-report'][locale.languageCode]; - String get requestReport => - localizedValues['requestReport'][locale.languageCode]; - String get confirmMsgReport => - localizedValues['confirm-msg-report'][locale.languageCode]; - String get successSendReport => - localizedValues['successSendReport'][locale.languageCode]; + + String get newMedReport => localizedValues['new-med-report'][locale.languageCode]; + + String get requestReport => localizedValues['requestReport'][locale.languageCode]; + + String get confirmMsgReport => localizedValues['confirm-msg-report'][locale.languageCode]; + + String get successSendReport => localizedValues['successSendReport'][locale.languageCode]; + String get pulseTitle => localizedValues['pulseTitle'][locale.languageCode]; - String get systolicLng => - localizedValues['systolic-lng'][locale.languageCode]; - String get diastolicLng => - localizedValues['diastolic-lng'][locale.languageCode]; - String get policyHolder => - localizedValues['policy-holder'][locale.languageCode]; + + String get systolicLng => localizedValues['systolic-lng'][locale.languageCode]; + + String get diastolicLng => localizedValues['diastolic-lng'][locale.languageCode]; + + String get policyHolder => localizedValues['policy-holder'][locale.languageCode]; + String get policyNo => localizedValues['policy-no'][locale.languageCode]; - String get expiryDateTitle => - localizedValues['expiry-date'][locale.languageCode]; + + String get expiryDateTitle => localizedValues['expiry-date'][locale.languageCode]; + String get classTitle => localizedValues['class'][locale.languageCode]; + String get approval => localizedValues['approval'][locale.languageCode]; + String get agree => localizedValues['agree'][locale.languageCode]; + String get disagree => localizedValues['disagree'][locale.languageCode]; - String get requestSent => - localizedValues['request-sent'][locale.languageCode]; - String get attachInsuraceImage => - localizedValues['attach-insurace-image'][locale.languageCode]; - String get infoInsurCards => - localizedValues['info-insur-cards'][locale.languageCode]; + + String get requestSent => localizedValues['request-sent'][locale.languageCode]; + + String get attachInsuraceImage => localizedValues['attach-insurace-image'][locale.languageCode]; + + String get infoInsurCards => localizedValues['info-insur-cards'][locale.languageCode]; + String get scanNow => localizedValues['scan-now'][locale.languageCode]; - String get pharmacyServiceTermsCondition => - localizedValues['pharmacyServiceTermsCondition'][locale.languageCode]; - String get recordDeleted => - localizedValues['recordDeleted'][locale.languageCode]; + String get pharmacyServiceTermsCondition => localizedValues['pharmacyServiceTermsCondition'][locale.languageCode]; + + String get recordDeleted => localizedValues['recordDeleted'][locale.languageCode]; + + String get referralStatus => localizedValues['referralStatus'][locale.languageCode]; + + String get referralDate => localizedValues['referralDate'][locale.languageCode]; - String get referralStatus => - localizedValues['referralStatus'][locale.languageCode]; - String get referralDate => - localizedValues['referralDate'][locale.languageCode]; String get patientName => localizedValues['patientName'][locale.languageCode]; - String get referralNumber => - localizedValues['referralNumber'][locale.languageCode]; + + String get referralNumber => localizedValues['referralNumber'][locale.languageCode]; String get needPrescription => localizedValues['needPrescription'][locale.languageCode]; + String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; + + String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode]; + + String get noOffersAvailable => localizedValues['noOffersAvailable'][locale.languageCode]; + String get requestID => localizedValues['requestID'][locale.languageCode]; + String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode]; + String get pickupDate => localizedValues['pickupDate'][locale.languageCode]; + String get serviceName => localizedValues['serviceName'][locale.languageCode]; - String get orderLocation => - localizedValues['orderLocation'][locale.languageCode]; - String get selectService => - localizedValues['selectService'][locale.languageCode]; - String get coveredService => - localizedValues['coveredService'][locale.languageCode]; - String get selectedService => - localizedValues['selectedService'][locale.languageCode]; - String get cancelOrderMsg => - localizedValues['cancelOrderMsg'][locale.languageCode]; - String get processDoneSuccessfully => - localizedValues['processDoneSuccessfully'][locale.languageCode]; - String get selectHomeHealthCareServices => - localizedValues['selectHomeHealthCareServices'][locale.languageCode]; - String get help => localizedValues['help'][locale.languageCode]; - String get habibRobotText => - localizedValues['habibRobotText'][locale.languageCode]; - String get topBrands => localizedValues['topBrands'][locale.languageCode]; - String get notifyMe => localizedValues['notifyMe'][locale.languageCode]; - String get specification => - localizedValues['specification'][locale.languageCode]; - String get availability => - localizedValues['availability'][locale.languageCode]; - String get quantitySize => - localizedValues['quantitySize'][locale.languageCode]; - String get addToCart => localizedValues['addToCart'][locale.languageCode]; - String get addToWishlist => - localizedValues['addToWishlist'][locale.languageCode]; - String get removeFromWishlist => - localizedValues['removeFromWishlist'][locale.languageCode]; - String get buyNow => localizedValues['buyNow'][locale.languageCode]; - String get quantityShortcut => - localizedValues['quantityShortcut'][locale.languageCode]; - String get noData => localizedValues['noData'][locale.languageCode]; - String get no_data => localizedValues['no_data'][locale.languageCode]; + String get orderLocation => localizedValues['orderLocation'][locale.languageCode]; + + String get selectService => localizedValues['selectService'][locale.languageCode]; + + String get coveredService => localizedValues['coveredService'][locale.languageCode]; + + String get selectedService => localizedValues['selectedService'][locale.languageCode]; + + String get cancelOrderMsg => localizedValues['cancelOrderMsg'][locale.languageCode]; + + String get processDoneSuccessfully => localizedValues['processDoneSuccessfully'][locale.languageCode]; + + String get selectHomeHealthCareServices => localizedValues['selectHomeHealthCareServices'][locale.languageCode]; + + String get help => localizedValues['help'][locale.languageCode]; + + String get habibRobotText => localizedValues['habibRobotText'][locale.languageCode]; + + String get topBrands => localizedValues['topBrands'][locale.languageCode]; + + String get notifyMe => localizedValues['notifyMe'][locale.languageCode]; + + String get specification => localizedValues['specification'][locale.languageCode]; + + String get availability => localizedValues['availability'][locale.languageCode]; + + String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; + + String get addToCart => localizedValues['addToCart'][locale.languageCode]; + + String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode]; + + String get removeFromWishlist => localizedValues['removeFromWishlist'][locale.languageCode]; + + String get buyNow => localizedValues['buyNow'][locale.languageCode]; + + String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode]; + + String get noData => localizedValues['noData'][locale.languageCode]; + + String get no_data => localizedValues['no_data'][locale.languageCode]; + + String get year => localizedValues['Year'][locale.languageCode]; + + String get years => localizedValues['years'][locale.languageCode]; - String get year => localizedValues['Year'][locale.languageCode]; String get month => localizedValues['Month'][locale.languageCode]; + + String get enterDetailBelow => localizedValues['enter_detail_below'][locale.languageCode]; + String get point => localizedValues['point'][locale.languageCode]; + String get riyal => localizedValues['riyal'][locale.languageCode]; - String get termOfService => - localizedValues['termOfService'][locale.languageCode]; - String get shoppingCart => - localizedValues['shoppingCart'][locale.languageCode]; + + String get termOfService => localizedValues['termOfService'][locale.languageCode]; + + String get shoppingCart => localizedValues['shoppingCart'][locale.languageCode]; + String get covidTest => localizedValues['covidTest'][locale.languageCode]; + String get driveThru => localizedValues['driveThru'][locale.languageCode]; - String get NearestErDesc => - localizedValues['NearestErDesc'][locale.languageCode]; + + String get NearestErDesc => localizedValues['NearestErDesc'][locale.languageCode]; + String get NearestEr => localizedValues['NearestEr'][locale.languageCode]; + String get infoCMC => localizedValues['infoCMC'][locale.languageCode]; - String get instructionAgree => - localizedValues['instructionAgree'][locale.languageCode]; + + String get instructionAgree => localizedValues['instructionAgree'][locale.languageCode]; + String get reqId => localizedValues['reqId'][locale.languageCode]; - String get ordersLog => - localizedValues['RRT-orders-log'][locale.languageCode]; + + String get ordersLog => localizedValues['RRT-orders-log'][locale.languageCode]; + String get bloodSugar => localizedValues['blood-sugar'][locale.languageCode]; + String get myTracker => localizedValues['my-tracker'][locale.languageCode]; + String get weekly => localizedValues['weekly'][locale.languageCode]; + String get monthlyT => localizedValues['monthly'][locale.languageCode]; + String get yearly => localizedValues['yearly'][locale.languageCode]; + String get measured => localizedValues['measured'][locale.languageCode]; + String get sugarAdd => localizedValues['sugar-add'][locale.languageCode]; + String get other => localizedValues['other'][locale.languageCode]; - String get measureUnit => - localizedValues['measure-unit'][locale.languageCode]; - String get measureTime => - localizedValues['measure-time'][locale.languageCode]; + + String get measureUnit => localizedValues['measure-unit'][locale.languageCode]; + + String get measureTime => localizedValues['measure-time'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; - String get covid19_driveThrueTest => - localizedValues['covid19_driveThrueTest'][locale.languageCode]; + + String get covid19_driveThrueTest => localizedValues['covid19_driveThrueTest'][locale.languageCode]; + String get eReferral => localizedValues['E-Referral'][locale.languageCode]; - String get msg_email_address_up_to_date => - localizedValues["msg_email_address_up_to_date"][locale.languageCode]; - String get updateEmailMsg => - localizedValues["update-email-msg"][locale.languageCode]; + String get msg_email_address_up_to_date => localizedValues["msg_email_address_up_to_date"][locale.languageCode]; + + String get updateEmailMsg => localizedValues["update-email-msg"][locale.languageCode]; + + String get addNewChild => localizedValues["add-new-child"][locale.languageCode]; + + String get sendChildEmailMsg => localizedValues["send-child-email-msg"][locale.languageCode]; - String get addNewChild => - localizedValues["add-new-child"][locale.languageCode]; - String get sendChildEmailMsg => - localizedValues["send-child-email-msg"][locale.languageCode]; - String get vaccinationAddChildMsg => - localizedValues["vaccination-add-child-msg"][locale.languageCode]; - String get childAddedSuccessfully => - localizedValues["child_added_successfully"][locale.languageCode]; + String get vaccinationAddChildMsg => localizedValues["vaccination-add-child-msg"][locale.languageCode]; + + String get childAddedSuccessfully => localizedValues["child_added_successfully"][locale.languageCode]; String get sugar => localizedValues["sugar"][locale.languageCode]; - String get bloodCholesterol => - localizedValues["bloodCholesterol"][locale.languageCode]; + + String get bloodCholesterol => localizedValues["bloodCholesterol"][locale.languageCode]; + String get cholesterol => localizedValues["cholesterol"][locale.languageCode]; - String get triglycerides => - localizedValues["triglycerides"][locale.languageCode]; + + String get triglycerides => localizedValues["triglycerides"][locale.languageCode]; + String get fatInBlood => localizedValues["fatInBlood"][locale.languageCode]; + String get calculate => localizedValues["calculate"][locale.languageCode]; - String get enterReadingValue => - localizedValues["enterReadingValue"][locale.languageCode]; - String get convertBloodSugarStatement => - localizedValues["convertBloodSugarStatement"][locale.languageCode]; + + String get enterReadingValue => localizedValues["enterReadingValue"][locale.languageCode]; + + String get convertBloodSugarStatement => localizedValues["convertBloodSugarStatement"][locale.languageCode]; + String get convertFrom => localizedValues["convertFrom"][locale.languageCode]; + String get result => localizedValues["result"][locale.languageCode]; + String get sort => localizedValues["sort"][locale.languageCode]; - String get bloodSugarConversion => - localizedValues["bloodSugarConversion"][locale.languageCode]; - String get convertCholesterolStatement => - localizedValues["convertCholesterolStatement"][locale.languageCode]; - String get triglyceridesConvertStatement => - localizedValues["triglyceridesConvertStatement"][locale.languageCode]; - String get bloodDEnterDesc => - localizedValues["bloodD-enter-desc"][locale.languageCode]; - String get viewTermsConditions => - localizedValues["viewTermsConditions"][locale.languageCode]; - String get generalHealth => - localizedValues["generalHealth"][locale.languageCode]; + + String get bloodSugarConversion => localizedValues["bloodSugarConversion"][locale.languageCode]; + + String get convertCholesterolStatement => localizedValues["convertCholesterolStatement"][locale.languageCode]; + + String get triglyceridesConvertStatement => localizedValues["triglyceridesConvertStatement"][locale.languageCode]; + + String get bloodDEnterDesc => localizedValues["bloodD-enter-desc"][locale.languageCode]; + + String get viewTermsConditions => localizedValues["viewTermsConditions"][locale.languageCode]; + + String get generalHealth => localizedValues["generalHealth"][locale.languageCode]; + String get womanHealth => localizedValues["womanHealth"][locale.languageCode]; + String get bmi => localizedValues["bmi"][locale.languageCode]; + String get calcHealth => localizedValues["calc-health"][locale.languageCode]; + String get calories => localizedValues["calories"][locale.languageCode]; + String get bmr => localizedValues["bmr"][locale.languageCode]; + String get idealBody => localizedValues["idealBody"][locale.languageCode]; + String get bodyWord => localizedValues["body_word"][locale.languageCode]; + String get fat => localizedValues["fat"][locale.languageCode]; - String get carbohydrate => - localizedValues["carbohydrate"][locale.languageCode]; + + String get carbohydrate => localizedValues["carbohydrate"][locale.languageCode]; + String get proteinFat => localizedValues["proteinFat"][locale.languageCode]; + String get ovulation => localizedValues["ovulation"][locale.languageCode]; + String get delivery => localizedValues["delivery"][locale.languageCode]; + String get bmiCalcDesc => localizedValues["bmiCalcDesc"][locale.languageCode]; + String get selectUnit => localizedValues["selectUnit"][locale.languageCode]; + String get feet => localizedValues["feet"][locale.languageCode]; + String get pound => localizedValues["pound"][locale.languageCode]; - String get seeListOfDoctor => - localizedValues["seeListOfDoctor"][locale.languageCode]; + + String get seeListOfDoctor => localizedValues["seeListOfDoctor"][locale.languageCode]; + String get obese => localizedValues["obese"][locale.languageCode]; + String get overWeight => localizedValues["overWeight"][locale.languageCode]; + String get healthy => localizedValues["healthy"][locale.languageCode]; + String get underWeight => localizedValues["underWeight"][locale.languageCode]; - String get bmiCalcMsgObese => - localizedValues["bmiCalcMsgObese"][locale.languageCode]; - String get bmiCalcMsgOverweight => - localizedValues["bmiCalcMsgOverweight"][locale.languageCode]; - String get bmiCalcMsgHealthy => - localizedValues["bmiCalcMsgHealthy"][locale.languageCode]; - String get bmiCalcMsgUnderWeight => - localizedValues["bmiCalcMsgUnderWeight"][locale.languageCode]; + + String get bmiCalcMsgObese => localizedValues["bmiCalcMsgObese"][locale.languageCode]; + + String get bmiCalcMsgOverweight => localizedValues["bmiCalcMsgOverweight"][locale.languageCode]; + + String get bmiCalcMsgHealthy => localizedValues["bmiCalcMsgHealthy"][locale.languageCode]; + + String get bmiCalcMsgUnderWeight => localizedValues["bmiCalcMsgUnderWeight"][locale.languageCode]; + String get bariatrics => localizedValues["bariatrics"][locale.languageCode]; - String get bariatricsHeaderMsg => - localizedValues["bariatricsHeaderMsg"][locale.languageCode]; + + String get bariatricsHeaderMsg => localizedValues["bariatricsHeaderMsg"][locale.languageCode]; + String get continues => localizedValues["continue"][locale.languageCode]; + String get skip => localizedValues["skip"][locale.languageCode]; - String get calorieCalcDesc => - localizedValues["calorieCalcDesc"][locale.languageCode]; - String get age11_120Years => - localizedValues["age11_120_years"][locale.languageCode]; + + String get offersdiscount => localizedValues["offersdiscount"][locale.languageCode]; + + String get explore => localizedValues["explore"][locale.languageCode]; + + String get calorieCalcDesc => localizedValues["calorieCalcDesc"][locale.languageCode]; + + String get age11_120Years => localizedValues["age11_120_years"][locale.languageCode]; + String get walkinAppo => localizedValues["WalkinAppo"][locale.languageCode]; + String get videoAppo => localizedValues["videoAppo"][locale.languageCode]; + String get weightAdd => localizedValues["weight-add"][locale.languageCode]; - String get systolicAdd => - localizedValues["systolic-add"][locale.languageCode]; - String get diastolicAdd => - localizedValues["diastolic-add"][locale.languageCode]; + + String get appointments => localizedValues['appointments'][locale.languageCode]; + + String get all2 => localizedValues['all2'][locale.languageCode]; + + String get systolicAdd => localizedValues["systolic-add"][locale.languageCode]; + + String get diastolicAdd => localizedValues["diastolic-add"][locale.languageCode]; + String get cmcHeading => localizedValues["cmc-heading"][locale.languageCode]; - String get selectLocation => - localizedValues["select-location"][locale.languageCode]; - String get resultHeader => - localizedValues["result-header"][locale.languageCode]; + + String get selectLocation => localizedValues["select-location"][locale.languageCode]; + + String get resultHeader => localizedValues["result-header"][locale.languageCode]; + String get covidInfo => localizedValues["covid-info"][locale.languageCode]; + String get selectAppo => localizedValues["select-appo"][locale.languageCode]; - String get covidAlertHeader => - localizedValues["covid-alert-header"][locale.languageCode]; - String get covidAlertInfo => - localizedValues["covid-alert-info"][locale.languageCode]; - String get covidAlertMins => - localizedValues["covid-alert-mins"][locale.languageCode]; + + String get covidAlertHeader => localizedValues["covid-alert-header"][locale.languageCode]; + + String get covidAlertInfo => localizedValues["covid-alert-info"][locale.languageCode]; + + String get covidAlertMins => localizedValues["covid-alert-mins"][locale.languageCode]; + String get back => localizedValues["back"][locale.languageCode]; - String get getDirections => - localizedValues["get-directions"][locale.languageCode]; - String get selectedLocation => - localizedValues["selected-location"][locale.languageCode]; + + String get getDirections => localizedValues["get-directions"][locale.languageCode]; + + String get selectedLocation => localizedValues["selected-location"][locale.languageCode]; + String get testFee => localizedValues["test-fee"][locale.languageCode]; + String get payOptions => localizedValues["pay-options"][locale.languageCode]; - String get livecareService => - localizedValues["livecare-service"][locale.languageCode]; - String get livecareServiceDesc => - localizedValues["livecare-service-desc"][locale.languageCode]; - String get whyLivecare => - localizedValues["why-livecare"][locale.languageCode]; - String get livecarePoint1 => - localizedValues["livecare-point-1"][locale.languageCode]; - String get docVirtualAppoIns4 => - localizedValues["doc-virtual-appo-ins4"][locale.languageCode]; - String get docVirtualAppoIns5 => - localizedValues["doc-virtual-appo-ins5"][locale.languageCode]; - String get livecareSummary => - localizedValues["livecare-summary"][locale.languageCode]; - - String get livecareOption1 => - localizedValues["livecare-option-1"][locale.languageCode]; - String get livecareOption2 => - localizedValues["livecare-option-2"][locale.languageCode]; - String get livecareOption3 => - localizedValues["livecare-option-3"][locale.languageCode]; - String get livecareOption4 => - localizedValues["livecare-option-4"][locale.languageCode]; + + String get livecareService => localizedValues["livecare-service"][locale.languageCode]; + + String get livecareServiceDesc => localizedValues["livecare-service-desc"][locale.languageCode]; + + String get whyLivecare => localizedValues["why-livecare"][locale.languageCode]; + + String get livecarePoint1 => localizedValues["livecare-point-1"][locale.languageCode]; + + String get docVirtualAppoIns4 => localizedValues["doc-virtual-appo-ins4"][locale.languageCode]; + + String get docVirtualAppoIns5 => localizedValues["doc-virtual-appo-ins5"][locale.languageCode]; + + String get livecareSummary => localizedValues["livecare-summary"][locale.languageCode]; + + String get livecareOption1 => localizedValues["livecare-option-1"][locale.languageCode]; + + String get livecareOption2 => localizedValues["livecare-option-2"][locale.languageCode]; + + String get livecareOption3 => localizedValues["livecare-option-3"][locale.languageCode]; + + String get livecareOption4 => localizedValues["livecare-option-4"][locale.languageCode]; + + String get noAppointmentAvailable => localizedValues["noAppointmentAvailable"][locale.languageCode]; String get today => localizedValues["today"][locale.languageCode]; + String get week => localizedValues["week"][locale.languageCode]; - String get h2oAmountOfWater => - localizedValues["h2o-amount-of-water"][locale.languageCode]; + + String get h2oAmountOfWater => localizedValues["h2o-amount-of-water"][locale.languageCode]; + String get updateUser => localizedValues["update-user"][locale.languageCode]; + String get editname => localizedValues["editname"][locale.languageCode]; - String get activityLevel => - localizedValues["activity-level"][locale.languageCode]; + + String get activityLevel => localizedValues["activity-level"][locale.languageCode]; + String get success => localizedValues["success"][locale.languageCode]; - String get enterNameHere => - localizedValues["enterNameHere"][locale.languageCode]; - String get lightActive => - localizedValues["light-active"][locale.languageCode]; + + String get enterNameHere => localizedValues["enterNameHere"][locale.languageCode]; + + String get lightActive => localizedValues["light-active"][locale.languageCode]; + String get modActive => localizedValues["mod-active"][locale.languageCode]; - String get reminderLabel => - localizedValues["reminder-label"][locale.languageCode]; - String get reminderTimesLabel => - localizedValues["reminder-times-label"][locale.languageCode]; + + String get reminderLabel => localizedValues["reminder-label"][locale.languageCode]; + + String get reminderTimesLabel => localizedValues["reminder-times-label"][locale.languageCode]; + String get times => localizedValues["times"][locale.languageCode]; - String get WaterCalculate => - localizedValues["WaterCalculate"][locale.languageCode]; + + String get WaterCalculate => localizedValues["WaterCalculate"][locale.languageCode]; + String get notifTitle => localizedValues["notif-title"][locale.languageCode]; + String get notifText => localizedValues["notif-text"][locale.languageCode]; + String get custom => localizedValues["custom"][locale.languageCode]; + String get undo => localizedValues["undo"][locale.languageCode]; + String get drinking => localizedValues["drinking"][locale.languageCode]; + String get remaining => localizedValues["remaining"][locale.languageCode]; + + String get addCustomAmount => localizedValues["addCustomAmount"][locale.languageCode]; + + String get left => localizedValues["left"][locale.languageCode]; + String get taken => localizedValues["taken"][locale.languageCode]; + String get ml => localizedValues["ml"][locale.languageCode]; + + String get mililitre => localizedValues["mililitre"][locale.languageCode]; + + String get litre => localizedValues["litre"][locale.languageCode]; + String get l => localizedValues["l"][locale.languageCode]; - String get customLabel => - localizedValues["custom-label"][locale.languageCode]; - String get customLabelInLitres => - localizedValues["custom-label-in-litres"][locale.languageCode]; - String get customLabelInMililitres => - localizedValues["custom-label-in-mililitres"][locale.languageCode]; + String get customLabel => localizedValues["custom-label"][locale.languageCode]; + + String get customLabelInLitres => localizedValues["custom-label-in-litres"][locale.languageCode]; + + String get customLabelInMililitres => localizedValues["custom-label-in-mililitres"][locale.languageCode]; + String get amount_ => localizedValues["amount"][locale.languageCode]; - String get targetReach => - localizedValues["target-reach"][locale.languageCode]; + + String get targetReach => localizedValues["target-reach"][locale.languageCode]; + String get weekHeader => localizedValues["week-header"][locale.languageCode]; - String get monthHeader => - localizedValues["month-header"][locale.languageCode]; - String get notifPermissionTitle => - localizedValues["notif-permission-title"][locale.languageCode]; - String get notifPermissionMsg => - localizedValues["notif-permission-msg"][locale.languageCode]; - String get verification_message_code => - localizedValues["verification_message_code"][locale.languageCode]; + + String get monthHeader => localizedValues["month-header"][locale.languageCode]; + + String get notifPermissionTitle => localizedValues["notif-permission-title"][locale.languageCode]; + + String get notifPermissionMsg => localizedValues["notif-permission-msg"][locale.languageCode]; + + String get verification_message_code => localizedValues["verification_message_code"][locale.languageCode]; + String get sms_code => localizedValues["sms_code"][locale.languageCode]; - String get code_failure => - localizedValues["code_failure"][locale.languageCode]; + + String get code_failure => localizedValues["code_failure"][locale.languageCode]; + String get resend => localizedValues["resend"][locale.languageCode]; - String get submitncontinue => - localizedValues["submitncontinue"][locale.languageCode]; + + String get submitncontinue => localizedValues["submitncontinue"][locale.languageCode]; + String get areyousure => localizedValues["areyousure"][locale.languageCode]; // Offer And Packahes String get subT => localizedValues['OffersAndPackages'][locale.languageCode]; - String get totalWithColonRight => - localizedValues['totalWithColonRight'][locale.languageCode]; - String get preferredunit => - localizedValues["preferredunit"][locale.languageCode]; + String get totalWithColonRight => localizedValues['totalWithColonRight'][locale.languageCode]; + + String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; + String get trySaying => localizedValues["try-saying"][locale.languageCode]; - String get somethingWentWrong => - localizedValues["somethingWentWrong"][locale.languageCode]; - - String get enterIdentificationNumber => - localizedValues["enterIdentificationNumber"][locale.languageCode]; - String get accountActivationDesc => - localizedValues["accountActivationDesc"][locale.languageCode]; - String get pointsToTransfer => - localizedValues["pointsToTransfer"][locale.languageCode]; - String get enterBeneficiaryAccountNo => - localizedValues["enterBeneficiaryAccountNo"][locale.languageCode]; - String get confirmPrescription => - localizedValues["confirm-prescription"][locale.languageCode]; - String get youAlreadyHaveOrder => - localizedValues["you-already-have-order"][locale.languageCode]; - String get orderOverview => - localizedValues["order-overview"][locale.languageCode]; - String get shippingAddresss => - localizedValues["shipping-address"][locale.languageCode]; + + String get shippingAddresss => localizedValues["shipping-address"][locale.languageCode]; + String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; - String get pharmacyRelogin => - localizedValues["pharmacy-relogin"][locale.languageCode]; - String get onlineCheckInAgreement => - localizedValues["onlineCheckInAgreement"][locale.languageCode]; - String get chiefComplaints => - localizedValues["chiefComplaints"][locale.languageCode]; - String get errorChiefComplaints => - localizedValues["errorChiefComplaints"][locale.languageCode]; - String get expectedArrivalTime => - localizedValues["expectedArrivalTime"][locale.languageCode]; - String get errorExpectedArrivalTime => - localizedValues["errorExpectedArrivalTimes"][locale.languageCode]; - String get anicllaryOrders => - localizedValues["ancillary-orders"][locale.languageCode]; + + String get pharmacyRelogin => localizedValues["pharmacy-relogin"][locale.languageCode]; + + String get onlineCheckInAgreement => localizedValues["onlineCheckInAgreement"][locale.languageCode]; + + String get chiefComplaints => localizedValues["chiefComplaints"][locale.languageCode]; + + String get errorChiefComplaints => localizedValues["errorChiefComplaints"][locale.languageCode]; + + String get expectedArrivalTime => localizedValues["expectedArrivalTime"][locale.languageCode]; + + String get errorExpectedArrivalTime => localizedValues["errorExpectedArrivalTimes"][locale.languageCode]; + + String get anicllaryOrders => localizedValues["ancillary-orders"][locale.languageCode]; + String get mrn => localizedValues["MRN"][locale.languageCode]; - String get appointmentDate => - localizedValues["appointment-date"][locale.languageCode]; - String get appointmentNo => - localizedValues["appointment-no"][locale.languageCode]; - String get insuranceID => - localizedValues["insurance-id"][locale.languageCode]; + + String get appointmentDate => localizedValues["appointment-date"][locale.languageCode]; + + String get appointmentNo => localizedValues["appointment-no"][locale.languageCode]; + + String get insuranceID => localizedValues["insurance-id"][locale.languageCode]; + String get enterFile => localizedValues["enter-file"][locale.languageCode]; - String get feedbackType => - localizedValues["feedback-type"][locale.languageCode]; - String get allow => localizedValues["allow"][locale.languageCode]; - String get reject => localizedValues["reject"][locale.languageCode]; - String get enterReferralRequesterName => - localizedValues["enterReferralRequesterName"][locale.languageCode]; - String get selectRelationship => - localizedValues["selectRelationship"][locale.languageCode]; - String get requesterRelationship => - localizedValues["requesterRelationship"][locale.languageCode]; + String get selectRelationship => localizedValues["selectRelationship"][locale.languageCode]; + + String get requesterRelationship => localizedValues["requesterRelationship"][locale.languageCode]; + String get newReferral => localizedValues["newReferral"][locale.languageCode]; - String get searchForReferrals => - localizedValues["searchForReferrals"][locale.languageCode]; - String get covidSelectProcedure => - localizedValues["covid-select-procedure"][locale.languageCode]; - String get onlineConsultation => - localizedValues["online-consultation"][locale.languageCode]; - String get expectedWaiting => - localizedValues["expected-weiting"][locale.languageCode]; - String get erConsultFee => - localizedValues["er-consult-fee"][locale.languageCode]; - String get insuredPatient => - localizedValues["insured-patient"][locale.languageCode]; - String get iAcceptTerms => - localizedValues["i-accept-terms"][locale.languageCode]; - String get upComingPayOption => - localizedValues["upcoming-pay-options"][locale.languageCode]; - String get pleaseAcceptTerms => - localizedValues["please-accept-terms"][locale.languageCode]; - String get pleaseSelectAllQuestionToContinue => - localizedValues["pleaseSelectAllQuestionToContinue"][locale.languageCode]; + + String get searchForReferrals => localizedValues["searchForReferrals"][locale.languageCode]; + + String get covidSelectProcedure => localizedValues["covid-select-procedure"][locale.languageCode]; + + String get onlineConsultation => localizedValues["online-consultation"][locale.languageCode]; + + String get expectedWaiting => localizedValues["expected-weiting"][locale.languageCode]; + + String get erConsultFee => localizedValues["er-consult-fee"][locale.languageCode]; + + String get insuredPatient => localizedValues["insured-patient"][locale.languageCode]; + + String get iAcceptTerms => localizedValues["i-accept-terms"][locale.languageCode]; + + String get upComingPayOption => localizedValues["upcoming-pay-options"][locale.languageCode]; + + String get pleaseAcceptTerms => localizedValues["please-accept-terms"][locale.languageCode]; + + String get pleaseSelectAllQuestionToContinue => localizedValues["pleaseSelectAllQuestionToContinue"][locale.languageCode]; + String get type => localizedValues["type"][locale.languageCode]; - String get eReferralInfo => - localizedValues["info-ereferral"][locale.languageCode]; - String get erConsultation => - localizedValues["er-consultation"][locale.languageCode]; - String get thisItemIsNotAvailable => - localizedValues["thisItemIsNotAvailable"][locale.languageCode]; - String get beforeAfterImages => - localizedValues["beforeAfterImages"][locale.languageCode]; + + String get eReferralInfo => localizedValues["info-ereferral"][locale.languageCode]; + + String get erConsultation => localizedValues["er-consultation"][locale.languageCode]; + + String get thisItemIsNotAvailable => localizedValues["thisItemIsNotAvailable"][locale.languageCode]; + + String get beforeAfterImages => localizedValues["beforeAfterImages"][locale.languageCode]; String get myInvoice => localizedValues["my-invoice"][locale.languageCode]; - String get invoicesList => - localizedValues["invoice-list"][locale.languageCode]; + String get invoicesList => localizedValues["invoice-list"][locale.languageCode]; - String get clinicAcceptLivecare => - localizedValues["clinic-accept-livecare"][locale.languageCode]; + String get clinicAcceptLivecare => localizedValues["clinic-accept-livecare"][locale.languageCode]; + + String get livecareModalTop => localizedValues["livecareModal-top"][locale.languageCode]; - String get livecareModalTop => - localizedValues["livecareModal-top"][locale.languageCode]; String get empty => localizedValues["empty"][locale.languageCode]; String get schedule => localizedValues["schedule"][locale.languageCode]; - String get livecarePoint2 => - localizedValues["livecare-point-2"][locale.languageCode]; - String get livecarePoint3 => - localizedValues["livecare-point-3"][locale.languageCode]; - String get livecarePoint4 => - localizedValues["livecare-point-4"][locale.languageCode]; - String get livecarePoint5 => - localizedValues["livecare-point-5"][locale.languageCode]; - String get bookImmediateLivecare => - localizedValues["book-immediate-livecare"][locale.languageCode]; - String get bookVideoLivecare2 => - localizedValues["book-video-livecare-2"][locale.languageCode]; + String get livecarePoint2 => localizedValues["livecare-point-2"][locale.languageCode]; + + String get livecarePoint3 => localizedValues["livecare-point-3"][locale.languageCode]; + + String get livecarePoint4 => localizedValues["livecare-point-4"][locale.languageCode]; + + String get livecarePoint5 => localizedValues["livecare-point-5"][locale.languageCode]; + + String get bookImmediateLivecare => localizedValues["book-immediate-livecare"][locale.languageCode]; + + String get bookVideoLivecare2 => localizedValues["book-video-livecare-2"][locale.languageCode]; + String get noThankyou => localizedValues["no-thankyou"][locale.languageCode]; - String get visitClinic => - localizedValues["visit-clinic"][locale.languageCode]; - String get generateCovidCertificate => - localizedValues["generate-covid-certificate"][locale.languageCode]; - String get isReportOutsideKsa => - localizedValues["is-report-outside-ksa"][locale.languageCode]; - String get passportNumber => - localizedValues["passport-number"][locale.languageCode]; - String get enterPassportNumber => - localizedValues["enter-passport-number"][locale.languageCode]; - String get validPassportNumber => - localizedValues["valid-passport-number"][locale.languageCode]; + + String get visitClinic => localizedValues["visit-clinic"][locale.languageCode]; + + String get generateCovidCertificate => localizedValues["generate-covid-certificate"][locale.languageCode]; + + String get isReportOutsideKsa => localizedValues["is-report-outside-ksa"][locale.languageCode]; + + String get passportNumber => localizedValues["passport-number"][locale.languageCode]; + + String get enterPassportNumber => localizedValues["enter-passport-number"][locale.languageCode]; + + String get validPassportNumber => localizedValues["valid-passport-number"][locale.languageCode]; + + String get continuePlan => localizedValues["continue-plan"][locale.languageCode]; + + String get dentalProcedureList => localizedValues["dental-procedure-list"][locale.languageCode]; + String get aboutApp => localizedValues["about-app"][locale.languageCode]; - String get aboutPointsLength => - localizedValues["about-points"]['length'][locale.languageCode]; - String get continuePlan => - localizedValues["continue-plan"][locale.languageCode]; - String get dentalProcedureList => - localizedValues["dental-procedure-list"][locale.languageCode]; + + String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode]; + String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; - String get totalTimeNeeded => - localizedValues["total-time-needed"][locale.languageCode]; + + String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode]; + String get infoEye => localizedValues["info-eye"][locale.languageCode]; - String get infoVaccines => - localizedValues["info-vaccines"][locale.languageCode]; - String get infoTrackers => - localizedValues["info-trackers"][locale.languageCode]; - String get infoHealthData => - localizedValues["info-health-data"][locale.languageCode]; + + String get infoVaccines => localizedValues["info-vaccines"][locale.languageCode]; + + String get infoTrackers => localizedValues["info-trackers"][locale.languageCode]; + + String get infoHealthData => localizedValues["info-health-data"][locale.languageCode]; + String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode]; - String get infoAutoWifi => - localizedValues["info-auto-wifi"][locale.languageCode]; + + String get infoAutoWifi => localizedValues["info-auto-wifi"][locale.languageCode]; + String get autoWifi => localizedValues["auto-wifi"][locale.languageCode]; - String get childVaccineInfo => - localizedValues["child-vaccine-info"][locale.languageCode]; + + String get childVaccineInfo => localizedValues["child-vaccine-info"][locale.languageCode]; + String get h2oInfo => localizedValues["h2o-info"][locale.languageCode]; + + String get sysdias => localizedValues["sys/dias"][locale.languageCode]; + + String get arm => localizedValues["arm"][locale.languageCode]; + + String get removeMeasure => localizedValues["remove-measure"][locale.languageCode]; + + String get selectArm => localizedValues["select-arm"][locale.languageCode]; + + String get askDocEmpty => localizedValues["ask-doc-empty"][locale.languageCode]; + + String get onlineClinics => localizedValues["online-clinics"][locale.languageCode]; + + String get offlineClinics => localizedValues["offline-clinics"][locale.languageCode]; + + String get clinicSchedule => localizedValues["clinic-schedule"][locale.languageCode]; + + String get discount => localizedValues["discount"][locale.languageCode]; + + String get totalVAT => localizedValues["total-VAT"][locale.languageCode]; + + String get paid => localizedValues["paid"][locale.languageCode]; + + String get dentalInsurance => localizedValues["dental-insurance"][locale.languageCode]; + + String get drivethruAppo => localizedValues["drivethru-appo"][locale.languageCode]; + + String get upcomingQRNFC => localizedValues["upcoming-QR-NFC"][locale.languageCode]; + + String get ovulationDesc => localizedValues["ovulation-desc"][locale.languageCode]; + + String get cycleLabel => localizedValues["cycle-label"][locale.languageCode]; + + String get lutealLabel => localizedValues["luteal-label"][locale.languageCode]; + + String get pregnancyTitle => localizedValues["pregnancy-title"][locale.languageCode]; + + String get pregnancyDesc => localizedValues["pregnancy-desc"][locale.languageCode]; + + String get pregnancyDateLabel => localizedValues["pregnancy-date-label"][locale.languageCode]; + + String get ovulationPeriod => localizedValues["ovulation-period"][locale.languageCode]; + + String get from => localizedValues["from"][locale.languageCode]; + + String get to => localizedValues["to"][locale.languageCode]; + + String get conceive => localizedValues["conceive"][locale.languageCode]; + + String get firstTri => localizedValues["firstTri"][locale.languageCode]; + + String get secondTri => localizedValues["secondTri"][locale.languageCode]; + + String get thirdTri => localizedValues["thirdTri"][locale.languageCode]; + + String get seeDoctorsList => localizedValues["seeDoctorsList"][locale.languageCode]; + + String get covidQuestionnaire => localizedValues["covidQuestionnaire"][locale.languageCode]; + + String get covidBookAppo => localizedValues["covidBookAppo"][locale.languageCode]; + + String get emptySchedule => localizedValues["emptySchedule"][locale.languageCode]; + + String get serviceNotAvailable => localizedValues["serviceNotAvailable"][locale.languageCode]; + + String get doctorScheduleNot => localizedValues["doctorScheduleNot"][locale.languageCode]; + + String get RRTRequestSuccess => localizedValues["RRTRequestSuccess"][locale.languageCode]; + + String get rateDoctorAppo => localizedValues["rateDoctorAppo"][locale.languageCode]; + + String get invoice => localizedValues["invoice"][locale.languageCode]; + + String get requestedDate => localizedValues["requestedDate"][locale.languageCode]; + + String get callDuration => localizedValues["callDuration"][locale.languageCode]; + + String get alreadyRated => localizedValues["alreadyRated"][locale.languageCode]; + + String get insuranceCompany => localizedValues["insuranceCompany"][locale.languageCode]; + + String get referralDetails => localizedValues["referralDetails"][locale.languageCode]; + + String get preferredBranch => localizedValues["preferredBranch"][locale.languageCode]; + + String get selectPreferredBranch => localizedValues["selectPreferredBranch"][locale.languageCode]; + + String get patientLocated => localizedValues["patientLocated"][locale.languageCode]; + + String get otherInfo => localizedValues["otherInfo"][locale.languageCode]; + + String get medicalReport => localizedValues["medicalReport"][locale.languageCode]; + + String get insuredPatientReferral => localizedValues["insuredPatient"][locale.languageCode]; + + String get rateDoctor => localizedValues["rateDoctor"][locale.languageCode]; + + String get rateAppointment => localizedValues["rateAppointment"][locale.languageCode]; + + String get noInsuranceCardAttached => localizedValues["noInsuranceCardAttached"][locale.languageCode]; + + String get bodyMassIndex => localizedValues["bodyMassIndex"][locale.languageCode]; + + String get extremeObese => localizedValues["extremeObese"][locale.languageCode]; + + String get respirationBPM => localizedValues["respirationBPM"][locale.languageCode]; + + String get noSlotsError => localizedValues["noSlotsError"][locale.languageCode]; + + String get selectSlot => localizedValues["selectSlot"][locale.languageCode]; + + String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode]; + + String get recAlert => localizedValues["recAlert"][locale.languageCode]; + + String get modesBelow => localizedValues["modesBelow"][locale.languageCode]; + + String get prefferedMode => localizedValues["prefferedMode"][locale.languageCode]; + + String get permissionsBellow => localizedValues["permissionsBellow"][locale.languageCode]; + + String get invoiceDetails => localizedValues["invoiceDetails"][locale.languageCode]; + + String get appoDetails => localizedValues["appoDetails"][locale.languageCode]; + + String get appoPaymentConfirm => localizedValues["appoPaymentConfirm"][locale.languageCode]; + + String get selectSearchCriteria => localizedValues["selectSearchCriteria"][locale.languageCode]; + + String get enterComplainNumber => localizedValues["enterComplainNumber"][locale.languageCode]; + + String get cancelAppointment => localizedValues["cancelAppointment"][locale.languageCode]; + + String get updateInsurCards => localizedValues["updateInsurCards"][locale.languageCode]; + + String get patientAge => localizedValues["patientAge"][locale.languageCode]; + + String get searchCriteria => localizedValues["searchCriteria"][locale.languageCode]; + + String get RequesterInfo => localizedValues["RequesterInfo"][locale.languageCode]; + + String get PatientInfo => localizedValues["PatientInfo"][locale.languageCode]; + + String get OtherInfo => localizedValues["OtherInfo"][locale.languageCode]; + + String get inPrgress => localizedValues["inPrgress"][locale.languageCode]; + + String get locked => localizedValues["locked"][locale.languageCode]; + + String get personalInfo => localizedValues['personalInfo'][locale.languageCode]; + + String get onlinePayment => localizedValues["onlinePayment"][locale.languageCode]; + + String get onlinePaymentSubtitle => localizedValues["onlinePaymentSubtitle"][locale.languageCode]; + + String get cmcTitle => localizedValues["cmcTitle"][locale.languageCode]; + + String get cmcSubtitle => localizedValues["cmcSubtitle"][locale.languageCode]; + + String get emergencyTitle => localizedValues["emergencyTitle"][locale.languageCode]; + + String get emergencySubtitle => localizedValues["emergencySubtitle"][locale.languageCode]; + + String get ereferralTitle => localizedValues["ereferralTitle"][locale.languageCode]; + + String get ereferralSubtitle => localizedValues["ereferralSubtitle"][locale.languageCode]; + + String get medicalFileTitle => localizedValues["medicalFileTitle"][locale.languageCode]; + + String get My_File_Details => localizedValues["My_File_Details"][locale.languageCode]; + + String get Ecommerce => localizedValues["Ecommerce"][locale.languageCode]; + + String get Family_Files => localizedValues["Family_Files"][locale.languageCode]; + + String get My_Child => localizedValues["My_Child"][locale.languageCode]; + + String get Vaccines => localizedValues["Vaccines"][locale.languageCode]; + + String get Todo => localizedValues["Todo"][locale.languageCode]; + + String get list => localizedValues["List"][locale.languageCode]; + + String get Blood => localizedValues["Blood"][locale.languageCode]; + + String get Donation => localizedValues["Donation"][locale.languageCode]; + + String get Health => localizedValues["Health"][locale.languageCode]; + + String get Calculator => localizedValues["Calculator"][locale.languageCode]; + + String get Converter => localizedValues["Converter"][locale.languageCode]; + + String get Smart => localizedValues["Smart"][locale.languageCode]; + + String get Watches => localizedValues["Watches"][locale.languageCode]; + + String get Parking => localizedValues["Parking"][locale.languageCode]; + + String get Details => localizedValues["Details"][locale.languageCode]; + + String get Virtual => localizedValues["Virtual"][locale.languageCode]; + + String get News => localizedValues["News"][locale.languageCode]; + + String get Latest => localizedValues["Latest"][locale.languageCode]; + + String get Tour => localizedValues["Tour"][locale.languageCode]; + String get mostViewed => localizedValues["mostViewed"][locale.languageCode]; + String get newProducts => localizedValues["newProducts"][locale.languageCode]; + + String get enterDetails => localizedValues["enterDetails"][locale.languageCode]; + + String get paymentSelected => localizedValues["paymentSelected"][locale.languageCode]; + + String get moreNotifications => localizedValues["moreNotifications"][locale.languageCode]; + + String get familyTitle => localizedValues["familyTitle"][locale.languageCode]; + + String get familySubtitle => localizedValues["familySubtitle"][locale.languageCode]; + + String get liveCareTitle => localizedValues["liveCareTitle"][locale.languageCode]; + + String get liveCareSubtitle => localizedValues["liveCareSubtitle"][locale.languageCode]; + + String get pharmacyTitle => localizedValues["pharmacyTitle"][locale.languageCode]; + + String get pharmacySubtitle => localizedValues["pharmacySubtitle"][locale.languageCode]; + + String get parkingTitle2 => localizedValues["parkingTitle2"][locale.languageCode]; + + String get parkingSubtitle => localizedValues["ParkingSubtitle"][locale.languageCode]; + + String get healthCalculatorTitle => localizedValues["healthCalculatorTitle"][locale.languageCode]; + + String get healthCalculatorSubtitle => localizedValues["healthCalculatorSubtitle"][locale.languageCode]; + + String get waterTitle => localizedValues["waterTitle"][locale.languageCode]; + + String get waterSubtitle => localizedValues["waterSubtitle"][locale.languageCode]; + + String get medicalFileTitle2 => localizedValues["medicalFileTitle2"][locale.languageCode]; + + String get medicalFileSubtitle => localizedValues["medicalFileSubtitle"][locale.languageCode]; + + String get healthConvertersTitle => localizedValues["healthConvertersTitle"][locale.languageCode]; + + String get healthConvertersSubtitle => localizedValues["healthConvertersSubtitle"][locale.languageCode]; + + String get syncHealthData => localizedValues["syncHealthData"][locale.languageCode]; + + String get steps => localizedValues["steps"][locale.languageCode]; + + String get avgSteps => localizedValues["avgSteps"][locale.languageCode]; + + String get avgDistance => localizedValues["avgDistance"][locale.languageCode]; + + String get avgHeartRate => localizedValues["avgHeartRate"][locale.languageCode]; + + String get alreadySynced => localizedValues["alreadySynced"][locale.languageCode]; + + String get syncInstructionsIntro1 => localizedValues["sync-instructions-intro1"][locale.languageCode]; + + String get syncInstructionsIntro2 => localizedValues["sync-instructions-intro2"][locale.languageCode]; + + String get syncInstructionsIntro3 => localizedValues["sync-instructions-intro3"][locale.languageCode]; + + String get iosInstructions1 => localizedValues["ios-instructions-1"][locale.languageCode]; + + String get iosInstructions2 => localizedValues["ios-instructions-2"][locale.languageCode]; + + String get iosInstructions3 => localizedValues["ios-instructions-3"][locale.languageCode]; + + String get supportedWatches => localizedValues["supportedWatches"][locale.languageCode]; + + String get watchInstructions => localizedValues["watchInstructions"][locale.languageCode]; + + String get monthlyTab => localizedValues["monthlyTab"][locale.languageCode]; + + String get moreSupportedWatches => localizedValues["moreSupportedWatches"][locale.languageCode]; + + String get androidInstructions1 => localizedValues["android-instructions-1"][locale.languageCode]; + + String get androidInstructions2 => localizedValues["android-instructions-2"][locale.languageCode]; + + String get androidInstructions3 => localizedValues["android-instructions-3"][locale.languageCode]; + + String get androidInstructions4 => localizedValues["android-instructions-4"][locale.languageCode]; + + String get tamaraInstPlan => localizedValues["tamaraInstPlan"][locale.languageCode]; + + String get onlineTag => localizedValues["onlineTag"][locale.languageCode]; + + String get offlineTag => localizedValues["offlineTag"][locale.languageCode]; + + String get viewDocList => localizedValues["viewDocList"][locale.languageCode]; + + String get bodyFatTitle => localizedValues["bodyFatTitle"][locale.languageCode]; + + String get cholesTitle => localizedValues["cholesTitle"][locale.languageCode]; + + String get laserClinic => localizedValues["laserClinic"][locale.languageCode]; + + String get noImage => localizedValues["noImage"][locale.languageCode]; + + String get signoutMessage => localizedValues["signoutMessage"][locale.languageCode]; + + String get RRTTitle => localizedValues["RRTTitle"][locale.languageCode]; + + String get RRTSubTitle => localizedValues["RRTSubTitle"][locale.languageCode]; + + String get transportation => localizedValues["transportation"][locale.languageCode]; + + String get browseOffers => localizedValues["browseOffers"][locale.languageCode]; + + String get myCart => localizedValues["myCart"][locale.languageCode]; + + String get neck => localizedValues["neck"][locale.languageCode]; + + String get waist => localizedValues["waist"][locale.languageCode]; + + String get hip => localizedValues["hip"][locale.languageCode]; + + String get carbsProtin => localizedValues["carbsProtin"][locale.languageCode]; + + String get inactiveAct => localizedValues["inactiveAct"][locale.languageCode]; + + String get light => localizedValues["light"][locale.languageCode]; + + String get moderate => localizedValues["moderate"][locale.languageCode]; + + String get very => localizedValues["very"][locale.languageCode]; + + String get superAct => localizedValues["super"][locale.languageCode]; + + String get resultCalories => localizedValues["resultCalories"][locale.languageCode]; + + String get bmrDesc => localizedValues["bmrDesc"][locale.languageCode]; + + String get idealWeightDesc => localizedValues["idealWeightDesc"][locale.languageCode]; + + String get bodyFrame => localizedValues["bodyFrame"][locale.languageCode]; + + String get bodyFrameSmall => localizedValues["bodyFrameSmall"][locale.languageCode]; + + String get bodyFrameMedium => localizedValues["bodyFrameMedium"][locale.languageCode]; + + String get bodyFrameLarge => localizedValues["bodyFrameLarge"][locale.languageCode]; + + String get bodyFatDesc => localizedValues["bodyFatDesc"][locale.languageCode]; + + String get essential => localizedValues["essential"][locale.languageCode]; + + String get athlete => localizedValues["athlete"][locale.languageCode]; + + String get fitness => localizedValues["fitness"][locale.languageCode]; + + String get acceptable => localizedValues["acceptable"][locale.languageCode]; + + String get obeseBodyFat => localizedValues["obeseBodyFat"][locale.languageCode]; + + String get invalid => localizedValues["invalid"][locale.languageCode]; + + String get more => localizedValues["more"][locale.languageCode]; + + String get less => localizedValues["less"][locale.languageCode]; + + String get carbProteinDesc => localizedValues["carbProteinDesc"][locale.languageCode]; + + String get calDay => localizedValues["calDay"][locale.languageCode]; + + String get notSure => localizedValues["notSure"][locale.languageCode]; + + String get selectDiet => localizedValues["selectDiet"][locale.languageCode]; + + String get dietVeryLow => localizedValues["dietVeryLow"][locale.languageCode]; + + String get dietLow => localizedValues["dietLow"][locale.languageCode]; + + String get dietModerate => localizedValues["dietModerate"][locale.languageCode]; + + String get dietUSDA => localizedValues["dietUSDA"][locale.languageCode]; + + String get dietZone => localizedValues["dietZone"][locale.languageCode]; + + String get useFullInfo => localizedValues["usefulInfo"][locale.languageCode]; + + String get babyAge => localizedValues["babyAge"][locale.languageCode]; + + String get babyAgeAvail => localizedValues["babyAgeAvail"][locale.languageCode]; + + String get deliveryDue => localizedValues["deliveryDue"][locale.languageCode]; + + String get almostInactive => localizedValues["almostInactive"][locale.languageCode]; + + String get lightActive1 => localizedValues["lightActive1"][locale.languageCode]; + + String get veryActive => localizedValues["veryActive"][locale.languageCode]; + + String get superActive => localizedValues["superActive"][locale.languageCode]; + + String get dailyIntake => localizedValues["dailyIntake"][locale.languageCode]; + + String get calculateAmount => localizedValues["calculateAmount"][locale.languageCode]; + + String get bodyWillBurn => localizedValues["bodyWillBurn"][locale.languageCode]; + + String get caloriesEachDay => localizedValues["caloriesEachDay"][locale.languageCode]; + + String get maintainWeight => localizedValues["maintainWeight"][locale.languageCode]; + + String get mediumFinger => localizedValues["mediumFinger"][locale.languageCode]; + + String get smallFinger => localizedValues["smallFinger"][locale.languageCode]; + + String get largeFinger => localizedValues["largeFinger"][locale.languageCode]; + + String get idealBodyWeight => localizedValues["idealBodyWeight"][locale.languageCode]; + + String get bodyFrameSize => localizedValues["bodyFrameSize"][locale.languageCode]; + + String get idealWeightRange => localizedValues["idealWeightRange"][locale.languageCode]; + + String get currentWeightPerfect => localizedValues["currentWeightPerfect"][locale.languageCode]; + + String get littleBitWeightMore => localizedValues["littleBitWeightMore"][locale.languageCode]; + + String get consultWithDoctor => localizedValues["consultWithDoctor"][locale.languageCode]; + + String get excessiveObesity => localizedValues["excessiveObesity"][locale.languageCode]; + + String get mayWish => localizedValues["mayWish"][locale.languageCode]; + + String get underObese => localizedValues["underObese"][locale.languageCode]; + + String get crossedLimits => localizedValues["crossedLimits"][locale.languageCode]; + + String get lowLimits => localizedValues["lowLimits"][locale.languageCode]; + + String get estimates => localizedValues["estimates"][locale.languageCode]; + + String get submitReview => localizedValues["submitReview"][locale.languageCode]; + + String get Protein => localizedValues["Protein"][locale.languageCode]; + String get Cals => localizedValues["Cals"][locale.languageCode]; + String get gramsPerDay => localizedValues["gramsPerDay"][locale.languageCode]; + String get gr => localizedValues["gr"][locale.languageCode]; + String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; + + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index cff955b9..f20f4243 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -3,17 +3,20 @@ import 'dart:core'; import 'dart:io'; import 'dart:typed_data'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:badges/badges.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:connectivity/connectivity.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/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedicationsPage.dart'; import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; @@ -33,17 +36,20 @@ import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; -import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; import '../Constants.dart'; +import '../locator.dart'; import 'app_shared_preferences.dart'; import 'app_toast.dart'; import 'gif_loader_dialog_utils.dart'; +import 'navigation_service.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -62,8 +68,10 @@ class Utils { /// Check The Internet Connection static Future checkConnection() async { - ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity()); - if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { + ConnectivityResult connectivityResult = + await (Connectivity().checkConnectivity()); + if ((connectivityResult == ConnectivityResult.mobile) || + (connectivityResult == ConnectivityResult.wifi)) { return true; } else { return false; @@ -127,11 +135,19 @@ class Utils { } static String getAppointmentTransID(int projectID, int clinicID, int appoNo) { - return projectID.toString() + '-' + clinicID.toString() + '-' + appoNo.toString(); + return projectID.toString() + + '-' + + clinicID.toString() + + '-' + + appoNo.toString(); } static String getAdvancePaymentTransID(int projectID, int fileNumber) { - return projectID.toString() + '-' + fileNumber.toString() + '-' + DateTime.now().millisecondsSinceEpoch.toString(); + return projectID.toString() + + '-' + + fileNumber.toString() + + '-' + + DateTime.now().millisecondsSinceEpoch.toString(); } bool validateIDBox(String value, type) { @@ -142,7 +158,7 @@ class Utils { } String loginIDPattern(loginType) { - var length = loginType == 1 ? 10 : 6; + var length = loginType == 1 ? 10 : 4; return "([0-9]{" + length.toString() + "})"; } @@ -180,6 +196,8 @@ class Utils { String newNumber = ""; if (number.startsWith('0')) { newNumber = number.substring(1); + } else { + newNumber = number; } return newNumber; } @@ -189,71 +207,119 @@ class Utils { } static validEmail(email) { - return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); + return RegExp( + r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") + .hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count}) { + static List myMedicalList( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { List medical = List(); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, child: isLogin ? Stack(children: [ - MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - isEnable: projectViewModel.havePrivilege(5)), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: secondaryColor.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(count.toString(), style: TextStyle(color: Colors.white, fontSize: 16.0)), - ), - ), + Container( + width: double.infinity, + height: double.infinity, + child: MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'appointment_list.svg', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5)), ), + projectViewModel.isArabic + ? !projectViewModel.user.isFamily + ? Positioned( + left: 8, + top: 4, + child: Badge( + toAnimate: false, + elevation: 0, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ), + ), + ) + : Container() + : !projectViewModel.user.isFamily + ? Positioned( + right: 8, + top: 4, + child: Badge( + toAnimate: false, + elevation: 0, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ), + ), + ) + : Container(), ]) : MedicalProfileItem( title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', + imagePath: 'appointment_list.svg', subTitle: TranslationBase.of(context).myAppointmentsList, hasBadge: true, isEnable: projectViewModel.havePrivilege(5), ), )); + if (projectViewModel.havePrivilege(10)) { medical.add(InkWell( onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), child: MedicalProfileItem( title: TranslationBase.of(context).lab, - imagePath: 'lab_result_icon.png', + imagePath: 'lab_result.svg', subTitle: TranslationBase.of(context).labSubtitle, ), )); } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null, + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).radiology, - imagePath: 'radiology_icon.png', + imagePath: 'radiology.svg', subTitle: TranslationBase.of(context).radiologySubtitle, isEnable: projectViewModel.havePrivilege(7), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null, + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).medicines, - imagePath: 'prescription_icon.png', + imagePath: 'medicine_prescription.svg', subTitle: TranslationBase.of(context).medicinesSubtitle, isEnable: projectViewModel.havePrivilege(12), ), @@ -268,19 +334,22 @@ class Utils { : null, child: MedicalProfileItem( title: TranslationBase.of(context).vitalSigns, - imagePath: 'vital_signs.png', + imagePath: 'vital_signs.svg', subTitle: TranslationBase.of(context).vitalSignsSubtitle, isEnable: projectViewModel.havePrivilege(25), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, + onTap: () { + if (projectViewModel.havePrivilege(48)) + Navigator.push(context, FadePage(page: ActiveMedicationsPage())); + }, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, - imagePath: 'active_medications.png', + imagePath: 'active_medication.svg', subTitle: TranslationBase.of(context).myMedicalSubtitle, - isEnable: false, + isEnable: projectViewModel.havePrivilege(48), ), )); @@ -294,34 +363,43 @@ class Utils { ) : null, child: MedicalProfileItem( - title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context).myDoctorSubtitle, isEnable: projectViewModel.havePrivilege(6)), + title: TranslationBase.of(context).myDoctor, + imagePath: 'my_doc.svg', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null, + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: MyInvoices())) + : null, child: MedicalProfileItem( - title: TranslationBase.of(context).myInvoice, - imagePath: 'Invoice.png', - subTitle: TranslationBase.of(context).invoicesList, + title: TranslationBase.of(context).invoicesList, + imagePath: 'invoice_list.svg', + subTitle: TranslationBase.of(context).myInvoice, isEnable: projectViewModel.havePrivilege(14), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).eye, - imagePath: 'eye_measurement_icon.png', + imagePath: 'eye_measurement.svg', subTitle: TranslationBase.of(context).eyeSubtitle, isEnable: projectViewModel.havePrivilege(14), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard())) : null, + onTap: () => projectViewModel.havePrivilege(22) + ? Navigator.push(context, FadePage(page: InsuranceCard())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).insurance, - imagePath: 'insurance_card_icon.png', + imagePath: 'insurance_card.svg', subTitle: TranslationBase.of(context).insuranceSubtitle, isEnable: projectViewModel.havePrivilege(22), ), @@ -333,152 +411,178 @@ class Utils { }, child: MedicalProfileItem( title: TranslationBase.of(context).updateInsurance, - imagePath: 'insurance_update_icon_.png', + imagePath: 'insurance_card.svg', subTitle: TranslationBase.of(context).updateInsuranceSubtitle, ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, + onTap: () => projectViewModel.havePrivilege(18) + ? Navigator.push(context, FadePage(page: InsuranceApproval())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, - imagePath: 'insurance_approvals_icon.png', + imagePath: 'insurance_approval.svg', subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, isEnable: projectViewModel.havePrivilege(18), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(23) ? Navigator.push(context, FadePage(page: AllergiesPage())) : null, + onTap: () => projectViewModel.havePrivilege(23) + ? Navigator.push(context, FadePage(page: AllergiesPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).allergies, - imagePath: 'my_allergies_icon.png', + imagePath: 'allergies_diagnosed.svg', subTitle: TranslationBase.of(context).allergiesSubtitle, isEnable: projectViewModel.havePrivilege(23), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(26) ? Navigator.push(context, FadePage(page: MyVaccines())) : null, + onTap: () => projectViewModel.havePrivilege(26) + ? Navigator.push(context, FadePage(page: MyVaccines())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myVaccines, - imagePath: 'my_vaccines_icon.png', + imagePath: 'vaccine_list.svg', subTitle: TranslationBase.of(context).myVaccinesSubtitle, isEnable: projectViewModel.havePrivilege(26), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, + onTap: () => projectViewModel.havePrivilege(20) + ? Navigator.push(context, FadePage(page: HomeReportPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).medical, - imagePath: 'medical_reports_icon.png', + imagePath: 'medical_report.svg', subTitle: TranslationBase.of(context).medicalSubtitle, isEnable: projectViewModel.havePrivilege(20), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, + onTap: () => projectViewModel.havePrivilege(19) + ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).monthly, - imagePath: 'monthly_reports_icon.png', + imagePath: 'monthly_report.svg', subTitle: TranslationBase.of(context).monthlySubtitle, isEnable: projectViewModel.havePrivilege(19), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, + onTap: () => projectViewModel.havePrivilege(16) + ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', + imagePath: 'sick_leave.svg', subTitle: TranslationBase.of(context).sickSubtitle, isEnable: projectViewModel.havePrivilege(16), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(47) ? Navigator.push(context, FadePage(page: MyBalancePage())) : null, + onTap: () => projectViewModel.havePrivilege(47) + ? Navigator.push(context, FadePage(page: MyBalancePage())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myBalance, - imagePath: 'check-in.png', + imagePath: 'balance_credit.svg', subTitle: TranslationBase.of(context).myBalanceSubtitle, isEnable: projectViewModel.havePrivilege(47), ), )); - // TODO mosa check it - medical.add(MedicalProfileItem( - title: TranslationBase.of(context).patientCall, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context).patientCallSubtitle, - isEnable: projectViewModel.havePrivilege(61), - )); + // medical.add(MedicalProfileItem( + // title: TranslationBase.of(context).patientCall, + // imagePath: 'medical_history_icon.png', + // subTitle: TranslationBase.of(context).patientCallSubtitle, + // isEnable: projectViewModel.havePrivilege(61), + // )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(24) ? Navigator.push(context, FadePage(page: MyTrackers())) : null, + onTap: () => projectViewModel.havePrivilege(24) + ? Navigator.push(context, FadePage(page: MyTrackers())) + : null, child: MedicalProfileItem( title: TranslationBase.of(context).myTrackers, - imagePath: 'my_tracker_icon.png', + imagePath: 'tracker.svg', subTitle: TranslationBase.of(context).myTrackersSubtitle, isEnable: projectViewModel.havePrivilege(24), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(30) ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) : null, + onTap: () => projectViewModel.havePrivilege(30) + ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) + : null, child: MedicalProfileItem( - title: TranslationBase.of(context).smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context).smartWatchesSubtitle, + title: TranslationBase.of(context).smartWatchesSubtitle, + imagePath: 'smart_watch.svg', + subTitle: TranslationBase.of(context).smartWatches, isEnable: projectViewModel.havePrivilege(30), ), )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(28) ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) : null, + onTap: () => projectViewModel.havePrivilege(28) + ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) + : null, child: MedicalProfileItem( - title: TranslationBase.of(context).askYour, imagePath: 'ask_doctor_icon.png', subTitle: TranslationBase.of(context).askYourSubtitle, isEnable: projectViewModel.havePrivilege(28)), + title: TranslationBase.of(context).askYourSubtitle, + imagePath: 'ask_doctor.svg', + subTitle: TranslationBase.of(context).askYour, + isEnable: projectViewModel.havePrivilege(28)), )); if (projectViewModel.havePrivilege(32) || true) { medical.add(InkWell( onTap: () { - if (projectViewModel.isLogin) { - userData().then((userData_) { + userData().then((userData_) { + if (projectViewModel.isLogin && userData_ != null) { String patientID = userData_.patientID.toString(); GifLoaderDialogUtils.showMyDialog(context); - projectViewModel.platformBridge().connectHMGInternetWifi(patientID).then((value) => {GifLoaderDialogUtils.hideDialog(context)}); - }); - } else { - Navigator.push( - context, - FadePage( - page: NotAutPage( - title: TranslationBase.of(context).autoWifi, - description: TranslationBase.of(context).infoAutoWifi, - infoList: [], - imagesInfo: [ - ImagesInfo( - imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/connect-to/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/connect-to/ar/0.png'), - ], - ))); - } + projectViewModel + .platformBridge() + .connectHMGInternetWifi(patientID) + .then((value) => {GifLoaderDialogUtils.hideDialog(context)}) + .catchError((err) { + print(err.toString()); + }); + } else { + AlertDialogBox( + context: context, + confirmMessage: + "Please login with your account first to use this feature", + okText: "OK", + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + }).showAlertDialog(context); + } + }); }, child: MedicalProfileItem( title: TranslationBase.of(context).internet, - imagePath: 'insurance_card_icon.png', + imagePath: 'internet_connection.svg', subTitle: TranslationBase.of(context).internetSubtitle, ), )); } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(40) ? launch('whatsapp://send?phone=18885521858&text=') : null, + onTap: () => projectViewModel.havePrivilege(40) + ? launch('whatsapp://send?phone=18885521858&text=') + : null, child: MedicalProfileItem( title: TranslationBase.of(context).chatbot, - imagePath: 'insurance_approvals_icon.png', + imagePath: 'chatbot.svg', subTitle: TranslationBase.of(context).chatbotSubtitle, isEnable: projectViewModel.havePrivilege(40), ), @@ -487,12 +591,142 @@ class Utils { return medical; } - static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}) { + static List myMedicalListHomePage( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { + List medical = List(); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, + child: isLogin + ? Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'appointment_list.svg', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5)), + projectViewModel.isArabic + ? !projectViewModel.isLoginChild + ? Positioned( + left: 8, + top: 4, + child: Badge( + toAnimate: false, + elevation: 0, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ), + ), + ) + : Container() + : !projectViewModel.isLoginChild + ? Positioned( + right: 8, + top: 4, + child: Badge( + toAnimate: false, + elevation: 0, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ), + ), + ) + : Container(), + ]) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'appointment_list.svg', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5), + ), + )); + + if (projectViewModel.havePrivilege(10)) { + medical.add(InkWell( + onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), + child: MedicalProfileItem( + title: TranslationBase.of(context).lab, + imagePath: 'lab_result.svg', + subTitle: TranslationBase.of(context).labSubtitle, + ), + )); + } + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology.svg', + subTitle: TranslationBase.of(context).radiologySubtitle, + isEnable: projectViewModel.havePrivilege(7), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'medicine_prescription.svg', + subTitle: TranslationBase.of(context).medicinesSubtitle, + isEnable: projectViewModel.havePrivilege(12), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(6) + ? Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'my_doc.svg', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), + )); + + return medical; + } + + static Widget loadNetworkImage( + {@required String url, BoxFit fitting = BoxFit.cover}) { return CachedNetworkImage( placeholderFadeInDuration: Duration(milliseconds: 250), fit: fitting, imageUrl: url, - placeholder: (context, url) => Container(child: Center(child: CircularProgressIndicator())), + placeholder: (context, url) => + Container(child: Center(child: CircularProgressIndicator())), errorWidget: (context, url, error) { return Icon( Icons.error, @@ -508,9 +742,113 @@ class Utils { } return route.runtimeType == equalsTo; } + + static navigateToCartPage() { + Navigator.pushAndRemoveUntil( + locator().navigatorKey.currentContext, + MaterialPageRoute( + builder: (context) => LandingPagePharmacy(currentTab: 3)), + (Route r) => false); + } + + static Widget tableColumnTitle(String text, {bool showDivider = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 6), + Text( + text, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + height: 18 / 12), + ), + SizedBox(height: 5), + if (showDivider) + Divider( + height: 1, + color: Color(0xff2E303A), + thickness: 1, + ) + ], + ); + } + + static Widget tableColumnValue(String text, + {bool isLast = false, + bool isCapitable = true, + ProjectViewModel mProjectViewModel}) { + ProjectViewModel projectViewModel = + mProjectViewModel ?? Provider.of(AppGlobal.context); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 12), + Text( + isCapitable && !projectViewModel.isArabic + ? text.toLowerCase().capitalizeFirstofEach + : text, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.4, + height: 16 / 10), + ), + SizedBox(height: 12), + if (!isLast) + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ], + ); + } + + static Widget tableColumnValueWithUnderLine(String text, + {bool isLast = false, bool isCapitable = true}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox(height: 14), + AutoSizeText( + isCapitable ? text.toLowerCase().capitalizeFirstofEach : text, + maxLines: 1, + minFontSize: 6, + style: TextStyle( + decoration: TextDecoration.underline, + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xffD02127), + letterSpacing: -0.48, + height: 18 / 12), + ), + SizedBox(height: 10), + if (!isLast) + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ], + ); + } } -Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { +Widget applyShadow( + {Color color = Colors.grey, + double shadowOpacity = 0.5, + double spreadRadius = 2, + double blurRadius = 7, + Offset offset = const Offset(2, 2), + @required Widget child}) { return Container( decoration: BoxDecoration( boxShadow: [ @@ -527,7 +865,8 @@ Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, doubl } Future userData() async { - var userData = AuthenticatedUser.fromJson(await AppSharedPreferences().getObject(MAIN_USER)); + var userData = AuthenticatedUser.fromJson( + await AppSharedPreferences().getObject(MAIN_USER)); return userData; } @@ -541,9 +880,12 @@ extension IndexedIterable on Iterable { openAppStore({String androidPackageName, String iOSAppID}) async { if (Platform.isAndroid) { - assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter"); - if ((await FlutterHmsGmsAvailability.isGmsAvailable)) launch("market://details?id=com.ejada.hmg"); - if ((await FlutterHmsGmsAvailability.isHmsAvailable)) launch("appmarket://details?id=com.ejada.hmg"); + assert(!(androidPackageName == null), + "Should have valid value in androidPackageName parameter"); + if ((await FlutterHmsGmsAvailability.isGmsAvailable)) + launch("market://details?id=com.ejada.hmg"); + if ((await FlutterHmsGmsAvailability.isHmsAvailable)) + launch("appmarket://details?id=com.ejada.hmg"); } else if (Platform.isIOS) { assert((iOSAppID == null), "Should have valid value in iOSAppID parameter"); launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"); @@ -567,6 +909,16 @@ String labelFrom({@required String className}) { return result; } +extension StringExtension on String { + String capitalize() { + return this.splitMapJoin(RegExp(r'\w+'), + onMatch: (m) => + '${m.group(0)}'.substring(0, 1).toUpperCase() + + '${m.group(0)}'.substring(1).toLowerCase(), + onNonMatch: (n) => ' '); + } +} + /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( GestureDetector(onTap: () { diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart new file mode 100644 index 00000000..832a92b1 --- /dev/null +++ b/lib/uitl/utils_new.dart @@ -0,0 +1,577 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +Decoration appGradient = BoxDecoration( + gradient: LinearGradient( + colors: [ + Color(0xFFFDCA46F), + Color(0xFFFA47E5D), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), +); + +Color getColorFromHex(String hexColor) { + hexColor = hexColor.toUpperCase().replaceAll('#', ''); + + if (hexColor.length == 6) { + hexColor = 'FF' + hexColor; + } + + return Color(int.parse(hexColor, radix: 16)); +} + +Widget getPaymentMethods() { + return Container( + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Image.asset("assets/images/new/payment/Mada.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/visa.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Mastercard.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Apple_Pay.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/installments.png", width: 50, height: 50), + ], + ), + ); +} + +Widget getNoDataWidget(BuildContext context) { + return Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/new/not_found.svg', width: 110.0, height: 110.0), + Container( + margin: EdgeInsets.only(top: 15.0), + child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), + ], + ), + ), + ); +} + +spacerVertical(double v) { + return Container( + height: v, + width: double.infinity, + ); +} + +spacerHorizontal(double v) { + return Container( + height: v, + width: v, + ); +} + +spacer() { + return SizedBox( + height: 8, + ); +} + +Future navigateTo(context, page) async { + return await Navigator.push(context, MaterialPageRoute(builder: (context) => page)); +} + +// Future navigateToReplace(context, page) async { +// Navigator.pushReplacement(context, FadeRouteBuilder(page: page)); +// } + +InputDecoration txtField(String label) { + return new InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + hintText: label, + hintStyle: TextStyle(color: Colors.grey), + disabledBorder: InputBorder.none, + contentPadding: EdgeInsets.only(left: 15, right: 15), + ); +} + +InputDecoration txtField3(String label) { + return new InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + errorBorder: InputBorder.none, + hintText: label, + disabledBorder: InputBorder.none, + counterText: "", + contentPadding: EdgeInsets.only(left: 5, right: 5), + ); +} + +InputDecoration txtFieldSearch(String label) { + return new InputDecoration( + border: InputBorder.none, + suffixIcon: Icon(Icons.clear), + disabledBorder: InputBorder.none, + contentPadding: EdgeInsets.only(left: 15, right: 15), + ); +} + +Widget circularAviator( + double s, { + Color bcColor, + Color brColor, + Color iconColor, + int borderWidth, + IconData icon, + double elevation = 4, +}) { + return Card( + shape: cardRadiusNew(2000), + color: Colors.transparent, + elevation: elevation, + child: Container( + width: s, + height: s, + decoration: containerColorRadiusBorderWidth(bcColor == null ? Colors.grey[200] : bcColor, 2000, brColor == null ? Colors.blueGrey[800] : brColor, borderWidth == null ? 2 : borderWidth), + child: Icon( + icon == null ? Icons.person : icon, + size: s / 1.7, + color: iconColor == null ? Colors.grey[800] : iconColor, + ), + ), + ); +} + +Widget circularImage(String im, double width, double height) { + return new Container( + width: 190.0, + height: 190.0, + decoration: new BoxDecoration( + shape: BoxShape.circle, + image: new DecorationImage( + fit: BoxFit.fill, + image: new AssetImage(im), + ), + ), + ); +} + +circularImage2(String im, double width, double height) { + return new Container( + width: width, + height: height, + decoration: new BoxDecoration( + shape: BoxShape.circle, + image: new DecorationImage( + fit: BoxFit.fill, + image: new AssetImage(im), + ), + ), + ); +} + +Widget mDivider(Color color) { + return Divider( + // width: double.infinity, + height: 1, + color: color, + ); +} + +Widget mFlex(int f) { + return Flexible( + flex: f, + child: Container(), + ); +} + +mOverlay(double op) { + return Opacity( + opacity: op, + child: Container( + color: Colors.black, + width: double.infinity, + height: double.infinity, + ), + ); +} + +Widget mHeight(double h) { + return Container( + height: h, + ); +} + +Widget mWidth(double w) { + return Container( + width: w, + ); +} + +RoundedRectangleBorder buttonShape() { + return RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14.0), + ); +} + +Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2}) { + return BoxDecoration( + borderRadius: BorderRadius.circular(radius), + gradient: LinearGradient( + colors: [ + color1?? Color(0xFFF71787E), + color2?? Color(0xFFF2B353E), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ); +} + +Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColor, Color lightColor}) { + return BoxDecoration( + borderRadius: BorderRadius.only(bottomRight: Radius.circular(radius)), + gradient: LinearGradient( + colors: [ + darkColor == null ? Color(0xFFF2B353E) : darkColor, + lightColor == null ? Color(0xFFF71787E) : lightColor, + ], + begin: Alignment.topCenter, + end: Alignment.bottomRight, + ), + ); +} + +Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color darkColor, Color lightColor}) { + return BoxDecoration( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius)), + gradient: LinearGradient( + colors: [ + lightColor == null ? Color(0xFFF71787E) : lightColor, + darkColor == null ? Color(0xFFF2B353E) : darkColor, + ], + begin: Alignment.topCenter, + end: Alignment.bottomRight, + ), + ); +} + +Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, Color lightColor}) { + return BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(radius)), + gradient: LinearGradient( + colors: [ + darkColor == null ? Color(0xFF2B353E) : darkColor, + lightColor == null ? Color(0xFF71787E) : lightColor, + ], + begin: Alignment.centerRight, + end: Alignment.topLeft, + ), + ); +} + +Decoration containerBottomRightRadiusWithGradientBorder(double radius, {Color darkColor, Color lightColor, Color borderColor = Colors.transparent, double w = 0}) { + return BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(radius)), + border: Border.all( + width: w, // + color: borderColor // <--- border width here + ), + gradient: LinearGradient( + colors: [ + darkColor == null ? Color(0xFFF2B353E) : darkColor, + lightColor == null ? Color(0xFFF71787E) : lightColor, + ], + begin: Alignment.topCenter, + end: Alignment.bottomRight, + ), + ); +} + +Decoration containerRadius(Color background, double radius) { + return BoxDecoration( + color: background, + border: Border.all( + width: 1, // + color: background // <--- border width here + ), + borderRadius: BorderRadius.circular(radius), + ); +} + +Decoration containerColorRadiusBorder(Color background, double radius, Color color) { + return BoxDecoration( + color: background, + border: Border.all( + width: 1, // + color: color // <--- border width here + ), + borderRadius: BorderRadius.circular(radius), + ); +} + +Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) { + return BoxDecoration( + color: background, + border: Border.all( + width: w, // + color: color // <--- border width here + ), + borderRadius: BorderRadius.circular(radius), + ); +} + +Decoration containerColorRadiusBorderWidthCircular(Color background, double radius, Color color, double w) { + return BoxDecoration( + color: background, + border: Border.all( + width: w, // + color: color // <--- border width here + ), + // borderRadius: BorderRadius.circular(radius), + shape: BoxShape.circle, + ); +} + +Decoration containerColorRadiusRight(Color background, double radius) { + return BoxDecoration( + color: background, + borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + ); +} + +Decoration containerColorRadiusLeft(Color background, double radius) { + return BoxDecoration( + color: background, + borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + ); +} + +Decoration containerColorRadiusRightBorder(Color background, double radius, double w) { + return BoxDecoration( + color: background, + border: Border.all( + width: w, // + color: Colors.white // <--- border width here + ), + borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + ); +} + +Decoration containerColorRadiusRightBorderc(Color background, double radius, double w, Color borderColor) { + return BoxDecoration( + color: background, + border: Border.all( + width: w, // + color: borderColor // <--- border width here + ), + borderRadius: BorderRadius.circular(radius), + ); +} + +Decoration containerColorRadiusTop(Color color, double radius) { + return BoxDecoration( + color: color, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), + topRight: Radius.circular(radius), + ), + ); +} + +Decoration containerColorRadiusBottom(Color color, double radius) { + return BoxDecoration( + color: color, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(radius), + bottomRight: Radius.circular(radius), + ), + ); +} + +Decoration containerColorRadiusLeftBorder(Color background, double radius, double w) { + return BoxDecoration( + color: background, + border: Border.all( + width: w, // + color: Colors.white // <--- border width here + ), + borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + ); +} + +BoxDecoration cardRadius(double radius,{Color color,double elevation}) { + return BoxDecoration( + shape: BoxShape.rectangle, + color: color??Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(radius), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius:elevation?? 27, + offset: Offset(-2, 3), + ), + ], + ); +} + +ShapeBorder cardRadiusNew(double radius) { + return RoundedRectangleBorder( + side: BorderSide(color: Colors.transparent, width: 0), + borderRadius: BorderRadius.all(Radius.circular(radius)), + ); +} + +ShapeBorder cardRadiusTop(double radius) { + return RoundedRectangleBorder( + side: BorderSide(color: Colors.transparent, width: 0), + borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + ); +} + +ShapeBorder cardRadiusTop2(double radius) { + return RoundedRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + ); +} + +ShapeBorder cardRadiusBottom(double radius) { + return RoundedRectangleBorder( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)), + ); +} + +ShapeBorder cardRadiusWithoutBorder(double radius) { + return RoundedRectangleBorder( + side: BorderSide(color: Colors.transparent, width: 1), + borderRadius: BorderRadius.circular(radius), + ); +} + +ShapeBorder cardRadiusWithBorder(double radius) { + return RoundedRectangleBorder( + side: BorderSide(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(radius), + ); +} + +ShapeBorder cardRadiusBorder(double radius, double w) { + return RoundedRectangleBorder( + side: BorderSide(color: Colors.transparent, width: w), + borderRadius: BorderRadius.circular(radius), + ); +} + +// String properRound(double val, int places) { +// double mod = pow(10.0, places); +// double result = ((val * mod).round().toDouble() / mod); +// return result.toString(); +// } +// +// double properRoundDouble(double val, int places) { +// double mod = pow(10.0, places); +// double result = ((val * mod).round().toDouble() / mod); +// return result; +// } +//var cardShape = RoundedRectangleBorder( +// side: BorderSide(color: Colors.white70, width: 1), +// borderRadius: BorderRadius.circular(10), +//); + +//await Navigator.of(context).push(new MaterialPageRoute( +//builder: (BuildContext context) { +//return AdminTeamAvaluatePage(widget.competitionID, data); +//}, +//)); +//setState(() {}); + +Color getColor(String selectedColor) { + try { + if ("black" == selectedColor) { + return Colors.black; + } else if ("red" == selectedColor) { + return Colors.red; + } else if ("blueAccent" == selectedColor) { + return Colors.blueAccent; + } else if ("blue" == selectedColor) { + return Colors.blue; + } else if ("blueGrey" == selectedColor) { + return Colors.blueGrey; + } else if ("yellow" == selectedColor) { + return Colors.yellow; + } else if ("black54" == selectedColor) { + return Colors.black54; + } else if ("green" == selectedColor) { + return Colors.green; + } else if ("orange" == selectedColor) { + return Colors.orange; + } else if ("deepOrange" == selectedColor) { + return Colors.deepOrange; + } else { + return Colors.black; + } + } catch (e) { + return Colors.black; + } +} + +TextAlign getTextAlign(String textAlign) { + try { + if (textAlign == "left") { + return TextAlign.left; + } else if (textAlign == "right") { + return TextAlign.right; + } else if (textAlign == "center") { + return TextAlign.center; + } else if (textAlign == "justify") { + return TextAlign.justify; + } else { + return TextAlign.left; + } + } catch (e) { + print("fffff " + e.toString()); + return TextAlign.left; + } +} + +FontWeight getFontWeight(String fontWeight) { + if (fontWeight == null) { + return FontWeight.normal; + } else if (fontWeight == "bold") { + return FontWeight.bold; + } else { + return FontWeight.normal; + } +} + +FontStyle getFontStyle(String fontStyle) { + try { + if (fontStyle == null) { + return FontStyle.normal; + } else if (fontStyle == "italian") { + return FontStyle.italic; + } else { + return FontStyle.normal; + } + } catch (e) { + return FontStyle.normal; + } +} + +bool timeCalculator(int startHour, int startMint, int endHour, int endMint) { + DateTime now = DateTime.now(); + DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour); + DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint); + if (startDate.isBefore(now) && endDate.isAfter(now)) + return true; + else + return false; +} diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index b7a20339..75083d1a 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -6,8 +6,7 @@ class GifLoaderContainer extends StatefulWidget { _GifLoaderContainerState createState() => _GifLoaderContainerState(); } -class _GifLoaderContainerState extends State - with TickerProviderStateMixin { +class _GifLoaderContainerState extends State with TickerProviderStateMixin { GifController controller1; @override @@ -15,8 +14,9 @@ class _GifLoaderContainerState extends State controller1 = GifController(vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { - controller1.repeat( - min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + try { + controller1.repeat(min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + } catch (ex) {} }); super.initState(); } @@ -30,14 +30,13 @@ class _GifLoaderContainerState extends State @override Widget build(BuildContext context) { return Center( - //progress-loading.gif + //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"), - ), - )); + // 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"), + ), + )); } -} \ No newline at end of file +} diff --git a/lib/widgets/LoadingButton.dart b/lib/widgets/LoadingButton.dart index 6924bd44..c0004112 100644 --- a/lib/widgets/LoadingButton.dart +++ b/lib/widgets/LoadingButton.dart @@ -1,9 +1,8 @@ +import 'dart:math'; + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'dart:math'; - -import 'data_display/text.dart'; class AnimatedButton extends StatefulWidget { AnimatedButton({ diff --git a/lib/widgets/TextFieldInertiaDirection.java b/lib/widgets/TextFieldInertiaDirection.java index 627bf406..daaa0229 100644 --- a/lib/widgets/TextFieldInertiaDirection.java +++ b/lib/widgets/TextFieldInertiaDirection.java @@ -1,8 +1,6 @@ -import 'dart:math'; - -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +'dart:math'; + 'package:flutter/gestures.dart'; + 'package:flutter/material.dart'; 'package:font_awesome_flutter/font_awesome_flutter.dart'; enum TextFieldInertiaDirection { left, diff --git a/lib/widgets/app_map/google_huawei_map.dart b/lib/widgets/app_map/google_huawei_map.dart new file mode 100644 index 00000000..ff9efeff --- /dev/null +++ b/lib/widgets/app_map/google_huawei_map.dart @@ -0,0 +1,90 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:huawei_map/map.dart' as hmsMap; + +class AppMap extends StatefulWidget { + CameraPositionCallback onCameraMove; + Map initialCamera; + + AppMapState _state; + Function onMapCreated; + + AppMap(this.initialCamera, {this.onCameraMove, this.onMapCreated}); + + @override + State createState() => _state = AppMapState(); + + moveTo({@required CameraPosition cameraPostion}) { + if (_state.isHuawei) { + final cameraJson = cameraPostion.toMap(); + final camera = hmsMap.CameraPosition.fromMap(cameraJson); + _state._huaweiMapController.animateCamera(hmsMap.CameraUpdate.newCameraPosition(camera)); + } else { + _state.googleMapController.animateCamera(CameraUpdate.newCameraPosition(cameraPostion)); + } + } +} + +class AppMapState extends State { + bool isHuawei = false; + + Completer _googleMapControllerComp = Completer(); + GoogleMapController googleMapController; + + Completer _huaweiMapControllerComp = Completer(); + hmsMap.HuaweiMapController _huaweiMapController; + + checkIsHuawei() async { + isHuawei = await FlutterHmsGmsAvailability.isHmsAvailable; + setState(() {}); + } + + @override + void initState() { + checkIsHuawei(); + } + + @override + Widget build(BuildContext context) { + if (isHuawei == null) return CircularProgressIndicator(); + return map(); + } + + Widget map() => isHuawei ? huaweiMap() : googleMap(); + + Widget googleMap() { + return GoogleMap( + mapType: MapType.normal, + zoomControlsEnabled: true, + myLocationButtonEnabled: true, + myLocationEnabled: true, + initialCameraPosition: CameraPosition.fromMap(widget.initialCamera), + onCameraMove: widget.onCameraMove, + onMapCreated: (GoogleMapController controller) { + googleMapController = controller; + _googleMapControllerComp.complete(controller); + widget.onMapCreated(); + }, + ); + } + + Widget huaweiMap() { + return hmsMap.HuaweiMap( + mapType: hmsMap.MapType.normal, + zoomControlsEnabled: false, + myLocationButtonEnabled: true, + myLocationEnabled: true, + initialCameraPosition: hmsMap.CameraPosition.fromMap(widget.initialCamera), + onCameraMove: (camera) => widget.onCameraMove(CameraPosition.fromMap(camera.toMap())), + onMapCreated: (controller) { + _huaweiMapController = controller; + _huaweiMapControllerComp.complete(controller); + widget.onMapCreated(); + }, + ); + } +} diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index fcfcaa94..131a2820 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../show_zoom_image_dialog.dart'; + /// LargeAvatar /// [name] the user name /// [url] the image url @@ -11,20 +14,12 @@ import 'package:flutter/material.dart'; /// [height] the avatar height /// [onTap] on tap function class LargeAvatar extends StatelessWidget { - LargeAvatar( - {Key key, - @required this.name, - this.url, - this.disableProfileView: false, - this.radius = 70.0, - this.width = 70, - this.height = 60, - this.onTap}) - : super(key: key); + LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar: false}) : super(key: key); final String name; final String url; final bool disableProfileView; + final bool isAppointmentAvatar; final double radius; final double width; final double height; @@ -35,11 +30,22 @@ class LargeAvatar extends StatelessWidget { return Center( child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(radius)), - child: Image.network( - url.trim(), - fit: BoxFit.fill, - width: width, - height: height, + child: Stack( + alignment: Alignment.center, + children: [ + Image.network( + url.trim(), + fit: BoxFit.fill, + width: width, + height: height, + ), + if (!disableProfileView && !isAppointmentAvatar) + Container( + child: Icon(Icons.search,size: 18,color: Colors.white,), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), ), ); @@ -55,22 +61,27 @@ class LargeAvatar extends StatelessWidget { @override Widget build(BuildContext context) { return InkWell( - onTap: disableProfileView ? null : onTap, + onTap: disableProfileView + ? null + : isAppointmentAvatar ? onTap : () { + print("ssssss " + url.trim()); + showZoomImageDialog(context, url.trim() ?? ""); + }, child: Container( decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment(-1, -1), - end: Alignment(1, 1), - colors: [ - Colors.grey[100], - Colors.grey[800], - ]), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], + // gradient: LinearGradient( + // begin: Alignment(-1, -1), + // end: Alignment(1, 1), + // colors: [ + // Colors.grey[100], + // Colors.grey[800], + // ]), + // boxShadow: [ + // BoxShadow( + // color: Color.fromRGBO(0, 0, 0, 0.08), + // offset: Offset(0.0, 5.0), + // blurRadius: 16.0) + // ], borderRadius: BorderRadius.all(Radius.circular(radius)), ), width: width, diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 48ea6819..9f9c7c0c 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -1,16 +1,12 @@ -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:provider/provider.dart'; import '../../d_q_icons_icons.dart'; @@ -20,9 +16,7 @@ class BottomNavBar extends StatefulWidget { final ValueChanged changeIndex; final int index; final bool showHomeIcon; - BottomNavBar( - {Key key, this.changeIndex, this.index, this.showHomeIcon = false}) - : super(key: key); + BottomNavBar({Key key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key); @override _BottomNavBarState createState() => _BottomNavBarState(); @@ -34,7 +28,7 @@ class _BottomNavBarState extends State { var event = RobotProvider(); _changeIndex(int index) async { widget.changeIndex(index); - if (index == 0) { + if (index == 5) { event.setValue({'isRobotVisible': 'true'}); } } @@ -61,7 +55,7 @@ class _BottomNavBarState extends State { changeIndex: _changeIndex, index: widget.index, currentIndex: 1, - name: TranslationBase.of(context).medicalProfile, + name: TranslationBase.of(context).medicalFile, ), BottomNavigationItem( icon: DQIcons.family, @@ -70,31 +64,19 @@ class _BottomNavBarState extends State { index: widget.index, currentIndex: 3, name: TranslationBase.of(context).myFamily, + isDisabled: projectViewModel.isLoginChild, ), if (widget.index == 0) - Expanded( - child: (widget.showHomeIcon) - ? SizedBox( - child: BottomNavigationItem( - icon: Icons.home_outlined, - activeIcon: Icons.home_outlined, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 2, - name: TranslationBase.of(context).home, - ), - ) - : SizedBox( - height: 50, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 22), - ], - ), - ), - ), + (widget.showHomeIcon) + ? BottomNavigationItem( + icon: Icons.home_outlined, + activeIcon: Icons.home_outlined, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 2, + name: TranslationBase.of(context).home, + ) + : Expanded(child: SizedBox()), if (widget.index != 0 && projectViewModel.havePrivilege(34)) BottomNavigationItem( icon: Icons.home_outlined, @@ -112,11 +94,10 @@ class _BottomNavBarState extends State { // currentIndex: 2, // name: TranslationBase.of(context).bookAppo, // ), - if (/*widget.index == 0 && */ projectViewModel - .havePrivilege(34)) + if (/*widget.index == 0 && */ projectViewModel.havePrivilege(34)) BottomNavigationItem( - icon: EvaIcons.calendar, - activeIcon: EvaIcons.calendar, + icon: Icons.calendar_today_sharp, + activeIcon: Icons.calendar_today_sharp, changeIndex: _changeIndex, index: widget.index, currentIndex: 4, @@ -128,7 +109,7 @@ class _BottomNavBarState extends State { activeIcon: DQIcons.roboticon, changeIndex: _changeIndex, index: widget.index, - currentIndex: 0, + currentIndex: 5, name: TranslationBase.of(context).help, ) ], diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index 91aefc75..f01f70af 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -1,5 +1,6 @@ import 'package:badges/badges.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -16,21 +17,16 @@ class BottomNavigationItem extends StatelessWidget { final int index; final int currentIndex; final String name; + final bool isDisabled; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); - BottomNavigationItem( - {this.icon, - this.activeIcon, - this.changeIndex, - this.index, - this.currentIndex, - this.name}); + BottomNavigationItem({this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name, this.isDisabled = false}); @override Widget build(BuildContext context) { var model = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return Expanded( child: SizedBox( // height: 72.0, @@ -39,7 +35,9 @@ class BottomNavigationItem extends StatelessWidget { child: InkWell( highlightColor: Colors.transparent, splashColor: Colors.transparent, - onTap: () => changeIndex(currentIndex), + onTap: () { + if (!isDisabled) changeIndex(currentIndex); + }, child: currentIndex != 4 ? Column( mainAxisSize: MainAxisSize.min, @@ -52,7 +50,9 @@ class BottomNavigationItem extends StatelessWidget { child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor - : Colors.grey, + : isDisabled + ? Colors.grey[300] + : Colors.grey, size: 22.0), ), SizedBox( @@ -63,7 +63,9 @@ class BottomNavigationItem extends StatelessWidget { textAlign: TextAlign.center, color: currentIndex == index ? secondaryColor - : Colors.grey, + : isDisabled + ? Colors.grey[300] + : Colors.grey, fontSize: 11, ), SizedBox( @@ -71,7 +73,7 @@ class BottomNavigationItem extends StatelessWidget { ), ], ) - : (authenticatedUserObject.isLogin && model.isShowBadge) + : (authenticatedUserObject.isLogin && model.isShowBadge && !projectViewModel.isLoginChild) ? Stack( alignment: AlignmentDirectional.center, children: [ @@ -86,9 +88,7 @@ class BottomNavigationItem extends StatelessWidget { borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text(model.count.toString(), - style: TextStyle( - color: Colors.white, fontSize: 14.0)), + child: Text(model.count.toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), ), ), ), @@ -100,12 +100,7 @@ class BottomNavigationItem extends StatelessWidget { height: 15, ), Container( - child: Icon( - currentIndex == index ? activeIcon : icon, - color: currentIndex == index - ? secondaryColor - : Theme.of(context).dividerColor, - size: 22.0), + child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), SizedBox( height: 2, @@ -113,9 +108,7 @@ class BottomNavigationItem extends StatelessWidget { Texts( name, textAlign: TextAlign.center, - color: currentIndex == index - ? Theme.of(context).primaryColor - : Colors.grey, + color: currentIndex == index ? Theme.of(context).primaryColor : Colors.grey, fontSize: 11, ), SizedBox( @@ -133,11 +126,12 @@ class BottomNavigationItem extends StatelessWidget { height: 15, ), Container( - child: Icon( - currentIndex == index ? activeIcon : icon, + child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor - : Theme.of(context).dividerColor, + : isDisabled + ? Colors.grey[300] + : Theme.of(context).dividerColor, size: 22.0), ), SizedBox( @@ -148,7 +142,9 @@ class BottomNavigationItem extends StatelessWidget { textAlign: TextAlign.center, color: currentIndex == index ? secondaryColor - : Colors.grey, + : isDisabled + ? Colors.grey[300] + : Colors.grey, fontSize: 11, ), SizedBox( diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index 7bbadd8c..a9e9c4c1 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; +// import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; @@ -20,10 +20,10 @@ class ImageOptions { ), _BottomSheetItem( title: TranslationBase.of(context).gallery, - icon: FeatherIcons.image, + icon: Icons.image, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.gallery); + await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 20); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); @@ -34,10 +34,10 @@ class ImageOptions { ), _BottomSheetItem( title: TranslationBase.of(context).camera, - icon: FeatherIcons.camera, + icon: Icons.camera_alt, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.camera); + await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 20); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index 331ce4b6..84f3cca6 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; /// Button widget @@ -12,15 +10,7 @@ import 'package:provider/provider.dart'; /// [loading] show the progress indicator /// [elevation] color elevation value class Button extends StatefulWidget { - Button( - {Key key, - this.label: "", - this.icon, - this.onTap, - this.backgroundColor, - this.loading: false, - this.elevation: true, this.disabled=false}) - : super(key: key); + Button({Key key, this.label: "", this.icon, this.onTap, this.backgroundColor, this.loading: false, this.elevation: true, this.disabled = false}) : super(key: key); final String label; final Widget icon; @@ -39,17 +29,11 @@ class _ButtonState extends State